mirror of
https://github.com/yuzu-mirror/mbedtls.git
synced 2026-04-04 22:19:05 +00:00
mbedtls_ssl_config min_tls_version, max_tls_version
Store the TLS version in tls_version instead of major, minor version num Note: existing application use which accesses the struct member (using MBEDTLS_PRIVATE) is not compatible on little-endian platforms, but is compatible on big-endian platforms. For systems supporting only TLSv1.2, the underlying values are the same (=> 3). New setter functions are more type-safe, taking argument as enum mbedtls_ssl_protocol_version: mbedtls_ssl_conf_max_tls_version() mbedtls_ssl_conf_min_tls_version() Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com>
This commit is contained in:
parent
da7851c825
commit
2dfcea2b9d
7 changed files with 96 additions and 120 deletions
|
|
@ -1179,16 +1179,16 @@ void set_ciphersuite( mbedtls_ssl_config *conf, const char *cipher,
|
|||
mbedtls_ssl_ciphersuite_from_id( forced_ciphersuite[0] );
|
||||
|
||||
TEST_ASSERT( ciphersuite_info != NULL );
|
||||
TEST_ASSERT( ciphersuite_info->min_minor_ver <= conf->max_minor_ver );
|
||||
TEST_ASSERT( ciphersuite_info->max_minor_ver >= conf->min_minor_ver );
|
||||
TEST_ASSERT( ciphersuite_info->min_minor_ver <= ( conf->max_tls_version & 0xFF ) );
|
||||
TEST_ASSERT( ciphersuite_info->max_minor_ver >= ( conf->min_tls_version & 0xFF ) );
|
||||
|
||||
if( conf->max_minor_ver > ciphersuite_info->max_minor_ver )
|
||||
if( conf->max_tls_version > ( 0x0300 | ciphersuite_info->max_minor_ver ) )
|
||||
{
|
||||
conf->max_minor_ver = ciphersuite_info->max_minor_ver;
|
||||
conf->max_tls_version = 0x0300 | ciphersuite_info->max_minor_ver;
|
||||
}
|
||||
if( conf->min_minor_ver < ciphersuite_info->min_minor_ver )
|
||||
if( conf->min_tls_version < ( 0x0300 | ciphersuite_info->min_minor_ver ) )
|
||||
{
|
||||
conf->min_minor_ver = ciphersuite_info->min_minor_ver;
|
||||
conf->min_tls_version = 0x0300 | ciphersuite_info->min_minor_ver;
|
||||
}
|
||||
|
||||
mbedtls_ssl_conf_ciphersuites( conf, forced_ciphersuite );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue