Skip to content

Commit 754f958

Browse files
committed
[nrf noup] bootutil: Use correct set of KMU key slots
nrf-squash! [nrf noup] bootutil: Add support for KMU stored ED25519 signature key Will instead use the immutable bootloader key slot IDs if b0 is not enabled, adds a Kconfig which can be used to fall back to the previous slot IDs for previously deployed bootloaders Signed-off-by: Jamie McCrae <[email protected]>
1 parent 1c8a595 commit 754f958

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

boot/bootutil/src/ed25519_psa.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,20 @@ BOOT_LOG_MODULE_REGISTER(ed25519_psa);
2525

2626
#if defined(CONFIG_BOOT_SIGNATURE_USING_KMU)
2727
/* List of KMU stored key ids available for MCUboot */
28+
#define PSA_KEY_INDEX_SIZE 2
29+
30+
#if CONFIG_MCUBOOT_MCUBOOT_IMAGE_NUMBER != -1 || \
31+
defined(CONFIG_NCS_BOOT_SIGNATURE_KMU_UROT_MAPPING)
32+
#define PSA_KEY_STARTING_ID 226
33+
#else
34+
#define PSA_KEY_STARTING_ID 242
35+
#endif
36+
2837
#define MAKE_PSA_KMU_KEY_ID(id) PSA_KEY_HANDLE_FROM_CRACEN_KMU_SLOT(CRACEN_KMU_KEY_USAGE_SCHEME_RAW, id)
2938
static psa_key_id_t key_ids[] = {
30-
MAKE_PSA_KMU_KEY_ID(226),
31-
MAKE_PSA_KMU_KEY_ID(228),
32-
MAKE_PSA_KMU_KEY_ID(230)
39+
MAKE_PSA_KMU_KEY_ID(PSA_KEY_STARTING_ID),
40+
MAKE_PSA_KMU_KEY_ID(PSA_KEY_STARTING_ID + PSA_KEY_INDEX_SIZE),
41+
MAKE_PSA_KMU_KEY_ID(PSA_KEY_STARTING_ID + (2 * PSA_KEY_INDEX_SIZE))
3342
};
3443

3544
#define KEY_SLOTS_COUNT CONFIG_BOOT_SIGNATURE_KMU_SLOTS

boot/zephyr/Kconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,17 @@ config BOOT_SIGNATURE_KMU_SLOTS
421421
Selects the number of KMU key slots (also known as generations) to use when verifying
422422
an image.
423423

424+
config NCS_BOOT_SIGNATURE_KMU_UROT_MAPPING
425+
bool "Use original mapping [DEPRECATED]"
426+
depends on SOC_SERIES_NRF54LX
427+
depends on MCUBOOT_MCUBOOT_IMAGE_NUMBER = -1
428+
select DEPRECATED
429+
help
430+
When this option is enabled, it will use the UROT_PUBKEY key slot IDs for the MCUboot
431+
image which are assigned for the non-immutable bootloader IDs, otherwise it will use
432+
the key set for the mode that MCUboot is used in (non-immutable slots when b0 is
433+
enabled, or immutable slots when b0 is not enabled).
434+
424435
endif
425436

426437
config BOOT_KEYS_REVOCATION

0 commit comments

Comments
 (0)