Use PSA_INIT()

Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
This commit is contained in:
Gabor Mezei 2022-02-15 16:35:23 +01:00
parent d860e0f18b
commit 4fded1359a
No known key found for this signature in database
GPG key ID: 106F5A41ECC305BD

View file

@ -3816,6 +3816,8 @@ void psa_hkdf_extract( int alg, char *hex_ikm_string,
unsigned char *output_prk = NULL;
size_t ikm_len, salt_len, prk_len, output_prk_size, output_prk_len;
PSA_INIT( );
output_prk_size = PSA_HASH_LENGTH( alg );
ASSERT_ALLOC( output_prk, output_prk_size );
@ -3823,7 +3825,6 @@ void psa_hkdf_extract( int alg, char *hex_ikm_string,
salt = mbedtls_test_unhexify_alloc( hex_salt_string, &salt_len );
prk = mbedtls_test_unhexify_alloc( hex_prk_string, &prk_len );
PSA_ASSERT( psa_crypto_init() );
PSA_ASSERT( mbedtls_psa_hkdf_extract( alg, salt, salt_len,
ikm, ikm_len,
output_prk, output_prk_size,
@ -3850,12 +3851,13 @@ void psa_hkdf_extract_ret( int alg, int ret )
unsigned char *prk = NULL;
size_t salt_len, ikm_len, prk_len;
PSA_INIT( );
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( alg, salt, salt_len,
ikm, ikm_len,
prk, PSA_MAC_MAX_SIZE, &prk_len );