From 4a3984894dc564d4b673b4a840d22b3781d9bb88 Mon Sep 17 00:00:00 2001 From: Chris Staite Date: Thu, 3 Dec 2026 09:21:17 +0000 Subject: [PATCH] BUG/MEDIUM: ssl: allow the ML-KEM groups in the FIPS curve check Since commit 96c7759f3 ("MEDIUM: ssl: add FIPS elliptic curve check for AWS-LC"), ssl_fips_check_curves() only accepts P-256, P-384 and P-521 when the library runs in FIPS mode, and refuses to start on anything else. This also rejects the ML-KEM based key exchange groups, which makes it impossible to enable post-quantum key exchange in FIPS mode: ssl-default-server-curves SecP256r1MLKEM768:X25519MLKEM768:P-256:P-384 [ALERT] 'server /' : FIPS mode active but non-FIPS curve(s) configured: 'SecP256r1MLKEM768', 'X25519MLKEM768'. This was observed with AWS-LC FIPS 4.2.0. The same applies to "curves" on bind and server lines and to ssl-default-bind-curves. These groups are in fact fine in FIPS mode. ML-KEM is standardized in FIPS 203, and NIST SP 800-56C Rev. 2 allows a shared secret made of several components to be used in key derivation as long as one of them is generated by an approved scheme, which is the case of ML-KEM. This makes X25519MLKEM768 acceptable despite X25519 alone not being approved. For SecP256r1MLKEM768 and SecP384r1MLKEM1024 both components are approved anyway. AWS-LC itself does not restrict these groups when built in FIPS mode: they are part of its default group list and its service indicator reports ML-KEM as approved. The impact is significant since X25519MLKEM768 is the only post-quantum hybrid group implemented by Chromium and the only one enabled by default in Firefox (which only uses SecP256r1MLKEM768 after a configuration change), so browsers cannot get a post-quantum key exchange from a FIPS HAProxy without it. Let's add NID_X25519MLKEM768, NID_SecP256r1MLKEM768, NID_SecP384r1MLKEM1024 and NID_MLKEM512/768/1024 to the list of approved NIDs, each one being guarded by #ifdef since they depend on the AWS-LC version. Everything else (X25519 alone, X448, brainpool, P-224, the pre-standard Kyber drafts) is still rejected. This must be backported to 3.5. --- src/fips.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/fips.c b/src/fips.c index 04e14cfc3..9ffd5c395 100644 --- a/src/fips.c +++ b/src/fips.c @@ -22,11 +22,29 @@ static const int fips_approved_cipher_nids[] = { NID_undef }; -/* FIPS-approved elliptic curve NIDs (NIST P-curves). NID_undef terminates the list. */ +/* FIPS-approved group NIDs (NIST P-curves, ML-KEM and hybrids). NID_undef terminates the list. */ static const int fips_approved_curve_nids[] = { NID_X9_62_prime256v1, /* P-256 */ NID_secp384r1, /* P-384 */ NID_secp521r1, /* P-521 */ +#ifdef NID_MLKEM512 + NID_MLKEM512, +#endif +#ifdef NID_MLKEM768 + NID_MLKEM768, +#endif +#ifdef NID_MLKEM1024 + NID_MLKEM1024, +#endif +#ifdef NID_X25519MLKEM768 + NID_X25519MLKEM768, +#endif +#ifdef NID_SecP256r1MLKEM768 + NID_SecP256r1MLKEM768, +#endif +#ifdef NID_SecP384r1MLKEM1024 + NID_SecP384r1MLKEM1024, +#endif NID_undef }; -- 2.47.3