Skip to content

Commit 237af62

Browse files
nvlsianpurlubos
authored andcommitted
sysbuild/mcuboot: ed25519 pure signature integration
Added integration of signing image with the pure signature: - New SB_CONFIG_BOOT_SIGNATURE_TYPE_PURE switch for enabling pure signature. - enforced sha512 for ed25519 on nRF54l target - requests pure signature from imgtool.py Signed-off-by: Andrzej Puzdrowski <[email protected]> Signed-off-by: Dominik Ermel <[email protected]> (cherry picked from commit cfded62)
1 parent 8d98a31 commit 237af62

File tree

4 files changed

+41
-1
lines changed

4 files changed

+41
-1
lines changed

cmake/sysbuild/image_signing.cmake

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ function(zephyr_mcuboot_tasks)
5757
# back on mcuboot/scripts/imgtool.py. We exclude the system imgtool when
5858
# compressed image support is enabled due to needing a version of imgtool
5959
# that has features not in the most recent public release.
60-
if(IMGTOOL AND NOT CONFIG_MCUBOOT_COMPRESSED_IMAGE_SUPPORT_ENABLED)
60+
if(IMGTOOL AND
61+
(NOT CONFIG_MCUBOOT_COMPRESSED_IMAGE_SUPPORT_ENABLED AND
62+
NOT (CONFIG_SOC_SERIES_NRF54LX AND CONFIG_MCUBOOT_BOOTLOADER_SIGNATURE_TYPE_ED25519)))
6163
set(imgtool_path "${IMGTOOL}")
6264
elseif(DEFINED ZEPHYR_MCUBOOT_MODULE_DIR)
6365
set(IMGTOOL_PY "${ZEPHYR_MCUBOOT_MODULE_DIR}/scripts/imgtool.py")
@@ -120,6 +122,14 @@ function(zephyr_mcuboot_tasks)
120122
set(imgtool_hex_extra)
121123
endif()
122124

125+
if(CONFIG_SOC_SERIES_NRF54LX AND CONFIG_MCUBOOT_BOOTLOADER_SIGNATURE_TYPE_ED25519)
126+
if(NOT CONFIG_MCUBOOT_BOOTLOADER_SIGNATURE_TYPE_PURE)
127+
set(imgtool_extra --sha 512 ${imgtool_extra})
128+
else()
129+
set(imgtool_extra --pure ${imgtool_extra})
130+
endif()
131+
endif()
132+
123133
if(CONFIG_MCUBOOT_HARDWARE_DOWNGRADE_PREVENTION)
124134
set(imgtool_extra --security-counter ${CONFIG_MCUBOOT_HW_DOWNGRADE_PREVENTION_COUNTER_VALUE} ${imgtool_extra})
125135
endif()

subsys/bootloader/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,4 +243,14 @@ config MCUBOOT_COMPRESSED_IMAGE_SUPPORT_ENABLED
243243
help
244244
This is a Kconfig which is informative only, the value should not be changed.
245245

246+
config MCUBOOT_BOOTLOADER_SIGNATURE_TYPE_ED25519
247+
bool "Use ED25519 signature"
248+
help
249+
This is a Kconfig which is informative only, the value should not be changed.
250+
251+
config MCUBOOT_BOOTLOADER_SIGNATURE_TYPE_PURE
252+
bool "Signature is verified over an image rather than sha of an image"
253+
help
254+
This is a Kconfig which is informative only, the value should not be changed.
255+
246256
endmenu

sysbuild/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,22 @@ function(${SYSBUILD_CURRENT_MODULE_NAME}_pre_cmake)
229229
# The NRF54LX goes with PSA crypto by default
230230
if(SB_CONFIG_SOC_SERIES_NRF54LX AND SB_CONFIG_BOOT_SIGNATURE_TYPE_ED25519)
231231
set_config_bool(mcuboot CONFIG_NRF_SECURITY y)
232+
set_config_bool(mcuboot CONFIG_BOOT_IMG_HASH_ALG_SHA512 y)
233+
set_config_bool(${DEFAULT_IMAGE} CONFIG_MCUBOOT_BOOTLOADER_SIGNATURE_TYPE_ED25519 y)
232234

233235
if(SB_CONFIG_MCUBOOT_SIGNATURE_USING_KMU)
234236
set_config_bool(mcuboot CONFIG_BOOT_SIGNATURE_USING_KMU y)
235237
else()
236238
set_config_bool(mcuboot CONFIG_BOOT_SIGNATURE_USING_KMU n)
237239
endif()
240+
241+
if(SB_CONFIG_BOOT_SIGNATURE_TYPE_PURE)
242+
set_config_bool(mcuboot CONFIG_BOOT_SIGNATURE_TYPE_PURE y)
243+
set_config_bool(${DEFAULT_IMAGE} CONFIG_MCUBOOT_BOOTLOADER_SIGNATURE_TYPE_PURE y)
244+
else()
245+
set_config_bool(mcuboot CONFIG_BOOT_SIGNATURE_TYPE_PURE n)
246+
set_config_bool(${DEFAULT_IMAGE} CONFIG_MCUBOOT_BOOTLOADER_SIGNATURE_TYPE_PURE n)
247+
endif()
238248
endif()
239249

240250
# A v1 board doesn't define board qualifiers, thus below test will just test the pure board

sysbuild/Kconfig.mcuboot

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,16 @@ config MCUBOOT_FPROTECT_ALLOW_COMBINED_REGIONS
147147
default y
148148
depends on SOC_SERIES_NRF54LX && !SECURE_BOOT_APPCORE
149149

150+
config BOOT_SIGNATURE_TYPE_PURE
151+
bool "Verify signature directly over image"
152+
depends on SOC_SERIES_NRF54LX
153+
depends on BOOT_SIGNATURE_TYPE_ED25519
154+
help
155+
The image signature will be verified over image rather than
156+
hash of an image.
157+
This option is currently only supported with ED25519 and configurations
158+
where both image slots are within internal SoC device storage.
159+
150160
config MCUBOOT_SIGNATURE_USING_KMU
151161
bool "Use KMU stored keys for signature verification"
152162
depends on SOC_SERIES_NRF54LX

0 commit comments

Comments
 (0)