From eb5d014d8ec82cfebfdd008d890d0e1a114c2abc Mon Sep 17 00:00:00 2001 From: Rodrigo Dias Correa Date: Tue, 10 Nov 2020 02:51:51 -0300 Subject: [PATCH] Fix GCC warning in `ssl_calc_finished_tls_sha384` GCC 11 generated a warning because `padbuf` was too small to be used as an argument for `mbedtls_sha512_finish_ret`. The `output` parameter of `mbedtls_sha512_finish_ret` has the type `unsigned char[64]`, but `padbuf` was only 48 bytes long. Even though `ssl_calc_finished_tls_sha384` uses only 48 bytes for the hash output, the size of `padbuf` was increased to 64 bytes. Signed-off-by: Rodrigo Dias Correa --- library/ssl_tls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/ssl_tls.c b/library/ssl_tls.c index 9d4c46228..c69de3f1d 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -3202,7 +3202,7 @@ static void ssl_calc_finished_tls_sha384( { int len = 12; const char *sender; - unsigned char padbuf[48]; + unsigned char padbuf[64]; #if defined(MBEDTLS_USE_PSA_CRYPTO) size_t hash_size; psa_hash_operation_t sha384_psa = PSA_HASH_OPERATION_INIT;