From d2d0e70276b96de6cdf10d7fd0aa1dcff65e5ec2 Mon Sep 17 00:00:00 2001 From: Rodrigo Dias Correa Date: Sat, 28 Nov 2020 14:59:56 -0300 Subject: [PATCH] Move declaration to fix C90 warning "declaration-after-statement" was generated because that code was backported from the development branch, which currently uses C99. Signed-off-by: Rodrigo Dias Correa --- library/ssl_tls.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/library/ssl_tls.c b/library/ssl_tls.c index 45df3d487..c749a8611 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -6373,6 +6373,12 @@ static void ssl_calc_finished_tls_sha384( const char *sender; mbedtls_sha512_context sha512; unsigned char padbuf[48]; + /* + * For SHA-384, we can save 16 bytes by keeping padbuf 48 bytes long. + * However, to avoid stringop-overflow warning in gcc, we have to cast + * mbedtls_sha512_finish_ret(). + */ + finish_sha384_t finish_sha384 = (finish_sha384_t)mbedtls_sha512_finish_ret; mbedtls_ssl_session *session = ssl->session_negotiate; if( !session ) @@ -6399,13 +6405,7 @@ static void ssl_calc_finished_tls_sha384( ? "client finished" : "server finished"; - /* - * For SHA-384, we can save 16 bytes by keeping padbuf 48 bytes long. - * However, to avoid stringop-overflow warning in gcc, we have to cast - * mbedtls_sha512_finish_ret(). - */ - finish_sha384_t finish = (finish_sha384_t)mbedtls_sha512_finish_ret; - finish( &sha512, padbuf ); + finish_sha384( &sha512, padbuf ); ssl->handshake->tls_prf( session->master, 48, sender, padbuf, 48, buf, len );