ml-kem: Adds feature flag to use key or seed#83
ml-kem: Adds feature flag to use key or seed#83supinie wants to merge 3 commits intoRustCrypto:masterfrom
Conversation
begin refactor adds feature flag to use key or seed minor fixes to no-default disables acvp tests for seed adds missing conditional reset actions properly handle tests properly negate tests to stop clippy warnings
|
Really seeds should be the "default" API, not something that's enabled by a feature. I think it's OK to make breaking changes towards that end. |
I can easily swap this around - will put together a new commit now. |
|
I just thought, since we now have two feature flags, is it also worth adding a short section on the docs homepage about them? |
|
@supinie I would prefer a PR like this be purely additive, as opposed to changing things depending on if the feature is enabled by using |
|
@tarcieri in that case, would we rather that the DecapsulationKey object is the seed, and we then generate the "inner" key before use, or keep the |
|
That's a good question. In As things are currently implemented, the seed is always expanded prior to use, and the expanded form is not cached but instead always computed on demand. I think something similar could work here? |
|
I've refactored it to fit this style, but am unable to get the KATs working ( I have pushed these changes to https://github.com/supinie/KEMs/tree/additive so you can take a look if you'd like. |
|
I've been thinking a little more about this problem recently, perhaps we could use an enum to hold either the key as a seed or the key as an inner. The enum would ensure that only one can be set at a time, with a preference towards using the seed, but in some cases would allow us to carry around the old inner key instead? |
I personally would like to be able to use both, especially without having feature flag usage. |
When I'm saying "use both", I'm talking internally, an external user would just see a key object. We wouldn't want or need to store both internally as they just do the same thing. Please correct me if I've misunderstood, but @tarcieri would also like it to be this way; the flag simply allows you to gain access to the old API |
|
Closing in favor of #133 |
Resolves #53
I saw that @bifurcation mentioned that the test vectors should work, but they appeared to be in the wrong format. For now I have disabled them in the same way that
deterministicdoes.I have tried to write it in such a way that the user always deals with a
DecapsulationKeytype no matter whether this is a true key or seed to maximise backwards compatibility.