Skip to content

Commit c136755

Browse files
nordic-mik7rlubos
authored andcommitted
[nrf fromtree] cmake: mcuboot: SHA512/pure image signing
Update signing script to use proper arguments for imgtool when SHA512 or pure signature is needed. Signed-off-by: Michal Kozikowski <[email protected]> (cherry picked from commit 6c72cd3)
1 parent 2e2beca commit c136755

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

cmake/mcuboot.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,13 @@ function(zephyr_mcuboot_tasks)
152152
set(imgtool_args --align ${write_block_size} ${imgtool_args})
153153
endif()
154154

155+
# Set proper hash calculation algorithm for signing
156+
if(CONFIG_MCUBOOT_BOOTLOADER_SIGNATURE_TYPE_PURE)
157+
set(imgtool_args --pure ${imgtool_args})
158+
elseif(CONFIG_MCUBOOT_BOOTLOADER_USES_SHA512)
159+
set(imgtool_args --sha 512 ${imgtool_args})
160+
endif()
161+
155162
# Extensionless prefix of any output file.
156163
set(output ${ZEPHYR_BINARY_DIR}/${KERNEL_NAME})
157164

modules/Kconfig.mcuboot

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,18 @@ config MCUBOOT_BOOTLOADER_NO_DOWNGRADE
288288
MCUBOOT_DOWNGRADE_PREVENTION option enabled.
289289
endif
290290

291+
config MCUBOOT_BOOTLOADER_USES_SHA512
292+
bool "MCUboot uses SHA512 for image hash"
293+
help
294+
MCUboot has been compiled to verify images using SHA512.
295+
296+
config MCUBOOT_BOOTLOADER_SIGNATURE_TYPE_PURE
297+
bool "Signature is verified over an image rather than sha of an image"
298+
help
299+
MCUboot has been compiled to verify images using pure signature
300+
verification, i.e., the signature is verified over the image rather
301+
than the SHA of the image.
302+
291303
config MCUBOOT_APPLICATION_FIRMWARE_UPDATER
292304
bool "Application is firmware updater image"
293305
depends on MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER

0 commit comments

Comments
 (0)