Change ticket_flag base on review

Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
This commit is contained in:
Xiaokang Qian 2022-11-09 08:09:47 +00:00
parent 2d87a9eeb5
commit ae07cd995a
3 changed files with 7 additions and 13 deletions

View File

@ -820,12 +820,10 @@ typedef struct mbedtls_ssl_flight_item mbedtls_ssl_flight_item;
#if defined(MBEDTLS_SSL_PROTO_TLS1_3) && defined(MBEDTLS_SSL_SESSION_TICKETS)
typedef enum
{
MBEDTLS_SSL_TICKET_ALLOW_EARLY_DATA = 1,
MBEDTLS_SSL_TICKET_ALLOW_DHE_RESUMPTION = 2,
MBEDTLS_SSL_TICKET_ALLOW_PSK_RESUMPTION = 4,
} mbedtls_ssl_ticket_flags;
typedef uint8_t mbedtls_ssl_tls13_ticket_flags;
#define MBEDTLS_SSL_TLS1_3_TICKET_ALLOW_PSK_RESUMPTION ( 1u << 0 )
#define MBEDTLS_SSL_TLS1_3_TICKET_ALLOW_PSK_EPHEMERAL_RESUMPTION ( 1u << 2 )
#define MBEDTLS_SSL_TLS1_3_TICKET_HAS_EARLY_DATA_INDACTION ( 1u << 3 )
#endif /* MBEDTLS_SSL_PROTO_TLS1_3 && MBEDTLS_SSL_SESSION_TICKETS */
/**

View File

@ -33,11 +33,6 @@
const char *mbedtls_ssl_states_str( mbedtls_ssl_states in );
#if defined(MBEDTLS_SSL_PROTO_TLS1_3) && defined(MBEDTLS_SSL_SESSION_TICKETS)
const char *mbedtls_ssl_ticket_flags_str( mbedtls_ssl_ticket_flags in );
#endif /* defined(MBEDTLS_SSL_PROTO_TLS1_3) &&
defined(MBEDTLS_SSL_SESSION_TICKETS) */
const char *mbedtls_ssl_protocol_version_str( mbedtls_ssl_protocol_version in );
const char *mbedtls_tls_prf_types_str( mbedtls_tls_prf_types in );

View File

@ -706,7 +706,8 @@ static int ssl_tls13_early_data_has_valid_ticket( mbedtls_ssl_context *ssl )
mbedtls_ssl_session *session = ssl->session_negotiate;
return( ssl->handshake->resume &&
session->tls_version == MBEDTLS_SSL_VERSION_TLS1_3 &&
( session->ticket_flags & MBEDTLS_SSL_TICKET_ALLOW_EARLY_DATA ) &&
( session->ticket_flags &
MBEDTLS_SSL_TLS1_3_TICKET_HAS_EARLY_DATA_INDACTION ) &&
mbedtls_ssl_tls13_cipher_suite_is_offered(
ssl, session->ciphersuite ) );
}
@ -2552,7 +2553,7 @@ static int ssl_tls13_parse_new_session_ticket_exts( mbedtls_ssl_context *ssl,
if( ssl->session != NULL )
{
ssl->session->ticket_flags |=
MBEDTLS_SSL_TICKET_ALLOW_EARLY_DATA;
MBEDTLS_SSL_TLS1_3_TICKET_HAS_EARLY_DATA_INDACTION;
}
break;