Skip to content

Commit

Permalink
feature: new compatibility-focused security policy preferring ECDSA (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
lrstewart authored Jun 10, 2024
1 parent 946483a commit ff03b94
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 0 deletions.
57 changes: 57 additions & 0 deletions tls/s2n_cipher_preferences.c
Original file line number Diff line number Diff line change
Expand Up @@ -2014,6 +2014,63 @@ const struct s2n_cipher_preferences cipher_preferences_20210816_gcm = {
.allow_chacha20_boosting = false,
};

/* Cipher suite options for backwards compatibility with older clients,
* while prioritizing forward secret key exchange and ECDSA certificates.
*/
struct s2n_cipher_suite *cipher_suites_20240603[] = {
/* TLS1.3 suites */
&s2n_tls13_aes_128_gcm_sha256,
&s2n_tls13_aes_256_gcm_sha384,
&s2n_tls13_chacha20_poly1305_sha256,

/* Preferred ECDHE + ECDSA suites */
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_ecdsa_with_chacha20_poly1305_sha256,

/* Preferred ECDHE + RSA suites */
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_chacha20_poly1305_sha256,

/* Legacy ECDHE suites */
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,

/* DHE suites */
&s2n_dhe_rsa_with_aes_128_gcm_sha256,
&s2n_dhe_rsa_with_aes_128_cbc_sha256,
&s2n_dhe_rsa_with_aes_256_gcm_sha384,
&s2n_dhe_rsa_with_aes_256_cbc_sha256,
&s2n_dhe_rsa_with_aes_128_cbc_sha,
&s2n_dhe_rsa_with_aes_256_cbc_sha,

/* 3DES suites */
&s2n_ecdhe_rsa_with_3des_ede_cbc_sha,
&s2n_dhe_rsa_with_3des_ede_cbc_sha,

/* RSA kex suites */
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_256_cbc_sha256,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_3des_ede_cbc_sha,
};

const struct s2n_cipher_preferences cipher_preferences_20240603 = {
.count = s2n_array_len(cipher_suites_20240603),
.suites = cipher_suites_20240603,
.allow_chacha20_boosting = true,
};

struct s2n_cipher_suite *cipher_suites_rfc9151[] = {
/* TLS1.2 */
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
Expand Down
1 change: 1 addition & 0 deletions tls/s2n_cipher_preferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ extern const struct s2n_cipher_preferences cipher_preferences_20210825_gcm;
extern const struct s2n_cipher_preferences cipher_preferences_20210831;
extern const struct s2n_cipher_preferences cipher_preferences_20231213;
extern const struct s2n_cipher_preferences cipher_preferences_20231214;
extern const struct s2n_cipher_preferences cipher_preferences_20240603;

extern const struct s2n_cipher_preferences cipher_preferences_default_fips;

Expand Down
15 changes: 15 additions & 0 deletions tls/s2n_ecc_preferences.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ const struct s2n_ecc_named_curve *const s2n_ecc_pref_list_20201021[] = {
&s2n_ecc_curve_secp521r1,
};

/* Prefer x25519 over p256 for performance */
const struct s2n_ecc_named_curve *const s2n_ecc_pref_list_20240603[] = {
#if EVP_APIS_SUPPORTED
&s2n_ecc_curve_x25519,
#endif
&s2n_ecc_curve_secp256r1,
&s2n_ecc_curve_secp384r1,
&s2n_ecc_curve_secp521r1,
};

const struct s2n_ecc_named_curve *const s2n_ecc_pref_list_20210816[] = {
&s2n_ecc_curve_secp384r1,
};
Expand Down Expand Up @@ -118,6 +128,11 @@ const struct s2n_ecc_preferences s2n_ecc_preferences_20210816 = {
.ecc_curves = s2n_ecc_pref_list_20210816,
};

const struct s2n_ecc_preferences s2n_ecc_preferences_20240603 = {
.count = s2n_array_len(s2n_ecc_pref_list_20240603),
.ecc_curves = s2n_ecc_pref_list_20240603,
};

const struct s2n_ecc_preferences s2n_ecc_preferences_test_all = {
.count = s2n_array_len(s2n_ecc_pref_list_test_all),
.ecc_curves = s2n_ecc_pref_list_test_all,
Expand Down
1 change: 1 addition & 0 deletions tls/s2n_ecc_preferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ extern const struct s2n_ecc_preferences s2n_ecc_preferences_20230623;
extern const struct s2n_ecc_preferences s2n_ecc_preferences_default_fips;
extern const struct s2n_ecc_preferences s2n_ecc_preferences_20201021;
extern const struct s2n_ecc_preferences s2n_ecc_preferences_20210816;
extern const struct s2n_ecc_preferences s2n_ecc_preferences_20240603;
extern const struct s2n_ecc_preferences s2n_ecc_preferences_test_all;
extern const struct s2n_ecc_preferences s2n_ecc_preferences_null;

Expand Down
10 changes: 10 additions & 0 deletions tls/s2n_security_policies.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ const struct s2n_security_policy security_policy_20240503 = {
},
};

const struct s2n_security_policy security_policy_20240603 = {
.minimum_protocol_version = S2N_TLS12,
.cipher_preferences = &cipher_preferences_20240603,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20240501,
.certificate_signature_preferences = &s2n_certificate_signature_preferences_20201110,
.ecc_preferences = &s2n_ecc_preferences_20240603,
};

const struct s2n_security_policy security_policy_20170210 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_20170210,
Expand Down Expand Up @@ -1228,6 +1237,7 @@ struct s2n_security_policy_selection security_policy_selection[] = {
{ .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 },
{ .version = "20240603", .security_policy = &security_policy_20240603, .ecc_extension_required = 0, .pq_kem_extension_required = 0 },
{ .version = "rfc9151", .security_policy = &security_policy_rfc9151, .ecc_extension_required = 0, .pq_kem_extension_required = 0 },
{ .version = "test_all", .security_policy = &security_policy_test_all, .ecc_extension_required = 0, .pq_kem_extension_required = 0 },
{ .version = "test_all_fips", .security_policy = &security_policy_test_all_fips, .ecc_extension_required = 0, .pq_kem_extension_required = 0 },
Expand Down
2 changes: 2 additions & 0 deletions tls/s2n_security_policies.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ extern const struct s2n_security_policy security_policy_20230317;
extern const struct s2n_security_policy security_policy_20240331;
extern const struct s2n_security_policy security_policy_20240417;
extern const struct s2n_security_policy security_policy_20240416;
extern const struct s2n_security_policy security_policy_20240603;

extern const struct s2n_security_policy security_policy_rfc9151;
extern const struct s2n_security_policy security_policy_test_all;

Expand Down

0 comments on commit ff03b94

Please sign in to comment.