tls13: rename mbedtls_ssl_session_check_ticket_flags
The function is renamed to mbedtls_ssl_session_ticket_has_flags. Descriptions are added. Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
This commit is contained in:
parent
d72e858fd1
commit
4f537f73fa
2 changed files with 15 additions and 9 deletions
|
@ -2776,24 +2776,30 @@ static inline unsigned int mbedtls_ssl_session_get_ticket_flags(
|
||||||
(flags & MBEDTLS_SSL_TLS1_3_TICKET_FLAGS_MASK);
|
(flags & MBEDTLS_SSL_TLS1_3_TICKET_FLAGS_MASK);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned int mbedtls_ssl_session_check_ticket_flags(
|
/**
|
||||||
|
* Check if at least one of the given flags is set in
|
||||||
|
* the session ticket. See the definition of
|
||||||
|
* `MBEDTLS_SSL_TLS1_3_TICKET_FLAGS_MASK` to get all
|
||||||
|
* permitted flags.
|
||||||
|
*/
|
||||||
|
static inline int mbedtls_ssl_session_ticket_has_flags(
|
||||||
mbedtls_ssl_session *session, unsigned int flags)
|
mbedtls_ssl_session *session, unsigned int flags)
|
||||||
{
|
{
|
||||||
return mbedtls_ssl_session_get_ticket_flags(session, flags) == 0;
|
return mbedtls_ssl_session_get_ticket_flags(session, flags) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned int mbedtls_ssl_session_ticket_allow_psk(
|
static inline int mbedtls_ssl_session_ticket_allow_psk(
|
||||||
mbedtls_ssl_session *session)
|
mbedtls_ssl_session *session)
|
||||||
{
|
{
|
||||||
return !mbedtls_ssl_session_check_ticket_flags(session,
|
return mbedtls_ssl_session_ticket_has_flags(session,
|
||||||
MBEDTLS_SSL_TLS1_3_TICKET_ALLOW_PSK_RESUMPTION);
|
MBEDTLS_SSL_TLS1_3_TICKET_ALLOW_PSK_RESUMPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned int mbedtls_ssl_session_ticket_allow_psk_ephemeral(
|
static inline int mbedtls_ssl_session_ticket_allow_psk_ephemeral(
|
||||||
mbedtls_ssl_session *session)
|
mbedtls_ssl_session *session)
|
||||||
{
|
{
|
||||||
return !mbedtls_ssl_session_check_ticket_flags(session,
|
return mbedtls_ssl_session_ticket_has_flags(session,
|
||||||
MBEDTLS_SSL_TLS1_3_TICKET_ALLOW_PSK_EPHEMERAL_RESUMPTION);
|
MBEDTLS_SSL_TLS1_3_TICKET_ALLOW_PSK_EPHEMERAL_RESUMPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned int mbedtls_ssl_session_ticket_allow_early_data(
|
static inline unsigned int mbedtls_ssl_session_ticket_allow_early_data(
|
||||||
|
|
|
@ -1008,7 +1008,7 @@ static int ssl_tls13_ticket_is_kex_mode_permitted(mbedtls_ssl_context *ssl,
|
||||||
{
|
{
|
||||||
#if defined(MBEDTLS_SSL_SESSION_TICKETS)
|
#if defined(MBEDTLS_SSL_SESSION_TICKETS)
|
||||||
if (ssl->handshake->resume) {
|
if (ssl->handshake->resume) {
|
||||||
if (mbedtls_ssl_session_check_ticket_flags(
|
if (!mbedtls_ssl_session_ticket_has_flags(
|
||||||
ssl->session_negotiate, kex_mode)) {
|
ssl->session_negotiate, kex_mode)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue