diff --git a/library/entropy.c b/library/entropy.c index 3622ad2802..b45384dbe4 100644 --- a/library/entropy.c +++ b/library/entropy.c @@ -60,6 +60,9 @@ void mbedtls_entropy_init( mbedtls_entropy_context *ctx ) { memset( ctx, 0, sizeof(mbedtls_entropy_context) ); + /* Reminder: Update ENTROPY_HAVE_STRONG in the test files + * when adding more strong entropy sources here. */ + #if defined(MBEDTLS_THREADING_C) mbedtls_mutex_init( &ctx->mutex ); #endif diff --git a/tests/suites/helpers.function b/tests/suites/helpers.function index 6af918cad5..b80831ee50 100644 --- a/tests/suites/helpers.function +++ b/tests/suites/helpers.function @@ -55,6 +55,18 @@ typedef UINT32 uint32_t; } #endif +/* Helper flags for complex dependencies */ + +/* Indicates whether we expect mbedtls_entropy_init + * to initialize some strong entropy source. */ +#if defined(MBEDTLS_TEST_NULL_ENTROPY) || \ + ( !defined(MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES) && \ + ( !defined(MBEDTLS_NO_PLATFORM_ENTROPY) || \ + defined(MBEDTLS_HAVEGE_C) || \ + defined(MBEDTLS_ENTROPY_HARDWARE_ALT) ) ) +#define ENTROPY_HAVE_STRONG +#endif + static int unhexify( unsigned char *obuf, const char *ibuf ) { unsigned char c, c2;