diff --git a/programs/test/selftest.c b/programs/test/selftest.c index 0941089779..0a6faa778f 100644 --- a/programs/test/selftest.c +++ b/programs/test/selftest.c @@ -212,10 +212,17 @@ static int run_test_snprintf(void) */ #if defined(MBEDTLS_SELF_TEST) && defined(MBEDTLS_ENTROPY_C) #if defined(MBEDTLS_ENTROPY_NV_SEED) && !defined(MBEDTLS_PLATFORM_GET_ENTROPY_ALT) +static void dummy_entropy(unsigned char *output, size_t output_size) +{ + srand(1); + for (size_t i = 0; i < output_size; i++) { + output[i] = rand(); + } +} + static void create_entropy_seed_file(void) { int result; - size_t output_len = 0; unsigned char seed_value[MBEDTLS_ENTROPY_BLOCK_SIZE]; /* Attempt to read the entropy seed file. If this fails - attempt to write @@ -226,18 +233,7 @@ static void create_entropy_seed_file(void) return; } - result = mbedtls_platform_entropy_poll(NULL, - seed_value, - MBEDTLS_ENTROPY_BLOCK_SIZE, - &output_len); - if (0 != result) { - return; - } - - if (MBEDTLS_ENTROPY_BLOCK_SIZE != output_len) { - return; - } - + dummy_entropy(seed_value, MBEDTLS_ENTROPY_BLOCK_SIZE); mbedtls_platform_std_nv_seed_write(seed_value, MBEDTLS_ENTROPY_BLOCK_SIZE); } #endif