From 326cf46764e246e1870681cca2e19c6c9905c4dd Mon Sep 17 00:00:00 2001 From: Valerio Setti Date: Fri, 23 Dec 2022 14:57:18 +0100 Subject: [PATCH] test: improved readability in sha self tests Signed-off-by: Valerio Setti --- library/sha256.c | 9 +++------ library/sha512.c | 9 +++------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/library/sha256.c b/library/sha256.c index 4f30e14f8..6965820a2 100644 --- a/library/sha256.c +++ b/library/sha256.c @@ -781,15 +781,12 @@ static int mbedtls_sha256_common_self_test( int verbose, int is224 ) unsigned char sha256sum[32]; mbedtls_sha256_context ctx; - sha_test_sum_t* sha_test_sum; - - sha_test_sum = #if defined(MBEDTLS_SHA224_C) && defined(MBEDTLS_SHA256_C) - ( is224 ) ? sha224_test_sum : sha256_test_sum; + sha_test_sum_t* sha_test_sum = ( is224 ) ? sha224_test_sum : sha256_test_sum; #elif defined(MBEDTLS_SHA256_C) - sha256_test_sum; + sha_test_sum_t* sha_test_sum = sha256_test_sum; #else - sha224_test_sum; + sha_test_sum_t* sha_test_sum = sha224_test_sum; #endif buf = mbedtls_calloc( 1024, sizeof(unsigned char) ); diff --git a/library/sha512.c b/library/sha512.c index 738f170f8..5de151d60 100644 --- a/library/sha512.c +++ b/library/sha512.c @@ -953,15 +953,12 @@ static int mbedtls_sha512_common_self_test( int verbose, int is384 ) unsigned char sha512sum[64]; mbedtls_sha512_context ctx; - sha_test_sum_t* sha_test_sum; - - sha_test_sum = #if defined(MBEDTLS_SHA384_C) && defined(MBEDTLS_SHA512_C) - ( is384 ) ? sha384_test_sum : sha512_test_sum; + sha_test_sum_t* sha_test_sum = ( is384 ) ? sha384_test_sum : sha512_test_sum; #elif defined(MBEDTLS_SHA512_C) - sha512_test_sum; + sha_test_sum_t* sha_test_sum = sha512_test_sum; #else - sha384_test_sum; + sha_test_sum_t* sha_test_sum = sha384_test_sum; #endif buf = mbedtls_calloc( 1024, sizeof(unsigned char) );