Add internal macro ENTROPY_HAVE_DEFAULT indicating default entropy
This commit adds the macro ENTROPY_HAVE_DEFAULT to the helper test file tests/suites/helpers.function to be able to make
tests depend on the presence of a default entropy source.
diff --git a/library/entropy.c b/library/entropy.c
index c6f44df..edd5721 100644
--- a/library/entropy.c
+++ b/library/entropy.c
@@ -61,6 +61,9 @@
{
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 0f07485..ddc29f6 100644
--- a/tests/suites/helpers.function
+++ b/tests/suites/helpers.function
@@ -53,6 +53,17 @@
}
#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 @@
* 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)