FIX: Kyber KEM with a KDF + some nitpicks#2982
Merged
Conversation
36ea33c to
da1d605
Compare
Previously, ::algo_name() contained the algorithm parameters (e.g. -90s-512) as well. This was impractical and did not align with other algorithms in the library. Instead, Kyber_...::mode() now gives acces to the specific algorithm parameters used.
Previously, the KEM operations would simply assume "Raw" and ignore KDF as well as provider parameters.
This would have resulted in an exception before. Similar behaviour was already implemented for the key agreement public key operation.
When either kyber or kyber_90s was disabled at build time we caused a test failure.
da1d605 to
0b2242a
Compare
reneme
added a commit
that referenced
this pull request
May 31, 2022
2 tasks
randombit
approved these changes
Jun 1, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Turns out that the implementation of Kyber needed a bit more polishing:
KEM_XXcryption_with_KDFHence, the interface would simply ignore the KDF and provider preferences of the user and always return the "Raw" shared secret.
Kyber...::algo_name()incorporated the algorithm parametersI.e. the algo name would be reported as "Kyber-1024-90s-r3". This is not in line with the rest of the library's algorithms. Now,
algo_name()will always report "Kyber-r3" and the key classes provide an additional::mode()accessor to investigate the algorithm parameters. To integrate with Kyber's preliminary OIDs, theKyberModeenum is now a small class that can perform the translation from and to OIDs.In contrast to
PK_Ops::Key_Agreement_with_KDFthe respective KEM operations did not allow for a "Raw" KDF. This is needed though, e.g. to implement TLS 1.3 hybrid key exchange.