Fix TLS 1.2 session serialization on server side
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
parent
7b1921ac57
commit
feb577a949
1 changed files with 35 additions and 31 deletions
|
@ -9059,6 +9059,7 @@ static size_t ssl_tls12_session_save(const mbedtls_ssl_session *session,
|
|||
* Session ticket if any, plus associated data
|
||||
*/
|
||||
#if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_CLI_C)
|
||||
if (session->endpoint == MBEDTLS_SSL_IS_CLIENT) {
|
||||
used += 3 + session->ticket_len + 4; /* len + ticket + lifetime */
|
||||
|
||||
if (used <= buf_len) {
|
||||
|
@ -9074,6 +9075,7 @@ static size_t ssl_tls12_session_save(const mbedtls_ssl_session *session,
|
|||
MBEDTLS_PUT_UINT32_BE(session->ticket_lifetime, p, 0);
|
||||
p += 4;
|
||||
}
|
||||
}
|
||||
#endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_CLI_C */
|
||||
|
||||
/*
|
||||
|
@ -9241,6 +9243,7 @@ static int ssl_tls12_session_load(mbedtls_ssl_session *session,
|
|||
* Session ticket and associated data
|
||||
*/
|
||||
#if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_CLI_C)
|
||||
if (session->endpoint == MBEDTLS_SSL_IS_CLIENT) {
|
||||
if (3 > (size_t) (end - p)) {
|
||||
return MBEDTLS_ERR_SSL_BAD_INPUT_DATA;
|
||||
}
|
||||
|
@ -9268,6 +9271,7 @@ static int ssl_tls12_session_load(mbedtls_ssl_session *session,
|
|||
|
||||
session->ticket_lifetime = MBEDTLS_GET_UINT32_BE(p, 0);
|
||||
p += 4;
|
||||
}
|
||||
#endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_CLI_C */
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue