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 <rodrigo@correas.us>
This commit is contained in:
Rodrigo Dias Correa 2020-11-28 14:59:56 -03:00
parent 0b9bc0bd77
commit d2d0e70276

View file

@ -6373,6 +6373,12 @@ static void ssl_calc_finished_tls_sha384(
const char *sender; const char *sender;
mbedtls_sha512_context sha512; mbedtls_sha512_context sha512;
unsigned char padbuf[48]; 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; mbedtls_ssl_session *session = ssl->session_negotiate;
if( !session ) if( !session )
@ -6399,13 +6405,7 @@ static void ssl_calc_finished_tls_sha384(
? "client finished" ? "client finished"
: "server finished"; : "server finished";
/* finish_sha384( &sha512, padbuf );
* 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 );
ssl->handshake->tls_prf( session->master, 48, sender, ssl->handshake->tls_prf( session->master, 48, sender,
padbuf, 48, buf, len ); padbuf, 48, buf, len );