From 4feb15c76a29b63b672f5fc1cea43ab9cc13dcfb Mon Sep 17 00:00:00 2001 From: Jaeden Amero Date: Tue, 28 May 2019 10:54:22 +0100 Subject: [PATCH] mbed-crypto: Automatically enable entropy injection Automatically enable entropy injection when the NV Seed feature is requested on PSA targets. Add a warning note describing the state of the current implementation of the entropy injection API. Fixes #10720 --- features/mbedtls/platform/inc/platform_mbed.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/features/mbedtls/platform/inc/platform_mbed.h b/features/mbedtls/platform/inc/platform_mbed.h index 64179268b4..9b790e823a 100644 --- a/features/mbedtls/platform/inc/platform_mbed.h +++ b/features/mbedtls/platform/inc/platform_mbed.h @@ -33,6 +33,14 @@ #define MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO mbed_default_seed_write #endif +/* Automatically enable the Mbed Crypto entropy injection API if + * MBEDTLS_ENTROPY_NV_SEED is enabled. WARNING: the current implementation of + * the Mbed Crypto entropy injection API is incompatible with other entropy + * sources. When MBEDTLS_ENTROPY_NV_SEED is used on PSA target, the NV Seed is + * the sole source of entropy and all other entropy sources are ignored. */ +#define MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES +#define MBEDTLS_PSA_INJECT_ENTROPY + #endif // (defined(TARGET_PSA) && defined(MBEDTLS_ENTROPY_NV_SEED)) #if DEVICE_TRNG