@@ -1580,26 +1580,27 @@ static nsresult nsSSLIOLayerSetOptions(PRFileDesc* fd, bool forSTARTTLS,
15801580 // nsNSSCallbacks.cpp when changing the lists here.
15811581 unsigned int additional_shares =
15821582 StaticPrefs::security_tls_client_hello_send_p256_keyshare ();
1583- if (StaticPrefs::security_tls_enable_kyber () &&
1584- range.max >= SSL_LIBRARY_VERSION_TLS_1_3 ) {
1585- const SSLNamedGroup namedGroups[] = {
1586- ssl_grp_kem_mlkem768x25519, ssl_grp_ec_curve25519, ssl_grp_ec_secp256r1,
1587- ssl_grp_ec_secp384r1, ssl_grp_ec_secp521r1, ssl_grp_ffdhe_2048,
1588- ssl_grp_ffdhe_3072};
1589- if (SECSuccess !=
1590- SSL_NamedGroupConfig (fd, namedGroups, std::size (namedGroups))) {
1591- return NS_ERROR_FAILURE ;
1592- }
1583+ bool tls13 = range.max >= SSL_LIBRARY_VERSION_TLS_1_3 ;
1584+
1585+ AutoTArray<SSLNamedGroup, 8 > namedGroups;
1586+ if (StaticPrefs::security_tls_enable_kyber () && tls13) {
1587+ namedGroups.AppendElement (ssl_grp_kem_mlkem768x25519);
15931588 additional_shares += 1 ;
1594- } else {
1595- const SSLNamedGroup namedGroups[] = {
1596- ssl_grp_ec_curve25519, ssl_grp_ec_secp256r1, ssl_grp_ec_secp384r1,
1597- ssl_grp_ec_secp521r1, ssl_grp_ffdhe_2048, ssl_grp_ffdhe_3072};
1598- // Skip the |ssl_grp_kem_mlkem768x25519| entry.
1599- if (SECSuccess !=
1600- SSL_NamedGroupConfig (fd, namedGroups, std::size (namedGroups))) {
1601- return NS_ERROR_FAILURE ;
1602- }
1589+ }
1590+ namedGroups.AppendElement (ssl_grp_ec_curve25519);
1591+ namedGroups.AppendElement (ssl_grp_ec_secp256r1);
1592+ namedGroups.AppendElement (ssl_grp_ec_secp384r1);
1593+ namedGroups.AppendElement (ssl_grp_ec_secp521r1);
1594+ namedGroups.AppendElement (ssl_grp_ffdhe_2048);
1595+ namedGroups.AppendElement (ssl_grp_ffdhe_3072);
1596+
1597+ if (StaticPrefs::security_tls_enable_mlkem1024 () && tls13) {
1598+ namedGroups.AppendElement (ssl_grp_kem_mlkem1024);
1599+ }
1600+
1601+ if (SECSuccess !=
1602+ SSL_NamedGroupConfig (fd, namedGroups.Elements (), namedGroups.Length ())) {
1603+ return NS_ERROR_FAILURE ;
16031604 }
16041605
16051606 // If additional_shares == 2, send mlkem768x25519, x25519, and p256.
@@ -1610,7 +1611,7 @@ static nsresult nsSSLIOLayerSetOptions(PRFileDesc* fd, bool forSTARTTLS,
16101611 }
16111612
16121613 // Enabling Certificate Compression Decoding mechanisms.
1613- if (range. max >= SSL_LIBRARY_VERSION_TLS_1_3 &&
1614+ if (tls13 &&
16141615 !(infoObject->GetProviderFlags () &
16151616 (nsISocketProvider::BE_CONSERVATIVE | nsISocketProvider::IS_RETRY ))) {
16161617 SSLCertificateCompressionAlgorithm zlibAlg = {1 , " zlib" , nullptr ,
0 commit comments