Fix mbedtls_ssl_conf_cid() to not depend on macro constant values

The previous implementation of mbedtls_ssl_conf_cid() relied on
MBEDTLS_SSL_UNEXPECTED_CID_IGNORE being defined as 1.
This commit is contained in:
Hanno Becker 2019-05-14 11:45:26 +01:00
parent 7fefd83b34
commit 611ac77127

View File

@ -127,8 +127,13 @@ int mbedtls_ssl_conf_cid( mbedtls_ssl_config *conf,
if( len > MBEDTLS_SSL_CID_IN_LEN_MAX )
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
conf->ignore_unexpected_cid =
( ignore_other_cid == MBEDTLS_SSL_UNEXPECTED_CID_IGNORE );
if( ignore_other_cid != MBEDTLS_SSL_UNEXPECTED_CID_FAIL &&
ignore_other_cid != MBEDTLS_SSL_UNEXPECTED_CID_IGNORE )
{
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
}
conf->ignore_unexpected_cid = ignore_other_cid;
conf->cid_len = len;
return( 0 );
}