Add Post-Quantum key exchange support (ML-KEM / FIPS 203)#634
Open
nercone-dev wants to merge 2 commits into
Open
Add Post-Quantum key exchange support (ML-KEM / FIPS 203)#634nercone-dev wants to merge 2 commits into
nercone-dev wants to merge 2 commits into
Conversation
030ef81 to
150ac34
Compare
…KEM768/SECP384R1MLKEM1024, X25519MLKEM768)
150ac34 to
664cebb
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
Adds TLS 1.3 key exchange support for ML-KEM (NIST FIPS 203) — both pure and
hybrid groups — and fixes the server-side group selection logic that this
feature exposed.
New groups
MLKEM768MLKEM1024X25519MLKEM768SECP256R1MLKEM768SECP384R1MLKEM1024Groups are advertised only when
default_backend().mlkem_supported()returnstrue (requires OpenSSL 3.5+ and
cryptography >= 48.0.0).Hybrid key shares concatenate the classical public key followed by the ML-KEM
encapsulation key, per draft-tls-mlkem-iana. The shared secret is
mlkem_ss || classical_ss.Server-side group selection fix
Previously the server iterated over the client's
key_sharelist in the orderthe client sent it. With multiple PQC and classical groups now possible, this
meant the server's own configured group preference (
_supported_groups) waseffectively ignored.
The server now builds a lookup dict from the client's key shares and iterates
self._supported_groupsinstead, selecting the first mutually supported groupin server-priority order — consistent with how OpenSSL respects
SSL_CTX_set1_groups.Other changes
ClientHelloserialization buffer increased from 1 KiB to 16 KiB (ML-KEM 768encapsulation key alone is 1184 bytes).
ClientHellosize assertion relaxed.cryptographyminimum raised from>=42.0.0to>=48.0.0.Tests
lacks ML-KEM support.