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) #if defined(MBEDTLS_SSL_PROTO_TLS1_3) && defined(MBEDTLS_SSL_SESSION_TICKETS)
typedef enum typedef uint8_t mbedtls_ssl_tls13_ticket_flags;
{ #define MBEDTLS_SSL_TLS1_3_TICKET_ALLOW_PSK_RESUMPTION ( 1u << 0 )
MBEDTLS_SSL_TICKET_ALLOW_EARLY_DATA = 1, #define MBEDTLS_SSL_TLS1_3_TICKET_ALLOW_PSK_EPHEMERAL_RESUMPTION ( 1u << 2 )
MBEDTLS_SSL_TICKET_ALLOW_DHE_RESUMPTION = 2, #define MBEDTLS_SSL_TLS1_3_TICKET_HAS_EARLY_DATA_INDACTION ( 1u << 3 )
MBEDTLS_SSL_TICKET_ALLOW_PSK_RESUMPTION = 4,
} mbedtls_ssl_ticket_flags;
#endif /* MBEDTLS_SSL_PROTO_TLS1_3 && MBEDTLS_SSL_SESSION_TICKETS */ #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 ); 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_ssl_protocol_version_str( mbedtls_ssl_protocol_version in );
const char *mbedtls_tls_prf_types_str( mbedtls_tls_prf_types 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; mbedtls_ssl_session *session = ssl->session_negotiate;
return( ssl->handshake->resume && return( ssl->handshake->resume &&
session->tls_version == MBEDTLS_SSL_VERSION_TLS1_3 && 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( mbedtls_ssl_tls13_cipher_suite_is_offered(
ssl, session->ciphersuite ) ); ssl, session->ciphersuite ) );
} }
@ -2552,7 +2553,7 @@ static int ssl_tls13_parse_new_session_ticket_exts( mbedtls_ssl_context *ssl,
if( ssl->session != NULL ) if( ssl->session != NULL )
{ {
ssl->session->ticket_flags |= ssl->session->ticket_flags |=
MBEDTLS_SSL_TICKET_ALLOW_EARLY_DATA; MBEDTLS_SSL_TLS1_3_TICKET_HAS_EARLY_DATA_INDACTION;
} }
break; break;