Setup / deinitialize PSA in pk tests only if no MD is used
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
diff --git a/tests/suites/test_suite_pkcs5.function b/tests/suites/test_suite_pkcs5.function
index e2347cc..fcbf9b1 100644
--- a/tests/suites/test_suite_pkcs5.function
+++ b/tests/suites/test_suite_pkcs5.function
@@ -14,14 +14,14 @@
{
unsigned char key[100];
- PSA_INIT();
+ PSA_INIT_IF_NO_MD();
TEST_ASSERT( mbedtls_pkcs5_pbkdf2_hmac_ext( hash, pw_str->x, pw_str->len,
salt_str->x, salt_str->len,
it_cnt, key_len, key ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( key, result_key_string->x,
key_len, result_key_string->len ) == 0 );
- PSA_DONE();
+ PSA_DONE_IF_NO_MD();
}
/* END_CASE */
@@ -33,7 +33,7 @@
mbedtls_asn1_buf params;
unsigned char *my_out = NULL;
- PSA_INIT();
+ PSA_INIT_IF_NO_MD();
params.tag = params_tag;
params.p = params_hex->x;
@@ -50,7 +50,7 @@
exit:
mbedtls_free( my_out );
- PSA_DONE();
+ PSA_DONE_IF_NO_MD();
}
/* END_CASE */
diff --git a/tests/suites/test_suite_pkparse.function b/tests/suites/test_suite_pkparse.function
index 1e003b9..8ca3aca 100644
--- a/tests/suites/test_suite_pkparse.function
+++ b/tests/suites/test_suite_pkparse.function
@@ -17,7 +17,7 @@
int res;
char *pwd = password;
- PSA_INIT();
+ PSA_INIT_IF_NO_MD();
mbedtls_pk_init( &ctx );
if( strcmp( pwd, "NULL" ) == 0 )
@@ -38,7 +38,7 @@
exit:
mbedtls_pk_free( &ctx );
- PSA_DONE();
+ PSA_DONE_IF_NO_MD();
}
/* END_CASE */
@@ -48,7 +48,7 @@
mbedtls_pk_context ctx;
int res;
- PSA_INIT();
+ PSA_INIT_IF_NO_MD();
mbedtls_pk_init( &ctx );
res = mbedtls_pk_parse_public_keyfile( &ctx, key_file );
@@ -65,7 +65,7 @@
exit:
mbedtls_pk_free( &ctx );
- PSA_DONE();
+ PSA_DONE_IF_NO_MD();
}
/* END_CASE */