From 2788f6b6685c8c0e41e7ee57e788a07b99edfb43 Mon Sep 17 00:00:00 2001 From: David Horstmann Date: Thu, 6 Oct 2022 18:45:09 +0100 Subject: [PATCH] Refactor macro-spanning if in sha512.c Signed-off-by: David Horstmann --- library/sha512.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library/sha512.c b/library/sha512.c index f96580db52..9be05cb7ee 100644 --- a/library/sha512.c +++ b/library/sha512.c @@ -820,9 +820,11 @@ int mbedtls_sha512_finish( mbedtls_sha512_context *ctx, sha512_put_uint64_be( ctx->state[4], output, 32 ); sha512_put_uint64_be( ctx->state[5], output, 40 ); + int truncated = 0; #if defined(MBEDTLS_SHA384_C) - if( ctx->is384 == 0 ) + truncated = ctx->is384; #endif + if( !truncated ) { sha512_put_uint64_be( ctx->state[6], output, 48 ); sha512_put_uint64_be( ctx->state[7], output, 56 );