fix randomized X25519MLKEM768 key share consistency - #415
Open
T1nyBear wants to merge 1 commit into
Open
Conversation
T1nyBear
force-pushed
the
fix-randomized-mlkem-keyshare
branch
from
September 4, 2026 03:43
6efc1a5 to
f2a1e52
Compare
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.
Summary
generateRandomizedSpeccurrently decides independently whether to includeX25519MLKEM768insupported_groupsand whether to include its initial key share.This can produce two problematic combinations:
X25519MLKEM768is advertised without an initial key share. This is valid TLS 1.3, but allows a server to select the group through HelloRetryRequest, while the current uTLS HRR handler explicitly does not support selectingX25519MLKEM768through HRR.X25519MLKEM768is included inkey_sharewithout being present insupported_groups. TLS 1.3 explicitly forbids this: everyKeyShareEntrymust correspond to a group offered insupported_groups(RFC 9846 §4.3.8).The existing HRR handler already assumes that if
X25519MLKEM768is enabled, its initial key share is always sent.Change
Use a single randomized decision for both
supported_groupsand the initialkey_share.When
randomizedadvertisesX25519MLKEM768, it also includes its initial key share. Otherwise, neither is included.The previous key-share random draw is still consumed to preserve the PRNG sequence for existing randomized seeds.
This preserves the randomized choice of whether to offer
X25519MLKEM768, while:supported_groups/key_sharecombinations;X25519MLKEM768HRR path.Future HRR support
If
X25519MLKEM768HRR support is implemented in the future, the decision to include its initial key share can be randomized again, but only when the group itself is advertised.The result of the existing random draw can then be used instead of discarded, while the draw remains in the same key-share randomization branch.
For example:
Related