Skip to content

Commit 38d769c

Browse files
authored
New TLS1.2-only variant of 20230317 policy (#4483)
1 parent 0381567 commit 38d769c

File tree

6 files changed

+87
-1
lines changed

6 files changed

+87
-1
lines changed

docs/usage-guide/topics/ch06-security-policies.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ The following chart maps the security policy version to protocol version and cip
1616
| version | TLS1.0 | TLS1.1 | TLS1.2 | TLS1.3 | AES-CBC | AES-GCM | CHACHAPOLY | 3DES | RC4 | DHE | ECDHE | RSA kx |
1717
|---------------|--------|--------|--------|--------|---------|---------|------------|------|-----|-----|-------|--------|
1818
| 20230317 | | | X | X | X | X | | | | | X | |
19+
| 20240331 | | | X | | X | X | | | | | X | |
1920
| default | X | X | X | | X | X | X | | | | X | X |
2021
| default_tls13 | X | X | X | X | X | X | X | | | | X | X |
2122
| default_fips | | | X | | X | X | | | | X | X | |
@@ -42,7 +43,7 @@ The following chart maps the security policy version to protocol version and cip
4243
The "default", "default_tls13", and "default_fips" versions are special in that they will be updated with future s2n-tls changes and ciphersuites and protocol versions may be added and removed, or their internal order of preference might change. Numbered versions are fixed and will never change.
4344
In general, customers prefer to use numbered versions for production use cases to prevent impact from library updates.
4445

45-
"20230317" is a FIPS compliant policy. It offers more limited but more secure options than "default". It only supports TLS1.2 and TLS1.3. Consider this policy if you plan to enable FIPS mode or don't need or want to support less secure legacy options like TLS1.1 or SHA1.
46+
"20230317" offers more limited but more secure options than the default policies. Consider it if you don't need or want to support less secure legacy options like TLS1.1 or SHA1. It is also FIPS compliant and supports TLS1.3. If you need a version of this policy that doesn't support TLS1.3, choose "20240331" instead.
4647

4748
"20160411" follows the same general preference order as "default". The main difference is it has a CBC cipher suite at the top. This is to accommodate certain Java clients that have poor GCM implementations. Users of s2n-tls who have found GCM to be hurting performance for their clients should consider this version.
4849

tests/unit/s2n_security_policies_test.c

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,7 @@ int main(int argc, char **argv)
460460
"20190121",
461461
"20190122",
462462
"20201021",
463+
"20240331",
463464
"test_all_ecdsa",
464465
"test_ecdsa_priority",
465466
"test_all_tls12",
@@ -478,6 +479,7 @@ int main(int argc, char **argv)
478479
"20190801",
479480
"20190802",
480481
"KMS-TLS-1-2-2023-06",
482+
"20230317",
481483
/* CloudFront viewer facing */
482484
"CloudFront-SSL-v-3",
483485
"CloudFront-TLS-1-0-2014",
@@ -973,6 +975,48 @@ int main(int argc, char **argv)
973975
EXPECT_OK(s2n_test_security_policies_compatible(&security_policy_20230317, "default_tls13", rsa_pss_chain_and_key));
974976
EXPECT_OK(s2n_test_security_policies_compatible(&security_policy_20230317, "20230317", rsa_pss_chain_and_key));
975977
}
978+
979+
if (s2n_is_tls13_fully_supported()) {
980+
EXPECT_OK(s2n_test_security_policies_compatible(&security_policy_20230317,
981+
"test_all_tls13", rsa_chain_and_key));
982+
EXPECT_OK(s2n_test_security_policies_compatible(&security_policy_20230317,
983+
"test_all_tls13", rsa_pss_chain_and_key));
984+
EXPECT_OK(s2n_test_security_policies_compatible(&security_policy_20230317,
985+
"test_all_tls13", ecdsa_chain_and_key));
986+
}
987+
};
988+
989+
/* 20240331 */
990+
{
991+
EXPECT_OK(s2n_test_security_policies_compatible(&security_policy_20240331,
992+
"default", rsa_chain_and_key));
993+
EXPECT_OK(s2n_test_security_policies_compatible(&security_policy_20240331,
994+
"default_tls13", rsa_chain_and_key));
995+
EXPECT_OK(s2n_test_security_policies_compatible(&security_policy_20240331,
996+
"default_fips", rsa_chain_and_key));
997+
EXPECT_OK(s2n_test_security_policies_compatible(&security_policy_20240331,
998+
"20230317", rsa_chain_and_key));
999+
EXPECT_OK(s2n_test_security_policies_compatible(&security_policy_20240331,
1000+
"20240331", rsa_chain_and_key));
1001+
1002+
EXPECT_OK(s2n_test_security_policies_compatible(&security_policy_20240331,
1003+
"default_tls13", ecdsa_chain_and_key));
1004+
EXPECT_OK(s2n_test_security_policies_compatible(&security_policy_20240331,
1005+
"default_fips", ecdsa_chain_and_key));
1006+
EXPECT_OK(s2n_test_security_policies_compatible(&security_policy_20240331,
1007+
"20230317", ecdsa_chain_and_key));
1008+
EXPECT_OK(s2n_test_security_policies_compatible(&security_policy_20240331,
1009+
"20240331", ecdsa_chain_and_key));
1010+
1011+
/* Can't negotiate TLS1.3 */
1012+
EXPECT_ERROR_WITH_ERRNO(
1013+
s2n_test_security_policies_compatible(&security_policy_20240331,
1014+
"test_all_tls13", rsa_chain_and_key),
1015+
S2N_ERR_CIPHER_NOT_SUPPORTED);
1016+
EXPECT_ERROR_WITH_ERRNO(
1017+
s2n_test_security_policies_compatible(&security_policy_20240331,
1018+
"test_all_tls13", ecdsa_chain_and_key),
1019+
S2N_ERR_CIPHER_NOT_SUPPORTED);
9761020
};
9771021
};
9781022

