Use MD-light in entropy.c
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
diff --git a/tests/suites/test_suite_entropy.function b/tests/suites/test_suite_entropy.function
index c36d2c8..724542c 100644
--- a/tests/suites/test_suite_entropy.function
+++ b/tests/suites/test_suite_entropy.function
@@ -167,6 +167,8 @@
{
mbedtls_entropy_context ctx;
+ MD_PSA_INIT();
+
mbedtls_entropy_init(&ctx);
TEST_ASSERT(mbedtls_entropy_write_seed_file(&ctx, path) == ret);
@@ -174,6 +176,7 @@
exit:
mbedtls_entropy_free(&ctx);
+ MD_PSA_DONE();
}
/* END_CASE */
@@ -182,6 +185,8 @@
{
mbedtls_entropy_context ctx;
+ MD_PSA_INIT();
+
mbedtls_entropy_init(&ctx);
TEST_ASSERT(mbedtls_entropy_write_seed_file(&ctx, MBEDTLS_PLATFORM_STD_NV_SEED_FILE) == ret);
@@ -189,6 +194,7 @@
exit:
mbedtls_entropy_free(&ctx);
+ MD_PSA_DONE();
}
/* END_CASE */
@@ -243,6 +249,8 @@
unsigned char acc[MBEDTLS_ENTROPY_BLOCK_SIZE + 10] = { 0 };
size_t i, j;
+ MD_PSA_INIT();
+
mbedtls_entropy_init(&ctx);
/*
@@ -267,6 +275,7 @@
exit:
mbedtls_entropy_free(&ctx);
+ MD_PSA_DONE();
}
/* END_CASE */
@@ -277,6 +286,8 @@
unsigned char buf[16];
entropy_dummy_context dummy = { DUMMY_FAIL, 0, 0 };
+ MD_PSA_INIT();
+
mbedtls_entropy_init(&ctx);
TEST_ASSERT(mbedtls_entropy_add_source(&ctx, entropy_dummy_source,
@@ -299,6 +310,7 @@
exit:
mbedtls_entropy_free(&ctx);
+ MD_PSA_DONE();
}
/* END_CASE */
@@ -312,6 +324,8 @@
unsigned char buf[MBEDTLS_ENTROPY_BLOCK_SIZE] = { 0 };
int ret;
+ MD_PSA_INIT();
+
mbedtls_entropy_init(&ctx);
entropy_clear_sources(&ctx);
@@ -340,6 +354,7 @@
exit:
mbedtls_entropy_free(&ctx);
+ MD_PSA_DONE();
}
/* END_CASE */
@@ -359,6 +374,8 @@
unsigned char buf[MBEDTLS_ENTROPY_BLOCK_SIZE] = { 0 };
int ret;
+ MD_PSA_INIT();
+
mbedtls_entropy_init(&ctx);
entropy_clear_sources(&ctx);
@@ -385,6 +402,7 @@
exit:
mbedtls_entropy_free(&ctx);
+ MD_PSA_DONE();
}
/* END_CASE */
@@ -455,6 +473,8 @@
unsigned char check_seed[MBEDTLS_ENTROPY_BLOCK_SIZE];
unsigned char check_entropy[MBEDTLS_ENTROPY_BLOCK_SIZE];
+ MD_PSA_INIT();
+
memset(entropy, 0, MBEDTLS_ENTROPY_BLOCK_SIZE);
memset(buf, 0, MBEDTLS_ENTROPY_BLOCK_SIZE);
memset(empty, 0, MBEDTLS_ENTROPY_BLOCK_SIZE);
@@ -523,12 +543,18 @@
mbedtls_entropy_free(&ctx);
mbedtls_nv_seed_read = original_mbedtls_nv_seed_read;
mbedtls_nv_seed_write = original_mbedtls_nv_seed_write;
+ MD_PSA_DONE();
}
/* END_CASE */
/* BEGIN_CASE depends_on:ENTROPY_HAVE_STRONG:MBEDTLS_SELF_TEST */
void entropy_selftest(int result)
{
+ MD_PSA_INIT();
+
TEST_ASSERT(mbedtls_entropy_self_test(1) == result);
+
+exit:
+ MD_PSA_DONE();
}
/* END_CASE */
diff --git a/tests/suites/test_suite_psa_crypto_init.function b/tests/suites/test_suite_psa_crypto_init.function
index f0b98e7..6e1305e 100644
--- a/tests/suites/test_suite_psa_crypto_init.function
+++ b/tests/suites/test_suite_psa_crypto_init.function
@@ -74,11 +74,7 @@
#endif
ctx->accumulator_started = 0;
-#if defined(MBEDTLS_ENTROPY_SHA512_ACCUMULATOR)
- mbedtls_sha512_init(&ctx->accumulator);
-#else
- mbedtls_sha256_init(&ctx->accumulator);
-#endif
+ mbedtls_md_init(&ctx->accumulator);
#if !defined(MBEDTLS_NO_PLATFORM_ENTROPY)
if (custom_entropy_sources_mask & ENTROPY_SOURCE_PLATFORM) {