fix comments and time_t type issues

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
This commit is contained in:
Jerry Yu 2022-07-20 10:36:12 +08:00
parent a0446a0344
commit 08aed4def9
4 changed files with 11 additions and 4 deletions

View file

@ -843,6 +843,11 @@
#error "MBEDTLS_SSL_TICKET_C defined, but not all prerequisites"
#endif
#if defined(MBEDTLS_SSL_TICKET_NONCE_LENGTH) && \
MBEDTLS_SSL_TICKET_NONCE_LENGTH >= 256
#error "MBEDTLS_SSL_TICKET_NONCE_LENGTH must be less than 256"
#endif
#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION) && \
!defined(MBEDTLS_X509_CRT_PARSE_C)
#error "MBEDTLS_SSL_SERVER_NAME_INDICATION defined, but not all prerequisites"

View file

@ -1546,7 +1546,7 @@
*
* Size in bytes of a ticket nonce. This is not used in TLS 1.2.
*
* This must be smaller or equal to 255.
* This must be less than 256.
*/
#define MBEDTLS_SSL_TICKET_NONCE_LENGTH 32

View file

@ -1185,7 +1185,7 @@ struct mbedtls_ssl_session
#endif /* MBEDTLS_SHA256_C */
#if defined(MBEDTLS_HAVE_TIME) && defined(MBEDTLS_SSL_CLI_C)
time_t MBEDTLS_PRIVATE(ticket_received); /*!< time ticket was received */
mbedtls_time_t MBEDTLS_PRIVATE(ticket_received); /*!< time ticket was received */
#endif /* MBEDTLS_HAVE_TIME && MBEDTLS_SSL_CLI_C */
#endif /* MBEDTLS_SSL_PROTO_TLS1_3 && MBEDTLS_SSL_SESSION_TICKETS */

View file

@ -1915,6 +1915,8 @@ static int ssl_tls13_parse_new_session_ticket_exts( mbedtls_ssl_context *ssl,
}
/*
* From RFC8446, page 74
*
* struct {
* uint32 ticket_lifetime;
* uint32 ticket_age_add;
@ -1943,7 +1945,7 @@ static int ssl_tls13_parse_new_session_ticket( mbedtls_ssl_context *ssl,
/*
* ticket_lifetime 4 bytes
* ticket_age_add 4 bytes
* ticket_nonce >=1 byte
* ticket_nonce_len 1 byte
*/
MBEDTLS_SSL_CHK_BUF_READ_PTR( p, end, 9 );
@ -2022,7 +2024,7 @@ static int ssl_tls13_postprocess_new_session_ticket( mbedtls_ssl_context *ssl,
#if defined(MBEDTLS_HAVE_TIME)
/* Store ticket creation time */
session->ticket_received = time( NULL );
session->ticket_received = mbedtls_time( NULL );
#endif
ciphersuite_info = mbedtls_ssl_ciphersuite_from_id( session->ciphersuite );