tls/s2n_cipher_preferences.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,31 @@ const struct s2n_cipher_preferences cipher_preferences_20230317 = {
302302
.allow_chacha20_boosting = false,
303303
};
304304

305+
/*
306+
* No TLS1.3 support.
307+
* FIPS compliant.
308+
* No DHE (would require extra setup with s2n_config_add_dhparams)
309+
*/
310+
struct s2n_cipher_suite *cipher_suites_20240331[] = {
311+
/* TLS1.2 with ECDSA */
312+
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
313+
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
314+
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
315+
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
316+
317+
/* TLS1.2 with RSA */
318+
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
319+
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
320+
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
321+
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
322+
};
323+
324+
const struct s2n_cipher_preferences cipher_preferences_20240331 = {
325+
.count = s2n_array_len(cipher_suites_20240331),
326+
.suites = cipher_suites_20240331,
327+
.allow_chacha20_boosting = false,
328+
};
329+
305330
/* Same as 20160411, but with ChaCha20 added as 1st in Preference List */
306331
struct s2n_cipher_suite *cipher_suites_20190122[] = {
307332
&s2n_ecdhe_rsa_with_chacha20_poly1305_sha256,

tls/s2n_cipher_preferences.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ struct s2n_cipher_preferences {
2828
};
2929

3030
extern const struct s2n_cipher_preferences cipher_preferences_20230317;
31+
extern const struct s2n_cipher_preferences cipher_preferences_20240331;
3132
extern const struct s2n_cipher_preferences cipher_preferences_20140601;
3233
extern const struct s2n_cipher_preferences cipher_preferences_20141001;
3334
extern const struct s2n_cipher_preferences cipher_preferences_20150202;

tls/s2n_security_policies.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,19 @@ const struct s2n_security_policy security_policy_20230317 = {
6969
},
7070
};
7171

72+
const struct s2n_security_policy security_policy_20240331 = {
73+
.minimum_protocol_version = S2N_TLS12,
74+
.cipher_preferences = &cipher_preferences_20240331,
75+
.kem_preferences = &kem_preferences_null,
76+
.signature_preferences = &s2n_signature_preferences_20230317,
77+
.certificate_signature_preferences = &s2n_signature_preferences_20230317,
78+
.ecc_preferences = &s2n_ecc_preferences_20201021,
79+
.rules = {
80+
[S2N_PERFECT_FORWARD_SECRECY] = true,
81+
[S2N_FIPS_140_3] = true,
82+
},
83+
};
84+
7285
const struct s2n_security_policy security_policy_20190801 = {
7386
.minimum_protocol_version = S2N_TLS10,
7487
.cipher_preferences = &cipher_preferences_20190801,
@@ -1062,6 +1075,7 @@ struct s2n_security_policy_selection security_policy_selection[] = {
10621075
{ .version = "default_tls13", .security_policy = &security_policy_default_tls13, .ecc_extension_required = 0, .pq_kem_extension_required = 0 },
10631076
{ .version = "default_fips", .security_policy = &security_policy_default_fips, .ecc_extension_required = 0, .pq_kem_extension_required = 0 },
10641077
{ .version = "20230317", .security_policy = &security_policy_20230317, .ecc_extension_required = 0, .pq_kem_extension_required = 0 },
1078+
{ .version = "20240331", .security_policy = &security_policy_20240331, .ecc_extension_required = 0, .pq_kem_extension_required = 0 },
10651079
{ .version = "ELBSecurityPolicy-TLS-1-0-2015-04", .security_policy = &security_policy_elb_2015_04, .ecc_extension_required = 0, .pq_kem_extension_required = 0 },
10661080
/* Not a mistake. TLS-1-0-2015-05 and 2016-08 are equivalent */
10671081
{ .version = "ELBSecurityPolicy-TLS-1-0-2015-05", .security_policy = &security_policy_elb_2016_08, .ecc_extension_required = 0, .pq_kem_extension_required = 0 },

tls/s2n_security_policies.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ extern const struct s2n_security_policy security_policy_20190214_gcm;
113113
extern const struct s2n_security_policy security_policy_20190801;
114114
extern const struct s2n_security_policy security_policy_20190802;
115115
extern const struct s2n_security_policy security_policy_20230317;
116+
extern const struct s2n_security_policy security_policy_20240331;
116117
extern const struct s2n_security_policy security_policy_default_tls13;
117118
extern const struct s2n_security_policy security_policy_default_fips;
118119
extern const struct s2n_security_policy security_policy_rfc9151;

0 commit comments

Comments
 (0)