X.509: fix test failures
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
diff --git a/tests/suites/test_suite_pkcs7.function b/tests/suites/test_suite_pkcs7.function
index cc032ac..016714b 100644
--- a/tests/suites/test_suite_pkcs7.function
+++ b/tests/suites/test_suite_pkcs7.function
@@ -75,6 +75,7 @@
mbedtls_pkcs7 pkcs7;
mbedtls_x509_crt **crts = NULL;
+ MD_OR_USE_PSA_INIT();
/* crt_files are space seprated list */
for (i = 0; i < strlen(crt_files); i++) {
@@ -104,8 +105,6 @@
mbedtls_x509_crt_init(crts[i]);
}
- USE_PSA_INIT();
-
res = mbedtls_pk_load_file(pkcs7_file, &pkcs7_buf, &buflen);
TEST_EQUAL(res, 0);
@@ -164,6 +163,6 @@
mbedtls_free(crts);
mbedtls_free(data);
mbedtls_free(pkcs7_buf);
- USE_PSA_DONE();
+ MD_OR_USE_PSA_DONE();
}
/* END_CASE */
diff --git a/tests/suites/test_suite_x509parse.function b/tests/suites/test_suite_x509parse.function
index f6e4a06..f347374 100644
--- a/tests/suites/test_suite_x509parse.function
+++ b/tests/suites/test_suite_x509parse.function
@@ -592,7 +592,7 @@
mbedtls_x509_crt_init(&crt);
mbedtls_x509_crt_init(&ca);
- USE_PSA_INIT();
+ MD_OR_USE_PSA_INIT();
TEST_ASSERT(mbedtls_x509_crt_parse_file(&crt, crt_file) == 0);
TEST_ASSERT(mbedtls_x509_crt_parse_file(&ca, ca_file) == 0);
@@ -622,7 +622,7 @@
mbedtls_x509_crt_restart_free(&rs_ctx);
mbedtls_x509_crt_free(&crt);
mbedtls_x509_crt_free(&ca);
- USE_PSA_DONE();
+ MD_OR_USE_PSA_DONE();
}
/* END_CASE */
@@ -645,7 +645,7 @@
mbedtls_x509_crt_init(&ca);
mbedtls_x509_crl_init(&crl);
- USE_PSA_INIT();
+ MD_OR_USE_PSA_INIT();
if (strcmp(cn_name_str, "NULL") != 0) {
cn_name = cn_name_str;
@@ -714,7 +714,7 @@
mbedtls_x509_crt_free(&crt);
mbedtls_x509_crt_free(&ca);
mbedtls_x509_crl_free(&crl);
- USE_PSA_DONE();
+ MD_OR_USE_PSA_DONE();
}
/* END_CASE */
@@ -763,7 +763,7 @@
mbedtls_x509_crt_init(&ca);
verify_print_init(&vrfy_ctx);
- USE_PSA_INIT();
+ MD_OR_USE_PSA_INIT();
TEST_ASSERT(mbedtls_x509_crt_parse_file(&crt, crt_file) == 0);
TEST_ASSERT(mbedtls_x509_crt_parse_file(&ca, ca_file) == 0);
@@ -783,7 +783,7 @@
exit:
mbedtls_x509_crt_free(&crt);
mbedtls_x509_crt_free(&ca);
- USE_PSA_DONE();
+ MD_OR_USE_PSA_DONE();
}
/* END_CASE */
@@ -1246,7 +1246,7 @@
mbedtls_x509_crt_init(&trusted);
mbedtls_x509_crt_init(&chain);
- USE_PSA_INIT();
+ MD_OR_USE_PSA_INIT();
/* Load trusted root */
TEST_ASSERT(mbedtls_x509_crt_parse_file(&trusted, ca_file) == 0);
@@ -1267,7 +1267,7 @@
exit:
mbedtls_x509_crt_free(&chain);
mbedtls_x509_crt_free(&trusted);
- USE_PSA_DONE();
+ MD_OR_USE_PSA_DONE();
}
/* END_CASE */
@@ -1285,7 +1285,7 @@
mbedtls_x509_crt_init(&chain);
mbedtls_x509_crt_init(&trusted);
- USE_PSA_INIT();
+ MD_OR_USE_PSA_INIT();
while ((act = mystrsep(&chain_paths, " ")) != NULL) {
TEST_ASSERT(mbedtls_x509_crt_parse_file(&chain, act) == 0);
@@ -1313,7 +1313,7 @@
exit:
mbedtls_x509_crt_free(&trusted);
mbedtls_x509_crt_free(&chain);
- USE_PSA_DONE();
+ MD_OR_USE_PSA_DONE();
}
/* END_CASE */
diff --git a/tests/suites/test_suite_x509write.function b/tests/suites/test_suite_x509write.function
index 8eab95a..798863e 100644
--- a/tests/suites/test_suite_x509write.function
+++ b/tests/suites/test_suite_x509write.function
@@ -178,7 +178,7 @@
mbedtls_x509write_csr_init(&req);
- USE_PSA_INIT();
+ MD_OR_USE_PSA_INIT();
mbedtls_pk_init(&key);
TEST_ASSERT(mbedtls_pk_parse_keyfile(&key, key_file, NULL,
@@ -249,7 +249,7 @@
exit:
mbedtls_x509write_csr_free(&req);
mbedtls_pk_free(&key);
- USE_PSA_DONE();
+ MD_OR_USE_PSA_DONE();
}
/* END_CASE */
@@ -271,7 +271,7 @@
mbedtls_x509write_csr_init(&req);
- USE_PSA_INIT();
+ MD_OR_USE_PSA_INIT();
md_alg_psa = mbedtls_hash_info_psa_from_md((mbedtls_md_type_t) md_type);
TEST_ASSERT(md_alg_psa != MBEDTLS_MD_NONE);
@@ -357,7 +357,7 @@
mbedtls_mpi_init(&serial_mpi);
#endif
- USE_PSA_INIT();
+ MD_OR_USE_PSA_INIT();
mbedtls_pk_init(&subject_key);
mbedtls_pk_init(&issuer_key);
@@ -588,7 +588,7 @@
#if defined(MBEDTLS_USE_PSA_CRYPTO)
psa_destroy_key(key_id);
#endif
- USE_PSA_DONE();
+ MD_OR_USE_PSA_DONE();
}
/* END_CASE */