tls13: early_data: cli: optimize code

- remove unnecessary check
- using local variable session

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
This commit is contained in:
Yanray Wang 2023-11-23 16:35:54 +08:00
parent 554ee62fba
commit d012084e91

View File

@ -2662,19 +2662,18 @@ static int ssl_tls13_parse_nst_early_data_ext(mbedtls_ssl_context *ssl,
const unsigned char *buf, const unsigned char *buf,
const unsigned char *end) const unsigned char *end)
{ {
mbedtls_ssl_session *session = ssl->session;
MBEDTLS_SSL_CHK_BUF_READ_PTR(buf, end, 4); MBEDTLS_SSL_CHK_BUF_READ_PTR(buf, end, 4);
if (ssl->session != NULL) { session->max_early_data_size = MBEDTLS_GET_UINT32_BE(buf, 0);
ssl->session->max_early_data_size = MBEDTLS_GET_UINT32_BE(buf, 0); mbedtls_ssl_session_set_ticket_flags(
mbedtls_ssl_session_set_ticket_flags( session, MBEDTLS_SSL_TLS1_3_TICKET_ALLOW_EARLY_DATA);
ssl->session, MBEDTLS_SSL_TLS1_3_TICKET_ALLOW_EARLY_DATA); MBEDTLS_SSL_DEBUG_MSG(
MBEDTLS_SSL_DEBUG_MSG( 3, ("received max_early_data_size: %u",
3, ("received max_early_data_size: %u", (unsigned int) session->max_early_data_size));
(unsigned int) ssl->session->max_early_data_size));
return 0;
}
return MBEDTLS_ERR_SSL_BAD_INPUT_DATA; return 0;
} }
#endif /* MBEDTLS_SSL_EARLY_DATA */ #endif /* MBEDTLS_SSL_EARLY_DATA */