Change logic of choosing early key shares #2052
Open
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.
In the current implementation, if either the
x25519
orsecp256r1
algorithms are present in the list of named groups, one of them is used for early key shares—regardless of the presence of other algorithms. However, with the growing adoption of post-quantum cryptography, it is increasingly important to include post-quantum secure algorithms (i.e., KEM-based algorithms) in the early key shares.Section 4.2.8 in the RFC 8446 mentions the following:
This means it is valid for clients to include multiple
KeyShareEntry
values corresponding to different named groups.Updated Logic
The updated implementation modifies the selection logic for early key shares as follows:
If no KEM-type algorithms are present in the list of named groups:
x25519
orsecp256r1
is present, it is selected (in that order of preference).If one or more KEM-type algorithms are present:
This change ensures early key share negotiation includes support for post-quantum algorithms while maintaining backward compatibility with existing logic.