From ae679390a20d8fbd0a32b7b70f4e569d89939c4a Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Mon, 25 Nov 2019 18:26:23 +0100 Subject: [PATCH] Fix entropy_calls when MBEDTLS_ENTROPY_NV_SEED is enabled --- tests/suites/test_suite_entropy.function | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/suites/test_suite_entropy.function b/tests/suites/test_suite_entropy.function index d1d88c5fa..1a4fefde3 100644 --- a/tests/suites/test_suite_entropy.function +++ b/tests/suites/test_suite_entropy.function @@ -271,7 +271,8 @@ void entropy_threshold( int threshold, int chunk_size, int result ) { TEST_ASSERT( ret == 0 ); #if defined(MBEDTLS_ENTROPY_NV_SEED) - // Two times as much calls due to the NV seed update + /* If the NV seed functionality is enabled, there are two entropy + * updates: before and after updating the NV seed. */ result *= 2; #endif TEST_ASSERT( dummy.calls == (size_t) result ); @@ -317,6 +318,11 @@ void entropy_calls( int strength1, int strength2, if( result >= 0 ) { TEST_ASSERT( ret == 0 ); +#if defined(MBEDTLS_ENTROPY_NV_SEED) + /* If the NV seed functionality is enabled, there are two entropy + * updates: before and after updating the NV seed. */ + result *= 2; +#endif TEST_ASSERT( dummy1.calls == (size_t) result ); } else