From 748ab4ae77fc83b53e9a8beaebbe529cab4c20f5 Mon Sep 17 00:00:00 2001 From: Gabor Mezei Date: Wed, 9 Feb 2022 16:31:48 +0100 Subject: [PATCH] Use ASSERT_ALLOC Change the calloc functions to ASSERT_ALLOC to check the return value of calloc as well. Signed-off-by: Gabor Mezei --- tests/suites/test_suite_hkdf.function | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/suites/test_suite_hkdf.function b/tests/suites/test_suite_hkdf.function index 6cb111830..feb17174e 100644 --- a/tests/suites/test_suite_hkdf.function +++ b/tests/suites/test_suite_hkdf.function @@ -78,7 +78,7 @@ void test_hkdf_expand( int md_alg, char *hex_info_string, const mbedtls_md_info_t *md = mbedtls_md_info_from_type( md_alg ); TEST_ASSERT( md != NULL ); - output_okm = mbedtls_calloc( OKM_LEN, 1 ); + ASSERT_ALLOC( output_okm, OKM_LEN ); prk = mbedtls_test_unhexify_alloc( hex_prk_string, &prk_len ); info = mbedtls_test_unhexify_alloc( hex_info_string, &info_len ); @@ -143,10 +143,10 @@ void test_hkdf_expand_ret( int hash_len, int prk_len, int okm_len, int ret ) info_len = 0; if (prk_len > 0) - prk = mbedtls_calloc( prk_len, 1 ); + ASSERT_ALLOC( prk, prk_len ); if (okm_len > 0) - okm = mbedtls_calloc( okm_len, 1 ); + ASSERT_ALLOC( okm, okm_len ); output_ret = mbedtls_hkdf_expand( &fake_md_info, prk, prk_len, info, info_len, okm, okm_len );