tls13: change return value of mbedtls_ssl_conf_tls13_check_kex_modes
To keep the convention in TLS code, check functions should return 0 when check is successful. Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
This commit is contained in:
parent
981ec14744
commit
60a22567e4
2 changed files with 13 additions and 13 deletions
|
@ -1904,37 +1904,37 @@ int mbedtls_ssl_tls13_handshake_server_step(mbedtls_ssl_context *ssl);
|
|||
static inline unsigned mbedtls_ssl_conf_tls13_check_kex_modes(mbedtls_ssl_context *ssl,
|
||||
int kex_mode_mask)
|
||||
{
|
||||
return (ssl->conf->tls13_kex_modes & kex_mode_mask) != 0;
|
||||
return (ssl->conf->tls13_kex_modes & kex_mode_mask) == 0;
|
||||
}
|
||||
|
||||
static inline int mbedtls_ssl_conf_tls13_psk_enabled(mbedtls_ssl_context *ssl)
|
||||
{
|
||||
return mbedtls_ssl_conf_tls13_check_kex_modes(ssl,
|
||||
MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK);
|
||||
return !mbedtls_ssl_conf_tls13_check_kex_modes(ssl,
|
||||
MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK);
|
||||
}
|
||||
|
||||
static inline int mbedtls_ssl_conf_tls13_psk_ephemeral_enabled(mbedtls_ssl_context *ssl)
|
||||
{
|
||||
return mbedtls_ssl_conf_tls13_check_kex_modes(ssl,
|
||||
MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL);
|
||||
return !mbedtls_ssl_conf_tls13_check_kex_modes(ssl,
|
||||
MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL);
|
||||
}
|
||||
|
||||
static inline int mbedtls_ssl_conf_tls13_ephemeral_enabled(mbedtls_ssl_context *ssl)
|
||||
{
|
||||
return mbedtls_ssl_conf_tls13_check_kex_modes(ssl,
|
||||
MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL);
|
||||
return !mbedtls_ssl_conf_tls13_check_kex_modes(ssl,
|
||||
MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL);
|
||||
}
|
||||
|
||||
static inline int mbedtls_ssl_conf_tls13_some_ephemeral_enabled(mbedtls_ssl_context *ssl)
|
||||
{
|
||||
return mbedtls_ssl_conf_tls13_check_kex_modes(ssl,
|
||||
MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ALL);
|
||||
return !mbedtls_ssl_conf_tls13_check_kex_modes(ssl,
|
||||
MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ALL);
|
||||
}
|
||||
|
||||
static inline int mbedtls_ssl_conf_tls13_some_psk_enabled(mbedtls_ssl_context *ssl)
|
||||
{
|
||||
return mbedtls_ssl_conf_tls13_check_kex_modes(ssl,
|
||||
MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ALL);
|
||||
return !mbedtls_ssl_conf_tls13_check_kex_modes(ssl,
|
||||
MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ALL);
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_SSL_SRV_C) && \
|
||||
|
|
|
@ -684,7 +684,7 @@ static int ssl_tls13_has_configured_ticket(mbedtls_ssl_context *ssl)
|
|||
mbedtls_ssl_session *session = ssl->session_negotiate;
|
||||
return ssl->handshake->resume &&
|
||||
session != NULL && session->ticket != NULL &&
|
||||
mbedtls_ssl_conf_tls13_check_kex_modes(
|
||||
!mbedtls_ssl_conf_tls13_check_kex_modes(
|
||||
ssl, mbedtls_ssl_session_get_ticket_flags(
|
||||
session, MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ALL));
|
||||
}
|
||||
|
@ -1879,7 +1879,7 @@ static int ssl_tls13_postprocess_server_hello(mbedtls_ssl_context *ssl)
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!mbedtls_ssl_conf_tls13_check_kex_modes(
|
||||
if (mbedtls_ssl_conf_tls13_check_kex_modes(
|
||||
ssl, handshake->key_exchange_mode)) {
|
||||
ret = MBEDTLS_ERR_SSL_HANDSHAKE_FAILURE;
|
||||
MBEDTLS_SSL_DEBUG_MSG(
|
||||
|
|
Loading…
Reference in a new issue