mbedtls: MBEDTLS_ENTROPY_POLL_ZEPHYR default on if MBEDTLS_ENTROPY_C
As long as MBEDTLS_ENTROPY_C is enabled, Mbed TLS needs to
poll some entropy source to gather data that will then be
processed by CTR/HMAC-DRBG modules. This means that in most
of the cases, once MBEDTLS_ENTROPY_C is enabled then also
MBEDTLS_ENTROPY_POLL_ZEPHYR needs to be enabled. This was
done manually until now, as the long list of samples/tests
demonstrate.
This commit solves this dependency by defaulting
MBEDTLS_ENTROPY_POLL_ZEPHYR to on as soon as
MBEDTLS_ENTROPY_C is set. As a consequence, all manual
enablement of MBEDTLS_ENTROPY_POLL_ZEPHYR in samples/tests
are removed.
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
diff --git a/drivers/bluetooth/hci/Kconfig b/drivers/bluetooth/hci/Kconfig
index e15ba3b..d2a68ae 100644
--- a/drivers/bluetooth/hci/Kconfig
+++ b/drivers/bluetooth/hci/Kconfig
@@ -112,7 +112,6 @@
select MBEDTLS
select MBEDTLS_PSA_CRYPTO_C
select MBEDTLS_ENTROPY_C
- select MBEDTLS_ENTROPY_POLL_ZEPHYR
help
Use Silicon Labs binary Bluetooth library to connect to the
controller.
diff --git a/drivers/wifi/esp32/Kconfig.esp32 b/drivers/wifi/esp32/Kconfig.esp32
index 6732bd5..0da3e58 100644
--- a/drivers/wifi/esp32/Kconfig.esp32
+++ b/drivers/wifi/esp32/Kconfig.esp32
@@ -377,7 +377,6 @@
select MBEDTLS_CIPHER_MODE_CTR_ENABLED
select MBEDTLS_CMAC
select MBEDTLS_ENTROPY_C
- select MBEDTLS_ENTROPY_POLL_ZEPHYR
help
Select this option to use MbedTLS crypto APIs which utilize hardware acceleration.
diff --git a/modules/mbedtls/Kconfig.tls-generic b/modules/mbedtls/Kconfig.tls-generic
index 2e6e6b7..779d3b3 100644
--- a/modules/mbedtls/Kconfig.tls-generic
+++ b/modules/mbedtls/Kconfig.tls-generic
@@ -398,6 +398,7 @@
config MBEDTLS_ENTROPY_POLL_ZEPHYR
bool "Provide entropy data to Mbed TLS through entropy driver or random generator"
+ default y
depends on MBEDTLS_ENTROPY_C
help
Provide entropy data to the Mbed TLS's entropy module through either
diff --git a/samples/net/wifi/shell/boards/frdm_rw612.conf b/samples/net/wifi/shell/boards/frdm_rw612.conf
index 87de6bc..e9ba4d7 100644
--- a/samples/net/wifi/shell/boards/frdm_rw612.conf
+++ b/samples/net/wifi/shell/boards/frdm_rw612.conf
@@ -103,7 +103,6 @@
CONFIG_ENTROPY_GENERATOR=y
CONFIG_MBEDTLS_PSA_CRYPTO_C=y
CONFIG_MBEDTLS_ENTROPY_C=y
-CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR=y
CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN=8192
# power management
diff --git a/samples/net/wifi/shell/boards/rd_rw612_bga.conf b/samples/net/wifi/shell/boards/rd_rw612_bga.conf
index 633137e..5ecd5b4 100644
--- a/samples/net/wifi/shell/boards/rd_rw612_bga.conf
+++ b/samples/net/wifi/shell/boards/rd_rw612_bga.conf
@@ -102,7 +102,6 @@
CONFIG_ENTROPY_GENERATOR=y
CONFIG_MBEDTLS_PSA_CRYPTO_C=y
CONFIG_MBEDTLS_ENTROPY_C=y
-CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR=y
CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN=8192
# power management
diff --git a/samples/psa/its/overlay-entropy_not_secure.conf b/samples/psa/its/overlay-entropy_not_secure.conf
index 2aba3a2..f2ab177 100644
--- a/samples/psa/its/overlay-entropy_not_secure.conf
+++ b/samples/psa/its/overlay-entropy_not_secure.conf
@@ -2,4 +2,3 @@
CONFIG_TEST_RANDOM_GENERATOR=y
CONFIG_TIMER_RANDOM_GENERATOR=y
-CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR=y
diff --git a/samples/psa/persistent_key/overlay-entropy_not_secure.conf b/samples/psa/persistent_key/overlay-entropy_not_secure.conf
index 2aba3a2..f2ab177 100644
--- a/samples/psa/persistent_key/overlay-entropy_not_secure.conf
+++ b/samples/psa/persistent_key/overlay-entropy_not_secure.conf
@@ -2,4 +2,3 @@
CONFIG_TEST_RANDOM_GENERATOR=y
CONFIG_TIMER_RANDOM_GENERATOR=y
-CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR=y
diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig
index 530f3a4..4731d1c 100644
--- a/subsys/bluetooth/mesh/Kconfig
+++ b/subsys/bluetooth/mesh/Kconfig
@@ -1476,7 +1476,6 @@
select EXPERIMENTAL
select MBEDTLS
select MBEDTLS_ENTROPY_C
- select MBEDTLS_ENTROPY_POLL_ZEPHYR
select MBEDTLS_PSA_CRYPTO_C
select MBEDTLS_USE_PSA_CRYPTO
select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT
diff --git a/tests/modules/uoscore/prj.conf b/tests/modules/uoscore/prj.conf
index f661156..d86ae83 100644
--- a/tests/modules/uoscore/prj.conf
+++ b/tests/modules/uoscore/prj.conf
@@ -13,7 +13,6 @@
CONFIG_MBEDTLS_ENABLE_HEAP=y
CONFIG_MBEDTLS_HEAP_SIZE=2048
CONFIG_MBEDTLS_ENTROPY_C=y
-CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR=y
# PSA Crypto options
diff --git a/tests/subsys/secure_storage/psa/crypto/overlay-secure_storage.conf b/tests/subsys/secure_storage/psa/crypto/overlay-secure_storage.conf
index 84d933c..063c04f 100644
--- a/tests/subsys/secure_storage/psa/crypto/overlay-secure_storage.conf
+++ b/tests/subsys/secure_storage/psa/crypto/overlay-secure_storage.conf
@@ -4,7 +4,6 @@
CONFIG_MBEDTLS=y
CONFIG_TEST_RANDOM_GENERATOR=y
CONFIG_TIMER_RANDOM_GENERATOR=y
-CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR=y
CONFIG_MBEDTLS_PSA_CRYPTO_C=y
CONFIG_SECURE_STORAGE=y
diff --git a/tests/subsys/secure_storage/psa/its/overlay-default_transform.conf b/tests/subsys/secure_storage/psa/its/overlay-default_transform.conf
index 52751db..2f49f5d 100644
--- a/tests/subsys/secure_storage/psa/its/overlay-default_transform.conf
+++ b/tests/subsys/secure_storage/psa/its/overlay-default_transform.conf
@@ -1,7 +1,6 @@
CONFIG_MBEDTLS=y
CONFIG_TEST_RANDOM_GENERATOR=y
CONFIG_TIMER_RANDOM_GENERATOR=y
-CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR=y
CONFIG_MBEDTLS_PSA_CRYPTO_C=y
# SETTINGS_MAX_VAL_LEN (256) - flags (1) - CONFIG_SECURE_STORAGE_ITS_TRANSFORM_OUTPUT_OVERHEAD (28)
diff --git a/tests/subsys/storage/flash_map/overlay-psa.conf b/tests/subsys/storage/flash_map/overlay-psa.conf
index 4b5dcfd..e70359a 100644
--- a/tests/subsys/storage/flash_map/overlay-psa.conf
+++ b/tests/subsys/storage/flash_map/overlay-psa.conf
@@ -1,3 +1,4 @@
CONFIG_FLASH_AREA_CHECK_INTEGRITY_PSA=y
CONFIG_MBEDTLS=y
CONFIG_MBEDTLS_PSA_CRYPTO_C=y
+CONFIG_TEST_RANDOM_GENERATOR=y