Skip to content

Commit ec48dcb

Browse files
joerchannordicjm
authored andcommitted
[nrf fromtree] tfm: Harded build against TF-M built with unsecure keys
Introduce Kconfig option in zephyr build system that reflects the TF-M cmake config variable with the same default value for dummy provisioning and have it satisfy the IAK present requirement. This configuration is not suitable for production, and by having this in zephyr configuration we can have this as part of the hardened configuration check. Signed-off-by: Joakim Andersson <[email protected]> (cherry picked from commit 25787e2) Signed-off-by: Joakim Andersson <[email protected]>
1 parent 89be433 commit ec48dcb

File tree

4 files changed

+35
-1
lines changed

4 files changed

+35
-1
lines changed

boards/arm/b_u585i_iot02a/Kconfig.defconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,11 @@ config USE_DT_CODE_PARTITION
2020
config SYS_CLOCK_TICKS_PER_SEC
2121
default 4096 if STM32_LPTIM_TIMER
2222

23+
if BUILD_WITH_TFM
24+
25+
config TFM_DUMMY_PROVISIONING
26+
default n
27+
28+
endif # BUILD_WITH_TFM
29+
2330
endif # BOARD_B_U585I_IOT02A

modules/trusted-firmware-m/CMakeLists.txt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ if (CONFIG_BUILD_WITH_TFM)
9595
list(APPEND TFM_CMAKE_ARGS -DMCUBOOT_IMAGE_NUMBER=${CONFIG_TFM_MCUBOOT_IMAGE_NUMBER})
9696
endif()
9797

98+
if (CONFIG_TFM_DUMMY_PROVISIONING)
99+
list(APPEND TFM_CMAKE_ARGS -DTFM_DUMMY_PROVISIONING=ON)
100+
else()
101+
list(APPEND TFM_CMAKE_ARGS -DTFM_DUMMY_PROVISIONING=OFF)
102+
endif()
103+
98104
if (CONFIG_TFM_EXCEPTION_INFO_DUMP)
99105
list(APPEND TFM_CMAKE_ARGS -DTFM_EXCEPTION_INFO_DUMP=ON)
100106
else()
@@ -579,4 +585,13 @@ if (CONFIG_BUILD_WITH_TFM)
579585
${MERGED_FILE}
580586
)
581587
endif()
582-
endif()
588+
589+
if(CONFIG_TFM_DUMMY_PROVISIONING)
590+
message(WARNING
591+
"TFM_DUMMY_PROVISIONING is enabled:
592+
The device will be provisioned using dummy keys and is NOT secure!
593+
This is not suitable for production"
594+
)
595+
endif()
596+
597+
endif() # CONFIG_BUILD_WITH_TFM

modules/trusted-firmware-m/Kconfig.tfm

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,17 @@ config TFM_PARTITION_PLATFORM_CUSTOM_REBOOT
177177
Instead the application will have to override the weak ARM
178178
implementation of sys_arch_reset().
179179

180+
config TFM_DUMMY_PROVISIONING
181+
bool "Provision with dummy values. NOT to be used in production"
182+
default y
183+
help
184+
If this option is enabled (as it is by default), a set of dummy
185+
keys / data will be provisioned. The dummy IAK matches the IAK tested
186+
by the TF-M tests, and the dummy bl2 ROTPKs match the dummy bl2 keys
187+
used by default.
188+
This option MUST not be used in production hardware, as the keys are
189+
insecure.
190+
180191
config TFM_BL2_NOT_SUPPORTED
181192
bool
182193
help

scripts/kconfig/hardened.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ TEST_RANDOM_GENERATOR,n
3939
TEST_SHELL,n
4040
TEST_USERSPACE,n
4141
TFM_CMAKE_BUILD_TYPE_DEBUG,n
42+
TFM_DUMMY_PROVISIONING,n
4243
THREAD_MONITOR,n
4344
THREAD_NAME,n
4445
TIMER_RANDOM_GENERATOR,n

0 commit comments

Comments
 (0)