PK: fix test failures
Introduce MD_OR_USE_PSA_INIT/DONE. This will likely be used everywhere
in X.509 and SSL/TLS, but most places in PK only need USE_PSA_INIT/DONE.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
diff --git a/tests/suites/test_suite_pk.function b/tests/suites/test_suite_pk.function
index 741d3cd..db49f5d 100644
--- a/tests/suites/test_suite_pk.function
+++ b/tests/suites/test_suite_pk.function
@@ -576,7 +576,7 @@
void *options;
int ret;
- USE_PSA_INIT();
+ MD_OR_USE_PSA_INIT();
mbedtls_pk_init(&pk);
TEST_ASSERT(mbedtls_pk_setup(&pk, mbedtls_pk_info_from_type(MBEDTLS_PK_RSA)) == 0);
@@ -620,7 +620,7 @@
exit:
mbedtls_pk_free(&pk);
- USE_PSA_DONE();
+ MD_OR_USE_PSA_DONE();
}
/* END_CASE */
diff --git a/tests/suites/test_suite_pkparse.function b/tests/suites/test_suite_pkparse.function
index 0856f3f..0a275b5 100644
--- a/tests/suites/test_suite_pkparse.function
+++ b/tests/suites/test_suite_pkparse.function
@@ -18,7 +18,8 @@
int res;
char *pwd = password;
- PSA_INIT_IF_NO_MD();
+ MD_PSA_INIT();
+
mbedtls_pk_init(&ctx);
if (strcmp(pwd, "NULL") == 0) {
@@ -39,8 +40,9 @@
exit:
mbedtls_pk_free(&ctx);
- PSA_DONE_IF_NO_MD();
+ MD_PSA_DONE();
}
+
/* END_CASE */
/* BEGIN_CASE depends_on:MBEDTLS_RSA_C:MBEDTLS_FS_IO */
@@ -49,7 +51,8 @@
mbedtls_pk_context ctx;
int res;
- PSA_INIT_IF_NO_MD();
+ MD_PSA_INIT();
+
mbedtls_pk_init(&ctx);
res = mbedtls_pk_parse_public_keyfile(&ctx, key_file);
@@ -65,7 +68,7 @@
exit:
mbedtls_pk_free(&ctx);
- PSA_DONE_IF_NO_MD();
+ MD_PSA_DONE();
}
/* END_CASE */