Skip to content

Commit 6c72cd3

Browse files
nordic-mik7cfriedt
authored andcommitted
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]>
1 parent 8f2d3e7 commit 6c72cd3

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
@@ -153,6 +153,13 @@ function(zephyr_mcuboot_tasks)
153153
set(imgtool_args --align ${write_block_size} ${imgtool_args})
154154
endif()
155155

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

modules/Kconfig.mcuboot

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

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

0 commit comments

Comments
 (0)