Skip to content

Commit

Permalink
mbedtls: MBEDTLS_ENTROPY_POLL_ZEPHYR default on if MBEDTLS_ENTROPY_C
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
valeriosetti committed Nov 6, 2024
1 parent 599da8c commit b89fce8
Show file tree
Hide file tree
Showing 12 changed files with 2 additions and 10 deletions.
1 change: 0 additions & 1 deletion drivers/bluetooth/hci/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ config BT_SILABS_EFR32
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.
Expand Down
1 change: 0 additions & 1 deletion drivers/wifi/esp32/Kconfig.esp32
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,6 @@ config ESP32_WIFI_MBEDTLS_CRYPTO
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.

Expand Down
1 change: 1 addition & 0 deletions modules/mbedtls/Kconfig.tls-generic
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ config MBEDTLS_ENTROPY_C

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
Expand Down
1 change: 0 additions & 1 deletion samples/net/wifi/shell/boards/frdm_rw612.conf
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ CONFIG_MBEDTLS_USER_CONFIG_FILE="wpa_supp_els_pkc_mbedtls_config.h"
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
Expand Down
1 change: 0 additions & 1 deletion samples/net/wifi/shell/boards/rd_rw612_bga.conf
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ CONFIG_MBEDTLS_USER_CONFIG_FILE="wpa_supp_els_pkc_mbedtls_config.h"
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
Expand Down
1 change: 0 additions & 1 deletion samples/psa/its/overlay-entropy_not_secure.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@

CONFIG_TEST_RANDOM_GENERATOR=y
CONFIG_TIMER_RANDOM_GENERATOR=y
CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR=y
1 change: 0 additions & 1 deletion samples/psa/persistent_key/overlay-entropy_not_secure.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@

CONFIG_TEST_RANDOM_GENERATOR=y
CONFIG_TIMER_RANDOM_GENERATOR=y
CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR=y
1 change: 0 additions & 1 deletion subsys/bluetooth/mesh/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1478,7 +1478,6 @@ config BT_MESH_USES_MBEDTLS_PSA
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
Expand Down
1 change: 0 additions & 1 deletion tests/modules/uoscore/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ CONFIG_MBEDTLS=y
CONFIG_MBEDTLS_ENABLE_HEAP=y
CONFIG_MBEDTLS_HEAP_SIZE=2048
CONFIG_MBEDTLS_ENTROPY_C=y
CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR=y

# PSA Crypto options

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ CONFIG_MAIN_STACK_SIZE=2048
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
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
1 change: 1 addition & 0 deletions tests/subsys/storage/flash_map/overlay-psa.conf
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit b89fce8

Please sign in to comment.