Skip to content

Commit ade6a05

Browse files
[nrf noup] bootutil: Add setup validation
Add an option for setup validation. Implement setup validation to check if the KMU has been provisioned, and log if it has not. Fixes: NCSDK-33559 Signed-off-by: Sigurd Hellesvik <[email protected]>
1 parent e92888b commit ade6a05

File tree

6 files changed

+25
-0
lines changed

6 files changed

+25
-0
lines changed

boot/bootutil/src/ed25519_psa.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,12 @@ int ED25519_verify(const uint8_t *message, size_t message_len,
126126
}
127127

128128
BOOT_LOG_ERR("ED25519 signature verification failed %d", status);
129+
#if defined(CONFIG_MCUBOOT_SETUP_VALIDATION)
130+
if(status == PSA_ERROR_INVALID_HANDLE) {
131+
BOOT_LOG_ERR("PSA_ERROR_INVALID_HANDLE(-136) could mean that the KMU slot is not provisioned.");
132+
}
129133
}
134+
#endif
130135

131136
return ret;
132137
}

boot/zephyr/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,4 +1203,12 @@ config MCUBOOT_VERIFY_IMG_ADDRESS
12031203
also be useful when BOOT_DIRECT_XIP is enabled, to ensure that the image
12041204
linked at the correct address is loaded.
12051205

1206+
config MCUBOOT_SETUP_VALIDATION
1207+
bool "Add extra checks at boot to validate before booting"
1208+
depends on LOG
1209+
default n
1210+
help
1211+
Add extra checks to validate before booting, which will have verbose
1212+
error logs if something is found.
1213+
12061214
source "Kconfig.zephyr"

boot/zephyr/boards/nrf54l15dk_nrf54l05_cpuapp.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ CONFIG_BOOT_WATCHDOG_FEED=n
1313

1414
# Ensure the fastest RRAM write operations
1515
CONFIG_NRF_RRAM_WRITE_BUFFER_SIZE=32
16+
17+
# Add setup validation to log if KMU slot is not provisioned
18+
CONFIG_MCUBOOT_SETUP_VALIDATION=y

boot/zephyr/boards/nrf54l15dk_nrf54l10_cpuapp.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ CONFIG_BOOT_WATCHDOG_FEED=n
1313

1414
# Ensure the fastest RRAM write operations
1515
CONFIG_NRF_RRAM_WRITE_BUFFER_SIZE=32
16+
17+
# Add setup validation to log if KMU slot is not provisioned
18+
CONFIG_MCUBOOT_SETUP_VALIDATION=y

boot/zephyr/boards/nrf54l15dk_nrf54l15_cpuapp.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ CONFIG_BOOT_WATCHDOG_FEED=n
1414

1515
# Ensure the fastest RRAM write operations
1616
CONFIG_NRF_RRAM_WRITE_BUFFER_SIZE=32
17+
18+
# Add setup validation to log if KMU slot is not provisioned
19+
CONFIG_MCUBOOT_SETUP_VALIDATION=y

boot/zephyr/boards/nrf54l15dk_nrf54l15_cpuapp_ext_flash.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ CONFIG_BOOT_WATCHDOG_FEED=n
1616

1717
# Ensure the fastest RRAM write operations
1818
CONFIG_NRF_RRAM_WRITE_BUFFER_SIZE=32
19+
20+
# Add setup validation to log if KMU slot is not provisioned
21+
CONFIG_MCUBOOT_SETUP_VALIDATION=y

0 commit comments

Comments
 (0)