diff --git a/tests/suites/test_suite_entropy.data b/tests/suites/test_suite_entropy.data index 514fced49e..eff261401d 100644 --- a/tests/suites/test_suite_entropy.data +++ b/tests/suites/test_suite_entropy.data @@ -4,6 +4,9 @@ entropy_init_free:0 Entropy init-free-init-free entropy_init_free:1 +Entropy: count default sources +entropy_count_sources: + Create NV seed_file nv_seed_file_create: diff --git a/tests/suites/test_suite_entropy.function b/tests/suites/test_suite_entropy.function index a4f3b1bd7c..0e719f6f06 100644 --- a/tests/suites/test_suite_entropy.function +++ b/tests/suites/test_suite_entropy.function @@ -171,6 +171,29 @@ void entropy_init_free(int reinit) } /* END_CASE */ +/* BEGIN_CASE */ +void entropy_count_sources() +{ + mbedtls_entropy_context ctx; + mbedtls_entropy_init(&ctx); + +#if defined(MBEDTLS_ENTROPY_HAVE_SOURCES) + TEST_EQUAL(MBEDTLS_ENTROPY_HAVE_SOURCES, ctx.source_count); +#else + TEST_EQUAL(0, ctx.source_count); +#endif + +#if defined(MBEDTLS_ENTROPY_NV_SEED) + TEST_EQUAL(MBEDTLS_ENTROPY_TRUE_SOURCES + 1, ctx.source_count); +#else + TEST_EQUAL(MBEDTLS_ENTROPY_TRUE_SOURCES, ctx.source_count); +#endif + +exit: + mbedtls_entropy_free(&ctx); +} +/* END_CASE */ + /* BEGIN_CASE depends_on:MBEDTLS_ENTROPY_NV_SEED:MBEDTLS_FS_IO */ void entropy_seed_file(char *path, int ret) {