test: improved readability in sha self tests

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
This commit is contained in:
Valerio Setti 2022-12-23 14:57:18 +01:00
parent e269750f0d
commit 326cf46764
2 changed files with 6 additions and 12 deletions

View file

@ -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) );

View file

@ -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) );