From 5d7d201b87605436158c43052dc2170361b18f8a Mon Sep 17 00:00:00 2001 From: Gabor Mezei Date: Mon, 7 Feb 2022 18:23:18 +0100 Subject: [PATCH] Update test Testing the hash length in this context is not applicable because there is no way to specify it when calling mbedtls_psa_hkdf_extract. Change to test invalid `alg` parameter. Signed-off-by: Gabor Mezei --- tests/suites/test_suite_ssl.data | 2 +- tests/suites/test_suite_ssl.function | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/suites/test_suite_ssl.data b/tests/suites/test_suite_ssl.data index 6f8969523..9e189a335 100644 --- a/tests/suites/test_suite_ssl.data +++ b/tests/suites/test_suite_ssl.data @@ -4420,7 +4420,7 @@ SSL TLS 1.3 Key schedule: HKDF RFC5869 Test Vector #7 Extract depends_on:PSA_WANT_ALG_SHA_1 psa_hkdf_extract:PSA_ALG_HMAC(PSA_ALG_SHA_1):"0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c":"":"2adccada18779e7c2077ad2eb19d3f3e731385dd" -SSL TLS 1.3 Key schedule: HKDF extract fails with hash_len of 0 +SSL TLS 1.3 Key schedule: HKDF extract fails with wrong hash alg psa_hkdf_extract_ret:0:MBEDTLS_ERR_SSL_BAD_INPUT_DATA SSL TLS 1.3 Key schedule: HKDF RFC5869 Test Vector #1 Expand diff --git a/tests/suites/test_suite_ssl.function b/tests/suites/test_suite_ssl.function index c01204e17..c35e2433d 100644 --- a/tests/suites/test_suite_ssl.function +++ b/tests/suites/test_suite_ssl.function @@ -3842,7 +3842,7 @@ exit: /* END_CASE */ /* BEGIN_CASE depends_on:MBEDTLS_TEST_HOOKS:MBEDTLS_SSL_PROTO_TLS1_3 */ -void psa_hkdf_extract_ret( int hash_len, int ret ) +void psa_hkdf_extract_ret( int alg, int ret ) { int output_ret; unsigned char *salt = NULL; @@ -3850,13 +3850,13 @@ void psa_hkdf_extract_ret( int hash_len, int ret ) unsigned char *prk = NULL; size_t salt_len, ikm_len, prk_len; - salt_len = hash_len; ASSERT_ALLOC( prk, PSA_MAC_MAX_SIZE); + salt_len = 0; ikm_len = 0; prk_len = 0; PSA_ASSERT( psa_crypto_init() ); - output_ret = mbedtls_psa_hkdf_extract( 0, salt, salt_len, + output_ret = mbedtls_psa_hkdf_extract( alg, salt, salt_len, ikm, ikm_len, prk, PSA_MAC_MAX_SIZE, &prk_len ); TEST_ASSERT( output_ret == ret );