Skip to content

Commit a185ede

Browse files
Vge0rgerlubos
authored andcommitted
nrf_security: Forbid multiple ways to invalidate PROT_RAM slots
This makes sure that when SB_CONFIG_CRACEN_KMU_INVALIDATE_PROTECTED_RAM_SLOTS is enabled none of the other options meant to do the same thing are enabled: CRACEN_PROVISION_PROT_RAM_INV_SLOTS_ON_INIT CRACEN_PROVISION_PROT_RAM_INV_SLOTS_WITH_IMPORT This is done to avoid misconfigurations. In order to do that I had to create a separate helper symbol since the sysbuild symbol cannot be directly added as a dependency in the application image build. Also I moved the sysbuild logic in the pre_cmake section because in post_cmake it is too late to set Kconfig options, they are already parsed at that point. Signed-off-by: Georgios Vasilakis <georgios.vasilakis@nordicsemi.no>
1 parent 6be8a7d commit a185ede

4 files changed

Lines changed: 33 additions & 6 deletions

File tree

doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@ Developing with nRF70 Series
6363
Developing with nRF54L Series
6464
=============================
6565

66-
|no_changes_yet_note|
66+
* Added:
67+
68+
* The :kconfig:option:`CONFIG_SB_CRACEN_KMU_INVALIDATE_PROTECTED_RAM_SLOTS` sysbuild Kconfig option to populate the Key Management Unit (KMU) slots for invalidation of the CRACEN-protected RAM using nrfutil.
69+
This option requires ``nrfutil device`` version 2.15.4 or later to work.
70+
When enabled, the :kconfig:option:`CONFIG_CRACEN_PROVISION_PROT_RAM_INV_SLOTS_ON_INIT` and :kconfig:option:`CONFIG_CRACEN_PROVISION_PROT_RAM_INV_SLOTS_WITH_IMPORT` Kconfig options become unavailable, as they implement the same feature through alternative provisioning paths.
6771

6872
Developing with nRF54H Series
6973
=============================

subsys/nrf_security/src/drivers/cracen/Kconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,18 @@ config CRACEN_LIB_KMU
7474
help
7575
The CRACEN KMU library.
7676

77+
config CRACEN_KMU_INVALIDATE_PROTECTED_RAM_SLOTS
78+
bool "Provision protected RAM invalidation slots with nrfutil (informative only, do not change)"
79+
help
80+
This option indicates that the protected RAM invalidation slots are provisioned
81+
using nrfutil. When enabled, the manual provisioning options below are hidden because
82+
provisioning is expected to be handled through sysbuild/nrfutil instead.
83+
This option is controlled by the KMU_INVALIDATE_PROTECTED_RAM_SLOTS sysbuild
84+
configuration option, so enable it in your sysbuild
85+
configuration rather than setting this symbol manually.
86+
87+
if !CRACEN_KMU_INVALIDATE_PROTECTED_RAM_SLOTS
88+
7789
config CRACEN_PROVISION_PROT_RAM_INV_SLOTS_ON_INIT
7890
bool "Provision protected RAM invalidation slots on boot"
7991
depends on CRACEN_LIB_KMU
@@ -96,6 +108,8 @@ config CRACEN_PROVISION_PROT_RAM_INV_SLOTS_WITH_IMPORT
96108
This is meant to be used by a provisioning image that runs once before the application
97109
image is flashed. This is not meant to be used by user applications.
98110

111+
endif # CRACEN_KMU_INVALIDATE_PROTECTED_RAM_SLOTS
112+
99113
config CRACEN_IKG
100114
bool "CRACEN IKG"
101115
help

sysbuild/CMakeLists.txt

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,6 +1016,19 @@ function(${SYSBUILD_CURRENT_MODULE_NAME}_pre_cmake)
10161016
set_config_bool(mcuboot CONFIG_NCS_MCUBOOT_MPCCONF_STATIC_WRITE_PROTECTION y)
10171017
set_config_bool(mcuboot CONFIG_NRF_MPCCONF_API_IN_RAM y)
10181018
endif()
1019+
1020+
if(SB_CONFIG_CRACEN_KMU_INVALIDATE_PROTECTED_RAM_SLOTS)
1021+
foreach(image ${PRE_CMAKE_IMAGES})
1022+
set_config_bool(${image} CONFIG_CRACEN_KMU_INVALIDATE_PROTECTED_RAM_SLOTS y)
1023+
endforeach()
1024+
1025+
include(${ZEPHYR_NRF_MODULE_DIR}/cmake/sysbuild/nrf54l_prot_ram_inv_slots.cmake)
1026+
else()
1027+
foreach(image ${PRE_CMAKE_IMAGES})
1028+
set_config_bool(${image} CONFIG_CRACEN_KMU_INVALIDATE_PROTECTED_RAM_SLOTS n)
1029+
endforeach()
1030+
endif()
1031+
10191032
endfunction(${SYSBUILD_CURRENT_MODULE_NAME}_pre_cmake)
10201033

10211034
function(${SYSBUILD_CURRENT_MODULE_NAME}_pre_image_cmake)
@@ -1085,10 +1098,6 @@ function(${SYSBUILD_CURRENT_MODULE_NAME}_post_cmake)
10851098
endif()
10861099
endif()
10871100

1088-
if(SB_CONFIG_KMU_INVALIDATE_PROTECTED_RAM_SLOTS)
1089-
include(${ZEPHYR_NRF_MODULE_DIR}/cmake/sysbuild/nrf54l_prot_ram_inv_slots.cmake)
1090-
endif()
1091-
10921101
if(SB_CONFIG_WIFI_PATCHES_EXT_FLASH_STORE)
10931102
include(${ZEPHYR_NRF_MODULE_DIR}/cmake/sysbuild/nrf700x.cmake)
10941103
endif()

sysbuild/Kconfig.kmu_prot_ram_inv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
44

5-
config KMU_INVALIDATE_PROTECTED_RAM_SLOTS
5+
config CRACEN_KMU_INVALIDATE_PROTECTED_RAM_SLOTS
66
bool "Populates the KMU slots for invalidation of the protected RAM using nrfutil"
77
depends on SOC_SERIES_NRF54L && !(SOC_NRF54LS05A || SOC_NRF54LS05B)
88
help

0 commit comments

Comments
 (0)