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.
This commit is contained in:
Hanno Becker 2017-09-08 10:53:30 +01:00
parent cffe2daf25
commit adb9bd23d9
2 changed files with 15 additions and 1 deletions

View file

@ -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

View file

@ -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)