ml-dsa: Rename KeyGen::key_gen_internal
to from_seed
#1054
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an alternative to #1046 to reduce copying the seed derivation logic. Implementing a
from_seed
as raised in issue #1045.KeyGen::key_gen_internal
toKeyGen::from_seed
.SigningKey::from_seed
. This internally callsKeyGen::from_seed
for now, as the majority of the computational work is the same for both keys. A future PR could be slightly more efficient by specialising the SigningKey from_seed method by skipping the couple of extra steps performed to also compute a VerifyingKey, but ml-dsa:SigningKey::from_seed(&B32)
implementation #1046 shows this only nets a 20us / 10% speed up.from_seed
implementations don't deviate from each other in future, if more efficient implementations are provided.I am not sure why
key_gen_internal
was commented to be behind a feature flag or private, as I believe deriving from a seed value is a must-have, assuming this implementation correctly matches the spec. I can look through the spec and codebase for test vectors to make sure, if desired?Cheers!