Browse Source

board: enable random/entropy generators if BT

BT uses PSA Crypto API to perform crypto operations and, on this
platform, these APIs are implemented through Mbed TLS. In order
to properly initialize this library, a random number generator
is required.

* If the platform supports an HW entropy generator (ex: native_sim,
  nrf), then ENTROPY_GENERATOR must be used;
* Otherwise (ex: qemu_cortex_m3) test random generator can be
  enabled.

Enabling the proper option at board Kconfig level allows for
a more compact code change instead of manually editing _all_
the samples/tests that required this fix.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
pull/82188/head
Valerio Setti 8 months ago committed by Anas Nashif
parent
commit
72555fabb4
  1. 9
      boards/native/native_sim/Kconfig.defconfig
  2. 13
      boards/native/nrf_bsim/Kconfig.defconfig
  3. 13
      boards/nordic/nrf5340_audio_dk/Kconfig.defconfig
  4. 13
      boards/nordic/nrf5340dk/Kconfig.defconfig
  5. 8
      boards/qemu/cortex_m3/Kconfig.defconfig

9
boards/native/native_sim/Kconfig.defconfig

@ -32,5 +32,14 @@ config UART_CONSOLE @@ -32,5 +32,14 @@ config UART_CONSOLE
endif # CONSOLE
# BT relies on PSA Crypto API to perform crypto operations. On this platform
# this is implemented by Mbed TLS which requires a (possibly true) random
# number generator to initialize properly. We enable ENTROPY_GENERATOR here
# instead of manually adding it to all samples/tests configuration files because
# it looks more compact and easier to maintain.
config ENTROPY_GENERATOR
bool
default y if BT
endif # BOARD_NATIVE_SIM

13
boards/native/nrf_bsim/Kconfig.defconfig

@ -58,6 +58,19 @@ config BT_HCI_IPC @@ -58,6 +58,19 @@ config BT_HCI_IPC
endif # BOARD_NRF5340BSIM_NRF5340_CPUAPP
if BOARD_NRF5340BSIM_NRF5340_CPUAPP || BOARD_NRF52_BSIM
# BT relies on PSA Crypto API to perform crypto operations. On this platform
# this is implemented by Mbed TLS which requires a (possibly true) random
# number generator to initialize properly. We enable ENTROPY_GENERATOR here
# instead of manually adding it to all samples/tests configuration files because
# it looks more compact and easier to maintain.
config ENTROPY_GENERATOR
bool
default y if BT
endif # BOARD_NRF5340BSIM_NRF5340_CPUAPP || BOARD_NRF52_BSIM
# The 15.4 driver Tx encryption is currently not functional with this
# simulated board => we disable it by default. With this Openthread will normally
# default to encrypt packets on its own.

13
boards/nordic/nrf5340_audio_dk/Kconfig.defconfig

@ -53,6 +53,19 @@ config FLASH_LOAD_SIZE @@ -53,6 +53,19 @@ config FLASH_LOAD_SIZE
endif # BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP_NS
if BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP
# BT relies on PSA Crypto API to perform crypto operations. On this platform
# this is implemented by Mbed TLS which requires a (possibly true) random
# number generator to initialize properly. We enable ENTROPY_GENERATOR here
# instead of manually adding it to all samples/tests configuration files because
# it looks more compact and easier to maintain.
config ENTROPY_GENERATOR
bool
default y if BT
endif # BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP
config BT_HCI_IPC
default y if BT

13
boards/nordic/nrf5340dk/Kconfig.defconfig

@ -43,6 +43,19 @@ config SRAM_SIZE @@ -43,6 +43,19 @@ config SRAM_SIZE
endif # BOARD_NRF5340DK_NRF5340_CPUAPP && TRUSTED_EXECUTION_SECURE
if BOARD_NRF5340DK_NRF5340_CPUAPP
# BT relies on PSA Crypto API to perform crypto operations. On this platform
# this is implemented by Mbed TLS which requires a (possibly true) random
# number generator to initialize properly. We enable ENTROPY_GENERATOR here
# instead of manually adding it to all samples/tests configuration files because
# it looks more compact and easier to maintain.
config ENTROPY_GENERATOR
bool
default y if BT
endif # BOARD_NRF5340DK_NRF5340_CPUAPP
if BOARD_NRF5340DK_NRF5340_CPUAPP_NS
config FLASH_LOAD_OFFSET

8
boards/qemu/cortex_m3/Kconfig.defconfig

@ -12,4 +12,12 @@ choice NULL_POINTER_EXCEPTION_DETECTION @@ -12,4 +12,12 @@ choice NULL_POINTER_EXCEPTION_DETECTION
default NULL_POINTER_EXCEPTION_DETECTION_NONE
endchoice
# BT relies on PSA Crypto API to perform crypto operations and, on this platform,
# these APIs are provided thougth Mbed TLS. Unfortunately this platform is not
# provided with a true random number generator which is required to properly
# initialize the PSA Crypto core, so we need to enable the fake TEST_RANDOM_GENERATOR.
config TEST_RANDOM_GENERATOR
bool
default y if BT
endif # BOARD_QEMU_CORTEX_M3

Loading…
Cancel
Save