From 0a8f87f5eb70276d80ff5da0dd06a5dac24374ab Mon Sep 17 00:00:00 2001 From: Arto Kinnunen Date: Tue, 7 Jan 2020 13:15:40 +0200 Subject: [PATCH] Remove entropy source overwrite in baremetal_test -Do not overwrite MBEDTLS_ENTROPY_MAX_SOURCES in baremetal_test.h -Skip tests that are not suitable for low number of entropy sources --- configs/baremetal_test.h | 3 --- tests/suites/helpers.function | 6 ++++++ tests/suites/test_suite_entropy.function | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/configs/baremetal_test.h b/configs/baremetal_test.h index 7a0377708..97c64252e 100644 --- a/configs/baremetal_test.h +++ b/configs/baremetal_test.h @@ -48,7 +48,4 @@ #undef MBEDTLS_NO_PLATFORM_ENTROPY -#undef MBEDTLS_ENTROPY_MAX_SOURCES -#define MBEDTLS_ENTROPY_MAX_SOURCES 3 - #endif /* MBEDTLS_BAREMETAL_USER_CONFIG_H */ diff --git a/tests/suites/helpers.function b/tests/suites/helpers.function index 43426f5ae..4b53da7ba 100644 --- a/tests/suites/helpers.function +++ b/tests/suites/helpers.function @@ -32,6 +32,8 @@ #include "tinycrypt/ecc.h" #endif /* MBEDTLS_USE_TINYCRYPT */ +#include "mbedtls/entropy.h" + #ifdef _MSC_VER #include typedef UINT8 uint8_t; @@ -300,6 +302,10 @@ jmp_buf jmp_tmp; #define ENTROPY_HAVE_STRONG #endif +/* Set flag if number of entropy sources is more than 2 */ +#if ( MBEDTLS_ENTROPY_MAX_SOURCES > 2 ) +#define ENTROPY_SOURCE_COUNT_MORE_THAN_TWO +#endif /*----------------------------------------------------------------------------*/ /* Helper Functions */ diff --git a/tests/suites/test_suite_entropy.function b/tests/suites/test_suite_entropy.function index cf197323b..044297324 100644 --- a/tests/suites/test_suite_entropy.function +++ b/tests/suites/test_suite_entropy.function @@ -193,7 +193,7 @@ void entropy_func_len( int len, int ret ) } /* END_CASE */ -/* BEGIN_CASE */ +/* BEGIN_CASE depends_on:ENTROPY_SOURCE_COUNT_MORE_THAN_TWO */ void entropy_source_fail( char * path ) { mbedtls_entropy_context ctx; @@ -225,7 +225,7 @@ exit: } /* END_CASE */ -/* BEGIN_CASE depends_on:ENTROPY_HAVE_STRONG */ +/* BEGIN_CASE depends_on:ENTROPY_HAVE_STRONG:ENTROPY_SOURCE_COUNT_MORE_THAN_TWO */ void entropy_threshold( int threshold, int chunk_size, int result ) { mbedtls_entropy_context ctx;