From 73bd210a946e3325272494cf2b977d0acaa83c90 Mon Sep 17 00:00:00 2001 From: Valerio Setti Date: Tue, 15 Apr 2025 08:56:51 +0200 Subject: [PATCH] tests: remove usage of MBEDTLS_NO_PLATFORM_ENTROPY Use MBEDTLS_PLATFORM_GET_ENTROPY_ALT instead. Signed-off-by: Valerio Setti --- programs/test/selftest.c | 4 ++-- scripts/config.py | 3 +-- scripts/footprint.sh | 2 +- tests/scripts/analyze_outcomes.py | 1 - tests/scripts/components-configuration-platform.sh | 5 +---- 5 files changed, 5 insertions(+), 10 deletions(-) diff --git a/programs/test/selftest.c b/programs/test/selftest.c index 546716f12d..0941089779 100644 --- a/programs/test/selftest.c +++ b/programs/test/selftest.c @@ -211,7 +211,7 @@ static int run_test_snprintf(void) * back. */ #if defined(MBEDTLS_SELF_TEST) && defined(MBEDTLS_ENTROPY_C) -#if defined(MBEDTLS_ENTROPY_NV_SEED) && !defined(MBEDTLS_NO_PLATFORM_ENTROPY) +#if defined(MBEDTLS_ENTROPY_NV_SEED) && !defined(MBEDTLS_PLATFORM_GET_ENTROPY_ALT) static void create_entropy_seed_file(void) { int result; @@ -244,7 +244,7 @@ static void create_entropy_seed_file(void) static int mbedtls_entropy_self_test_wrapper(int verbose) { -#if defined(MBEDTLS_ENTROPY_NV_SEED) && !defined(MBEDTLS_NO_PLATFORM_ENTROPY) +#if defined(MBEDTLS_ENTROPY_NV_SEED) && !defined(MBEDTLS_PLATFORM_GET_ENTROPY_ALT) create_entropy_seed_file(); #endif return mbedtls_entropy_self_test(verbose); diff --git a/scripts/config.py b/scripts/config.py index 6b30c54c70..e5182a6a59 100755 --- a/scripts/config.py +++ b/scripts/config.py @@ -88,7 +88,6 @@ EXCLUDE_FROM_FULL = frozenset([ 'MBEDTLS_MEMORY_DEBUG', # depends on MEMORY_BUFFER_ALLOC_C 'MBEDTLS_NO_64BIT_MULTIPLICATION', # influences anything that uses bignum 'MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES', # removes a feature - 'MBEDTLS_NO_PLATFORM_ENTROPY', # removes a feature 'MBEDTLS_NO_UDBL_DIVISION', # influences anything that uses bignum 'MBEDTLS_PSA_P256M_DRIVER_ENABLED', # influences SECP256R1 KeyGen/ECDH/ECDSA 'MBEDTLS_PLATFORM_NO_STD_FUNCTIONS', # removes a feature @@ -182,7 +181,7 @@ def baremetal_adapter(name, value, active): """Config adapter for "baremetal".""" if not is_boolean_setting(name, value): return active - if name == 'MBEDTLS_NO_PLATFORM_ENTROPY': + if name == 'MBEDTLS_PLATFORM_GET_ENTROPY_ALT': # No OS-provided entropy source return True return include_in_full(name) and keep_in_baremetal(name) diff --git a/scripts/footprint.sh b/scripts/footprint.sh index 614a493098..e45a9265ac 100755 --- a/scripts/footprint.sh +++ b/scripts/footprint.sh @@ -64,7 +64,7 @@ doit() scripts/config.py unset MBEDTLS_NET_C || true scripts/config.py unset MBEDTLS_TIMING_C || true scripts/config.py unset MBEDTLS_FS_IO || true - scripts/config.py --force set MBEDTLS_NO_PLATFORM_ENTROPY || true + scripts/config.py --force set MBEDTLS_PLATFORM_GET_ENTROPY_ALT || true } >/dev/null 2>&1 make clean >/dev/null diff --git a/tests/scripts/analyze_outcomes.py b/tests/scripts/analyze_outcomes.py index c7c9ed5810..429a04f7f5 100755 --- a/tests/scripts/analyze_outcomes.py +++ b/tests/scripts/analyze_outcomes.py @@ -121,7 +121,6 @@ class CoverageTask(outcome_analysis.CoverageTask): # Obsolete configuration options, to be replaced by # PSA entropy drivers. # https://github.com/Mbed-TLS/mbedtls/issues/8150 - 'Config: MBEDTLS_NO_PLATFORM_ENTROPY', 'Config: MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES', # Untested aspect of the platform interface. # https://github.com/Mbed-TLS/mbedtls/issues/9589 diff --git a/tests/scripts/components-configuration-platform.sh b/tests/scripts/components-configuration-platform.sh index bebd860511..cadd14061c 100644 --- a/tests/scripts/components-configuration-platform.sh +++ b/tests/scripts/components-configuration-platform.sh @@ -26,7 +26,7 @@ component_build_no_sockets () { msg "build: full config except net_sockets.c, make, gcc -std=c99 -pedantic" # ~ 30s scripts/config.py full scripts/config.py unset MBEDTLS_NET_C # getaddrinfo() undeclared, etc. - scripts/config.py set MBEDTLS_NO_PLATFORM_ENTROPY # uses syscall() on GNU/Linux + scripts/config.py set MBEDTLS_PLATFORM_GET_ENTROPY_ALT # prevent syscall() on GNU/Linux make CC=gcc CFLAGS='-Werror -Wall -Wextra -O1 -std=c99 -pedantic' lib } @@ -106,6 +106,3 @@ component_test_no_64bit_multiplication () { msg "test: MBEDTLS_NO_64BIT_MULTIPLICATION native" # ~ 10s make test } - - -