From 21b6870301d1273c9491bac6db522d798880484e Mon Sep 17 00:00:00 2001 From: Andrzej Kurek Date: Wed, 17 Aug 2022 16:26:12 -0400 Subject: [PATCH] test_suite_ssl: remove unnecessary usage of mbedtls_md_get_size Signed-off-by: Andrzej Kurek --- tests/suites/test_suite_ssl.function | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/tests/suites/test_suite_ssl.function b/tests/suites/test_suite_ssl.function index c83e63c0f..a112f6c2e 100644 --- a/tests/suites/test_suite_ssl.function +++ b/tests/suites/test_suite_ssl.function @@ -15,6 +15,7 @@ #include "psa/crypto.h" #endif #include +#include "hash_info.h" #include #include @@ -1444,16 +1445,12 @@ static int build_transforms( mbedtls_ssl_transform *t_in, if( cipher_info->mode == MBEDTLS_MODE_CBC || cipher_info->mode == MBEDTLS_MODE_STREAM ) { -#if defined(MBEDTLS_USE_PSA_CRYPTO) - maclen = mbedtls_hash_info_get_size( hash_id ); -#else - mbedtls_md_info_t const *md_info; - - /* Pick hash */ - md_info = mbedtls_md_info_from_type( hash_id ); +#if !defined(MBEDTLS_USE_PSA_CRYPTO) + mbedtls_md_info_t const *md_info = mbedtls_md_info_from_type( hash_id ); CHK( md_info != NULL ); - maclen = mbedtls_md_get_size( md_info ); -#endif /* MBEDTLS_USE_PSA_CRYPTO */ +#endif + maclen = mbedtls_hash_info_get_size( hash_id ); + CHK( maclen != 0 ); /* Pick hash keys */ CHK( ( md0 = mbedtls_calloc( 1, maclen ) ) != NULL ); CHK( ( md1 = mbedtls_calloc( 1, maclen ) ) != NULL );