Skip to content

Commit 8080d96

Browse files
committed
nrf_security: Do not enable the enabler on QEMU targets
NRF_SECURITY_ENABLER applies nRF-Security-oriented defaults whenever Bluetooth crypto is enabled, most notably implying MBEDTLS_ENABLE_HEAP. That routes all Mbed TLS / PSA allocations through the fixed-size Mbed TLS static heap (MBEDTLS_MEMORY_BUFFER_ALLOC_C), whose size defaults to value of 512 bytes. The nRF Security (Oberon) backend is only available on Nordic Arm cores (NRF_SECURITY depends on SOC_FAMILY_NORDIC_NRF && ARM), so QEMU targets fall back to the vanilla Mbed TLS PSA provider. That provider expects to allocate from the C library heap; with the 512-byte static heap forced on instead, AES-ECB and AES-CMAC operations run out of memory and PSA returns PSA_ERROR_INSUFFICIENT_MEMORY (-141). This broke Bluetooth host crypto tests on qemu_cortex_m3 and qemu_x86 (bluetooth.addr RPA resolution and the bluetooth.gatt* db-hash generation), which pass on upstream Zephyr precisely because upstream does not enable the static heap for these builds. Since QEMU targets can never use nRF Security, exclude them from the enabler so they behave like upstream Zephyr and allocate PSA scratch memory from the C library heap. Assisted-by: Cursor:Claude Opus 4.8 Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
1 parent 15fb7bb commit 8080d96

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

Kconfig.nrf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ config FLASH_SIZE
115115
config NRF_SECURITY_ENABLER
116116
def_bool y
117117
depends on !SOC_NRF5340_CPUNET
118+
depends on !QEMU_TARGET
118119
imply PSA_CRYPTO if BT_CRYPTO || BT_HOST_CRYPTO || BT_MESH_CRYPTO_LIB || BT_FAST_PAIR_CRYPTO_PSA
119120
imply ENTROPY_GENERATOR if BOARD_NATIVE_SIM || BT_HOST_CRYPTO_PRNG || BT_ECC || BT_GATT_CACHING
120121
imply PSA_WANT_GENERATE_RANDOM if BT_HOST_CRYPTO_PRNG || BT_ECC || BT_GATT_CACHING || BT_MESH_CRYPTO_LIB

0 commit comments

Comments
 (0)