blob: 825609e4315955ec302e0c964f622f0421de2a96 [file] [log] [blame] [view]
Gilles Peskine6b1f64a2021-06-07 21:05:37 +02001Strengthen default algorithm selection for X.509 and TLS
2--------------------------------------------------------
Gilles Peskine3758fd62021-06-02 00:07:17 +02003
Gilles Peskine6b1f64a2021-06-07 21:05:37 +02004The default X.509 verification profile (`mbedtls_x509_crt_profile_default`) and the default curve and hash selection in TLS have changed. They are now aligned, except that the X.509 profile only lists curves that support signature verification.
Gilles Peskine3758fd62021-06-02 00:07:17 +02005
Gilles Peskine6b1f64a2021-06-07 21:05:37 +02006Hashes and curves weaker than 255 bits (security strength less than 128 bits) are no longer accepted by default. The following hashes have been removed: SHA-1 (formerly only accepted for key exchanges but not for certificate signatures), SHA-224 (weaker hashes were already not accepted). The following curves have been removed: secp192r1, secp224r1, secp192k1, secp224k1.
Gilles Peskine3758fd62021-06-02 00:07:17 +02007
8The compile-time option `MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_KEY_EXCHANGE` is no longer available.
9
Gilles Peskine6b1f64a2021-06-07 21:05:37 +020010If you still need to accept certificates signed with algorithms that have been removed from the default profile, call `mbedtls_x509_crt_verify_with_profile` instead of `mbedtls_x509_crt_verify` and pass a profile that allows the curves and hashes you want. For example, to allow SHA-224:
Gilles Peskine3758fd62021-06-02 00:07:17 +020011```
12mbedtls_x509_crt_profile my_profile = mbedtls_x509_crt_profile_default;
13my_profile.allowed_mds |= MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA224 );
14```
15
16If you still need to allow hashes and curves in TLS that have been removed from the default configuration, call `mbedtls_ssl_conf_sig_hashes()` and `mbedtls_ssl_conf_curves()` with the desired lists.
Gilles Peskineb1940a72021-06-02 15:18:12 +020017
18TLS now favors faster curves over larger curves
19-----------------------------------------------
20
Gilles Peskine6b1f64a2021-06-07 21:05:37 +020021The default preference order for curves in TLS now favors resource usage (performance and memory consumption) over size. The exact order is unspecified and may change, but generally you can expect 256-bit curves to be preferred over larger curves.
Gilles Peskineb1940a72021-06-02 15:18:12 +020022
23If you prefer a different order, call `mbedtls_ssl_conf_curves()` when configuring a TLS connection.