From 93286109fc3048dda0d162b22f25455d359a69fd Mon Sep 17 00:00:00 2001 From: Carol Yeh <69044490+CarolYeh910@users.noreply.github.com> Date: Mon, 17 Aug 2026 23:19:27 +0000 Subject: [PATCH 1/2] add backwards compatible PQ policies --- tests/policy_snapshot/snapshots/20200207_pq | 36 +++++++++++++ tests/policy_snapshot/snapshots/20230317_pq | 51 +++++++++++++++++++ .../snapshots/CloudFront-TLS-1-2-2021-PQ | 41 +++++++++++++++ tests/unit/s2n_pq_mlkem_policies_test.c | 1 + tls/s2n_security_policies.c | 38 ++++++++++++++ 5 files changed, 167 insertions(+) create mode 100644 tests/policy_snapshot/snapshots/20200207_pq create mode 100644 tests/policy_snapshot/snapshots/20230317_pq create mode 100644 tests/policy_snapshot/snapshots/CloudFront-TLS-1-2-2021-PQ diff --git a/tests/policy_snapshot/snapshots/20200207_pq b/tests/policy_snapshot/snapshots/20200207_pq new file mode 100644 index 00000000000..1e7d2ea55b5 --- /dev/null +++ b/tests/policy_snapshot/snapshots/20200207_pq @@ -0,0 +1,36 @@ +min version: SSLv3 +rules: +- Perfect Forward Secrecy: yes +- FIPS 140-3 (2019): no +cipher suites: +- TLS_AES_128_GCM_SHA256 +- TLS_AES_256_GCM_SHA384 +- TLS_CHACHA20_POLY1305_SHA256 +signature schemes: +- rsa_pss_pss_sha256 +- rsa_pss_pss_sha384 +- rsa_pss_pss_sha512 +- rsa_pss_rsae_sha256 +- rsa_pss_rsae_sha384 +- rsa_pss_rsae_sha512 +- rsa_pkcs1_sha256 +- rsa_pkcs1_sha384 +- rsa_pkcs1_sha512 +- legacy_rsa_sha224 +- ecdsa_sha256 +- ecdsa_sha384 +- ecdsa_sha512 +- legacy_ecdsa_sha224 +- rsa_pkcs1_sha1 +- ecdsa_sha1 +curves: +- x25519 +- secp256r1 +- secp384r1 +- secp521r1 +pq: +- revision: 5 +- kem groups: +-- X25519MLKEM768 +-- SecP256r1MLKEM768 +-- SecP384r1MLKEM1024 diff --git a/tests/policy_snapshot/snapshots/20230317_pq b/tests/policy_snapshot/snapshots/20230317_pq new file mode 100644 index 00000000000..67cf2fbb825 --- /dev/null +++ b/tests/policy_snapshot/snapshots/20230317_pq @@ -0,0 +1,51 @@ +min version: TLS1.2 +rules: +- Perfect Forward Secrecy: yes +- FIPS 140-3 (2019): yes +cipher suites: +- TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 +- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 +- TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 +- TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 +- TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 +- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 +- TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 +- TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 +- TLS_AES_128_GCM_SHA256 +- TLS_AES_256_GCM_SHA384 +signature schemes: +- rsa_pss_rsae_sha256 +- rsa_pss_rsae_sha384 +- rsa_pss_rsae_sha512 +- rsa_pkcs1_sha256 +- rsa_pkcs1_sha384 +- rsa_pkcs1_sha512 +- ecdsa_sha256 +- ecdsa_sha384 +- ecdsa_sha512 +- rsa_pss_pss_sha256 +- rsa_pss_pss_sha384 +- rsa_pss_pss_sha512 +curves: +- secp256r1 +- secp384r1 +- secp521r1 +certificate signature schemes: +- rsa_pss_rsae_sha256 +- rsa_pss_rsae_sha384 +- rsa_pss_rsae_sha512 +- rsa_pkcs1_sha256 +- rsa_pkcs1_sha384 +- rsa_pkcs1_sha512 +- ecdsa_sha256 +- ecdsa_sha384 +- ecdsa_sha512 +- rsa_pss_pss_sha256 +- rsa_pss_pss_sha384 +- rsa_pss_pss_sha512 +pq: +- revision: 5 +- kem groups: +-- X25519MLKEM768 +-- SecP256r1MLKEM768 +-- SecP384r1MLKEM1024 diff --git a/tests/policy_snapshot/snapshots/CloudFront-TLS-1-2-2021-PQ b/tests/policy_snapshot/snapshots/CloudFront-TLS-1-2-2021-PQ new file mode 100644 index 00000000000..2711e83c036 --- /dev/null +++ b/tests/policy_snapshot/snapshots/CloudFront-TLS-1-2-2021-PQ @@ -0,0 +1,41 @@ +min version: TLS1.2 +rules: +- Perfect Forward Secrecy: yes +- FIPS 140-3 (2019): no +cipher suites: +- TLS_AES_128_GCM_SHA256 +- TLS_AES_256_GCM_SHA384 +- TLS_CHACHA20_POLY1305_SHA256 +- TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 +- TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 +- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 +- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 +- TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 +- TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 +signature schemes: +- rsa_pss_pss_sha256 +- rsa_pss_pss_sha384 +- rsa_pss_pss_sha512 +- rsa_pss_rsae_sha256 +- rsa_pss_rsae_sha384 +- rsa_pss_rsae_sha512 +- rsa_pkcs1_sha256 +- rsa_pkcs1_sha384 +- rsa_pkcs1_sha512 +- legacy_rsa_sha224 +- ecdsa_sha256 +- ecdsa_sha384 +- ecdsa_sha512 +- legacy_ecdsa_sha224 +- rsa_pkcs1_sha1 +- ecdsa_sha1 +curves: +- x25519 +- secp256r1 +- secp384r1 +pq: +- revision: 5 +- kem groups: +-- X25519MLKEM768 +-- SecP256r1MLKEM768 +-- SecP384r1MLKEM1024 diff --git a/tests/unit/s2n_pq_mlkem_policies_test.c b/tests/unit/s2n_pq_mlkem_policies_test.c index 9a239091cc9..55ee267ddab 100644 --- a/tests/unit/s2n_pq_mlkem_policies_test.c +++ b/tests/unit/s2n_pq_mlkem_policies_test.c @@ -137,6 +137,7 @@ const char *tls_version_exceptions[] = { "test_all", "20260520", "20260520_gcm", + "20200207_pq", }; const size_t mlkem_list_size = s2n_array_len(mlkem_list); diff --git a/tls/s2n_security_policies.c b/tls/s2n_security_policies.c index 16704700e2e..9c043e42c53 100644 --- a/tls/s2n_security_policies.c +++ b/tls/s2n_security_policies.c @@ -1482,6 +1482,41 @@ const struct s2n_security_policy security_policy_20260523_gcm = { .ecc_preferences = &s2n_ecc_preferences_20201021, }; +const struct s2n_security_policy security_policy_cloudfront_tls_1_2_2021_pq = { + .minimum_protocol_version = S2N_TLS12, + .cipher_preferences = &cipher_preferences_cloudfront_tls_1_2_2021, + .kem_preferences = &kem_preferences_pq_tls_1_3_ietf_2025_07, + .signature_preferences = &s2n_signature_preferences_20200207, + .ecc_preferences = &s2n_ecc_preferences_20200310, + .rules = { + [S2N_PERFECT_FORWARD_SECRECY] = true, + }, +}; + +const struct s2n_security_policy security_policy_20200207_pq = { + .minimum_protocol_version = S2N_SSLv3, + .cipher_preferences = &cipher_preferences_test_all_tls13, + .kem_preferences = &kem_preferences_pq_tls_1_3_ietf_2025_07, + .signature_preferences = &s2n_signature_preferences_20201021, + .ecc_preferences = &s2n_ecc_preferences_test_all, + .rules = { + [S2N_PERFECT_FORWARD_SECRECY] = true, + }, +}; + +const struct s2n_security_policy security_policy_20230317_pq = { + .minimum_protocol_version = S2N_TLS12, + .cipher_preferences = &cipher_preferences_20230317, + .kem_preferences = &kem_preferences_pq_tls_1_3_ietf_2025_07, + .signature_preferences = &s2n_signature_preferences_20230317, + .certificate_signature_preferences = &s2n_signature_preferences_20230317, + .ecc_preferences = &s2n_ecc_preferences_20201021, + .rules = { + [S2N_PERFECT_FORWARD_SECRECY] = true, + [S2N_FIPS_140_3] = true, + }, +}; + const struct s2n_security_policy security_policy_test_all = { .minimum_protocol_version = S2N_SSLv3, .cipher_preferences = &cipher_preferences_test_all, @@ -1591,6 +1626,7 @@ struct s2n_security_policy_selection security_policy_selection[] = { { .version = "20240502", .security_policy = &security_policy_20240502, .ecc_extension_required = 0, .pq_kem_extension_required = 0 }, { .version = "20240503", .security_policy = &security_policy_20240503, .ecc_extension_required = 0, .pq_kem_extension_required = 0 }, { .version = "20230317", .security_policy = &security_policy_20230317, .ecc_extension_required = 0, .pq_kem_extension_required = 0 }, + { .version = "20230317_pq", .security_policy = &security_policy_20230317_pq, .ecc_extension_required = 0, .pq_kem_extension_required = 0 }, { .version = "20240331", .security_policy = &security_policy_20240331, .ecc_extension_required = 0, .pq_kem_extension_required = 0 }, { .version = "20240417", .security_policy = &security_policy_20240417, .ecc_extension_required = 0, .pq_kem_extension_required = 0 }, { .version = "20240416", .security_policy = &security_policy_20240416, .ecc_extension_required = 0, .pq_kem_extension_required = 0 }, @@ -1667,6 +1703,7 @@ struct s2n_security_policy_selection security_policy_selection[] = { { .version = "CloudFront-TLS-1-2-2018", .security_policy = &security_policy_cloudfront_tls_1_2_2018, .ecc_extension_required = 0, .pq_kem_extension_required = 0 }, { .version = "CloudFront-TLS-1-2-2019", .security_policy = &security_policy_cloudfront_tls_1_2_2019, .ecc_extension_required = 0, .pq_kem_extension_required = 0 }, { .version = "CloudFront-TLS-1-2-2021", .security_policy = &security_policy_cloudfront_tls_1_2_2021, .ecc_extension_required = 0, .pq_kem_extension_required = 0 }, + { .version = "CloudFront-TLS-1-2-2021-PQ", .security_policy = &security_policy_cloudfront_tls_1_2_2021_pq, .ecc_extension_required = 0, .pq_kem_extension_required = 0 }, /* CRT allows users to choose the minimal TLS protocol they want to negotiate with. This translates to 5 different security policies in s2n */ { .version = "AWS-CRT-SDK-SSLv3.0", .security_policy = &security_policy_aws_crt_sdk_ssl_v3, .ecc_extension_required = 0, .pq_kem_extension_required = 0 }, { .version = "AWS-CRT-SDK-TLSv1.0", .security_policy = &security_policy_aws_crt_sdk_tls_10, .ecc_extension_required = 0, .pq_kem_extension_required = 0 }, @@ -1719,6 +1756,7 @@ struct s2n_security_policy_selection security_policy_selection[] = { { .version = "20190801", .security_policy = &security_policy_20190801, .ecc_extension_required = 0, .pq_kem_extension_required = 0 }, { .version = "20190802", .security_policy = &security_policy_20190802, .ecc_extension_required = 0, .pq_kem_extension_required = 0 }, { .version = "20200207", .security_policy = &security_policy_20200207, .ecc_extension_required = 0, .pq_kem_extension_required = 0 }, + { .version = "20200207_pq", .security_policy = &security_policy_20200207_pq, .ecc_extension_required = 0, .pq_kem_extension_required = 0 }, { .version = "20201021", .security_policy = &security_policy_20201021, .ecc_extension_required = 0, .pq_kem_extension_required = 0 }, { .version = "20210816", .security_policy = &security_policy_20210816, .ecc_extension_required = 0, .pq_kem_extension_required = 0 }, { .version = "20210816_GCM", .security_policy = &security_policy_20210816_gcm, .ecc_extension_required = 0, .pq_kem_extension_required = 0 }, From 54ce9d0c5ce0aa003d9e58d574d1d024b462658b Mon Sep 17 00:00:00 2001 From: Carol Yeh <69044490+CarolYeh910@users.noreply.github.com> Date: Mon, 17 Aug 2026 23:36:12 +0000 Subject: [PATCH 2/2] reorder structs --- tls/s2n_security_policies.c | 70 ++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/tls/s2n_security_policies.c b/tls/s2n_security_policies.c index 9c043e42c53..eb75c52d314 100644 --- a/tls/s2n_security_policies.c +++ b/tls/s2n_security_policies.c @@ -192,6 +192,19 @@ const struct s2n_security_policy security_policy_20230317 = { }, }; +const struct s2n_security_policy security_policy_20230317_pq = { + .minimum_protocol_version = S2N_TLS12, + .cipher_preferences = &cipher_preferences_20230317, + .kem_preferences = &kem_preferences_pq_tls_1_3_ietf_2025_07, + .signature_preferences = &s2n_signature_preferences_20230317, + .certificate_signature_preferences = &s2n_signature_preferences_20230317, + .ecc_preferences = &s2n_ecc_preferences_20201021, + .rules = { + [S2N_PERFECT_FORWARD_SECRECY] = true, + [S2N_FIPS_140_3] = true, + }, +}; + const struct s2n_security_policy security_policy_20240331 = { .minimum_protocol_version = S2N_TLS12, .cipher_preferences = &cipher_preferences_20240331, @@ -734,6 +747,17 @@ const struct s2n_security_policy security_policy_cloudfront_tls_1_2_2021 = { }, }; +const struct s2n_security_policy security_policy_cloudfront_tls_1_2_2021_pq = { + .minimum_protocol_version = S2N_TLS12, + .cipher_preferences = &cipher_preferences_cloudfront_tls_1_2_2021, + .kem_preferences = &kem_preferences_pq_tls_1_3_ietf_2025_07, + .signature_preferences = &s2n_signature_preferences_20200207, + .ecc_preferences = &s2n_ecc_preferences_20200310, + .rules = { + [S2N_PERFECT_FORWARD_SECRECY] = true, + }, +}; + const struct s2n_security_policy security_policy_cloudfront_ssl_v_3_legacy = { .minimum_protocol_version = S2N_SSLv3, .cipher_preferences = &cipher_preferences_cloudfront_ssl_v_3_legacy, @@ -1482,41 +1506,6 @@ const struct s2n_security_policy security_policy_20260523_gcm = { .ecc_preferences = &s2n_ecc_preferences_20201021, }; -const struct s2n_security_policy security_policy_cloudfront_tls_1_2_2021_pq = { - .minimum_protocol_version = S2N_TLS12, - .cipher_preferences = &cipher_preferences_cloudfront_tls_1_2_2021, - .kem_preferences = &kem_preferences_pq_tls_1_3_ietf_2025_07, - .signature_preferences = &s2n_signature_preferences_20200207, - .ecc_preferences = &s2n_ecc_preferences_20200310, - .rules = { - [S2N_PERFECT_FORWARD_SECRECY] = true, - }, -}; - -const struct s2n_security_policy security_policy_20200207_pq = { - .minimum_protocol_version = S2N_SSLv3, - .cipher_preferences = &cipher_preferences_test_all_tls13, - .kem_preferences = &kem_preferences_pq_tls_1_3_ietf_2025_07, - .signature_preferences = &s2n_signature_preferences_20201021, - .ecc_preferences = &s2n_ecc_preferences_test_all, - .rules = { - [S2N_PERFECT_FORWARD_SECRECY] = true, - }, -}; - -const struct s2n_security_policy security_policy_20230317_pq = { - .minimum_protocol_version = S2N_TLS12, - .cipher_preferences = &cipher_preferences_20230317, - .kem_preferences = &kem_preferences_pq_tls_1_3_ietf_2025_07, - .signature_preferences = &s2n_signature_preferences_20230317, - .certificate_signature_preferences = &s2n_signature_preferences_20230317, - .ecc_preferences = &s2n_ecc_preferences_20201021, - .rules = { - [S2N_PERFECT_FORWARD_SECRECY] = true, - [S2N_FIPS_140_3] = true, - }, -}; - const struct s2n_security_policy security_policy_test_all = { .minimum_protocol_version = S2N_SSLv3, .cipher_preferences = &cipher_preferences_test_all, @@ -1597,6 +1586,17 @@ const struct s2n_security_policy security_policy_20200207 = { }, }; +const struct s2n_security_policy security_policy_20200207_pq = { + .minimum_protocol_version = S2N_SSLv3, + .cipher_preferences = &cipher_preferences_test_all_tls13, + .kem_preferences = &kem_preferences_pq_tls_1_3_ietf_2025_07, + .signature_preferences = &s2n_signature_preferences_20201021, + .ecc_preferences = &s2n_ecc_preferences_test_all, + .rules = { + [S2N_PERFECT_FORWARD_SECRECY] = true, + }, +}; + const struct s2n_security_policy security_policy_test_ecdsa_priority = { .minimum_protocol_version = S2N_SSLv3, .cipher_preferences = &cipher_preferences_test_ecdsa_priority,