Add internal macro ENTROPY_HAVE_STRONG indicating strong entropy

This commit adds the macro ENTROPY_HAVE_STRONG to the helper test file tests/suites/helpers.function to be able to make
tests depend on the presence of strong entropy.
This commit is contained in:
Hanno Becker 2017-09-08 10:06:41 +01:00
parent 276d530abe
commit 66580d284d
2 changed files with 15 additions and 0 deletions

View File

@ -60,6 +60,9 @@ void mbedtls_entropy_init( mbedtls_entropy_context *ctx )
{ {
memset( ctx, 0, sizeof(mbedtls_entropy_context) ); 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) #if defined(MBEDTLS_THREADING_C)
mbedtls_mutex_init( &ctx->mutex ); mbedtls_mutex_init( &ctx->mutex );
#endif #endif

View File

@ -55,6 +55,18 @@ typedef UINT32 uint32_t;
} }
#endif #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 ) static int unhexify( unsigned char *obuf, const char *ibuf )
{ {
unsigned char c, c2; unsigned char c, c2;