diff --git a/library/entropy.c b/library/entropy.c index c6f44df3b2..edd5721ad2 100644 --- a/library/entropy.c +++ b/library/entropy.c @@ -61,6 +61,9 @@ void entropy_init( entropy_context *ctx ) { memset( ctx, 0, sizeof(entropy_context) ); + /* Reminder: Update ENTROPY_HAVE_DEFAULT in the test files + * when adding more strong entropy sources here. */ + #if defined(POLARSSL_THREADING_C) polarssl_mutex_init( &ctx->mutex ); #endif diff --git a/tests/suites/helpers.function b/tests/suites/helpers.function index 0f074859cf..ddc29f6022 100644 --- a/tests/suites/helpers.function +++ b/tests/suites/helpers.function @@ -53,6 +53,17 @@ 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(POLARSSL_NO_DEFAULT_ENTROPY_SOURCES) && \ + ( !defined(POLARSSL_NO_PLATFORM_ENTROPY) || \ + defined(POLARSSL_HAVEGE_C) || \ + defined(POLARSSL_TIMING_C) ) +#define ENTROPY_HAVE_DEFAULT +#endif + static int unhexify( unsigned char *obuf, const char *ibuf ) { unsigned char c, c2; @@ -212,7 +223,7 @@ typedef struct * This function returns random based on a buffer it receives. * * rng_state shall be a pointer to a rnd_buf_info structure. - * + * * The number of bytes released from the buffer on each call to * the random function is specified by per_call. (Can be between * 1 and 4)