fix various issues
- Improve comments - Align count variable name to `new_session_tickets_count` - move tickets_count init to handshake init Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
This commit is contained in:
parent
7a51305478
commit
d0766eca58
4 changed files with 34 additions and 19 deletions
|
@ -2617,10 +2617,23 @@ MBEDTLS_CHECK_RETURN_CRITICAL
|
|||
static int ssl_tls13_write_new_session_ticket_coordinate( mbedtls_ssl_context *ssl )
|
||||
{
|
||||
/* Check whether the use of session tickets is enabled */
|
||||
if( ssl->conf->f_ticket_write == NULL ||
|
||||
ssl->handshake->tls13_session_tickets == 0 )
|
||||
if( ssl->conf->f_ticket_write == NULL )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 2, ( "new session ticket is not enabled" ) );
|
||||
MBEDTLS_SSL_DEBUG_MSG( 2, ( "NewSessionTicket: disabled,"
|
||||
" callback is not set" ) );
|
||||
return( SSL_NEW_SESSION_TICKET_SKIP );
|
||||
}
|
||||
if( ssl->conf->new_session_tickets_count == 0 )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 2, ( "NewSessionTicket: disabled,"
|
||||
" configured count is zero" ) );
|
||||
return( SSL_NEW_SESSION_TICKET_SKIP );
|
||||
}
|
||||
|
||||
if( ssl->handshake->new_session_tickets_count == 0 )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 2, ( "NewSessionTicket: all tickets have "
|
||||
"been sent." ) );
|
||||
return( SSL_NEW_SESSION_TICKET_SKIP );
|
||||
}
|
||||
|
||||
|
@ -2642,9 +2655,9 @@ static int ssl_tls13_prepare_new_session_ticket( mbedtls_ssl_context *ssl,
|
|||
MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> prepare NewSessionTicket msg" ) );
|
||||
|
||||
if( ssl->handshake->resume == 1 )
|
||||
ssl->handshake->tls13_session_tickets = 0;
|
||||
ssl->handshake->new_session_tickets_count = 0;
|
||||
else
|
||||
ssl->handshake->tls13_session_tickets--;
|
||||
ssl->handshake->new_session_tickets_count--;
|
||||
#if defined(MBEDTLS_HAVE_TIME)
|
||||
session->start = mbedtls_time( NULL );
|
||||
#endif
|
||||
|
@ -2890,12 +2903,6 @@ int mbedtls_ssl_tls13_handshake_server_step( mbedtls_ssl_context *ssl )
|
|||
/* start state */
|
||||
case MBEDTLS_SSL_HELLO_REQUEST:
|
||||
mbedtls_ssl_handshake_set_state( ssl, MBEDTLS_SSL_CLIENT_HELLO );
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_3) && defined(MBEDTLS_SSL_SESSION_TICKETS)
|
||||
ssl->handshake->tls13_session_tickets =
|
||||
ssl->conf->new_session_tickets ?
|
||||
ssl->conf->new_session_tickets :
|
||||
MBEDTLS_SSL_TLS1_3_DEFAULT_NEW_SESSION_TICKETS;
|
||||
#endif
|
||||
ret = 0;
|
||||
break;
|
||||
|
||||
|
@ -3014,7 +3021,7 @@ int mbedtls_ssl_tls13_handshake_server_step( mbedtls_ssl_context *ssl )
|
|||
*/
|
||||
ret = 0;
|
||||
|
||||
if( ssl->handshake->tls13_session_tickets == 0 )
|
||||
if( ssl->handshake->new_session_tickets_count == 0 )
|
||||
mbedtls_ssl_handshake_set_state( ssl, MBEDTLS_SSL_HANDSHAKE_OVER );
|
||||
else
|
||||
mbedtls_ssl_handshake_set_state( ssl, MBEDTLS_SSL_NEW_SESSION_TICKET );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue