Allow hardcoding single supported elliptic curve
This commit introduces the option MBEDTLS_SSL_CONF_SINGLE_EC which can be used to register a single supported elliptic curve at compile time. It replaces the runtime configuration API mbedtls_ssl_conf_curves() which allows to register a _list_ of supported elliptic curves. In contrast to other options used to hardcode configuration options, MBEDTLS_SSL_CONF_SINGLE_EC isn't a numeric option, but instead it's only relevant if it's defined or not. To actually set the single elliptic curve that should be supported, numeric options MBEDTLS_SSL_CONF_SINGLE_EC_TLS_ID MBEDTLS_SSL_CONF_SINGLE_EC_GRP_ID must both be defined and provide the TLS ID and the Mbed TLS internal ID and the chosen curve, respectively.
This commit is contained in:
parent
ee24f8cecb
commit
c1096e7514
9 changed files with 116 additions and 11 deletions
|
@ -8616,6 +8616,7 @@ void mbedtls_ssl_conf_sig_hashes( mbedtls_ssl_config *conf,
|
|||
#endif /* MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED */
|
||||
|
||||
#if defined(MBEDTLS_ECP_C)
|
||||
#if !defined(MBEDTLS_SSL_CONF_SINGLE_EC)
|
||||
/*
|
||||
* Set the allowed elliptic curves
|
||||
*/
|
||||
|
@ -8624,6 +8625,7 @@ void mbedtls_ssl_conf_curves( mbedtls_ssl_config *conf,
|
|||
{
|
||||
conf->curve_list = curve_list;
|
||||
}
|
||||
#endif /* MBEDTLS_SSL_CONF_SINGLE_EC */
|
||||
#endif /* MBEDTLS_ECP_C */
|
||||
|
||||
#if defined(MBEDTLS_X509_CRT_PARSE_C)
|
||||
|
@ -10840,7 +10842,7 @@ static int ssl_preset_suiteb_hashes[] = {
|
|||
};
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_ECP_C)
|
||||
#if defined(MBEDTLS_ECP_C) && !defined(MBEDTLS_SSL_CONF_SINGLE_EC)
|
||||
static mbedtls_ecp_group_id ssl_preset_suiteb_curves[] = {
|
||||
#if defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED)
|
||||
MBEDTLS_ECP_DP_SECP256R1,
|
||||
|
@ -10983,7 +10985,9 @@ int mbedtls_ssl_config_defaults( mbedtls_ssl_config *conf,
|
|||
#endif
|
||||
|
||||
#if defined(MBEDTLS_ECP_C)
|
||||
#if !defined(MBEDTLS_SSL_CONF_SINGLE_EC)
|
||||
conf->curve_list = ssl_preset_suiteb_curves;
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
@ -11024,8 +11028,10 @@ int mbedtls_ssl_config_defaults( mbedtls_ssl_config *conf,
|
|||
#endif
|
||||
|
||||
#if defined(MBEDTLS_ECP_C)
|
||||
#if !defined(MBEDTLS_SSL_CONF_SINGLE_EC)
|
||||
conf->curve_list = mbedtls_ecp_grp_id_list();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_DHM_C) && defined(MBEDTLS_SSL_CLI_C)
|
||||
conf->dhm_min_bitlen = 1024;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue