mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-04 13:13:31 +00:00
tls13: Remove unnecessary cast from size_t to uint32_t
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
parent
e93cd1b580
commit
2e7dfd5181
@ -1459,8 +1459,6 @@ int mbedtls_ssl_tls13_write_early_data_ext(mbedtls_ssl_context *ssl,
|
||||
int mbedtls_ssl_tls13_check_early_data_len(mbedtls_ssl_context *ssl,
|
||||
size_t early_data_len)
|
||||
{
|
||||
uint32_t uint32_early_data_len = (uint32_t) early_data_len;
|
||||
|
||||
/*
|
||||
* This function should be called only while an handshake is in progress
|
||||
* and thus a session under negotiation. Add a sanity check to detect a
|
||||
@ -1475,13 +1473,13 @@ int mbedtls_ssl_tls13_check_early_data_len(mbedtls_ssl_context *ssl,
|
||||
* A server receiving more than max_early_data_size bytes of 0-RTT data
|
||||
* SHOULD terminate the connection with an "unexpected_message" alert.
|
||||
*/
|
||||
if (uint32_early_data_len >
|
||||
if (early_data_len >
|
||||
(ssl->session_negotiate->max_early_data_size -
|
||||
ssl->total_early_data_size)) {
|
||||
|
||||
MBEDTLS_SSL_DEBUG_MSG(
|
||||
2, ("EarlyData: Too much early data received, %u > %u",
|
||||
ssl->total_early_data_size + uint32_early_data_len,
|
||||
2, ("EarlyData: Too much early data received, %u + %" MBEDTLS_PRINTF_SIZET " > %u",
|
||||
ssl->total_early_data_size, early_data_len,
|
||||
ssl->session_negotiate->max_early_data_size));
|
||||
|
||||
MBEDTLS_SSL_PEND_FATAL_ALERT(
|
||||
@ -1490,7 +1488,13 @@ int mbedtls_ssl_tls13_check_early_data_len(mbedtls_ssl_context *ssl,
|
||||
return MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE;
|
||||
}
|
||||
|
||||
ssl->total_early_data_size += uint32_early_data_len;
|
||||
/*
|
||||
* The check just above implies that early_data_len is lower than
|
||||
* UINT32_MAX thus its cast to an uint32_t below is safe. We need it
|
||||
* to appease some compilers.
|
||||
*/
|
||||
|
||||
ssl->total_early_data_size += (uint32_t) early_data_len;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user