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 <gabor.mezei@arm.com>
This commit is contained in:
Gabor Mezei 2022-02-07 18:23:18 +01:00
parent ebc9368173
commit 5d7d201b87
No known key found for this signature in database
GPG key ID: 106F5A41ECC305BD
2 changed files with 4 additions and 4 deletions

View file

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

View file

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