Skip to content

Commit 96f01aa

Browse files
de-nordicnvlsianpu
authored andcommitted
zephyr: Add Kconfig and configuration for SHA on storage
Adds CONFIG_BOOT_IMG_HASH_DIRECTLY_ON_STORAGE, which enables MCUBOOT_HASH_STORAGE_DIRECTLY for Zephyr. Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
1 parent 30e6adf commit 96f01aa

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

boot/zephyr/Kconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,22 @@ config BOOT_IMG_HASH_ALG_SHA512_ALLOW
8888
help
8989
Hidden option set by configurations that allow SHA512
9090

91+
config BOOT_IMG_HASH_DIRECTLY_ON_STORAGE
92+
bool "Hash calculation functions access storage through address space"
93+
depends on !BOOT_ENCRYPT_IMAGE
94+
help
95+
When possible to map storage device, at least for read operations,
96+
to address space or RAM area, enabling this option allows hash
97+
calculation functions to directly access the storage through that address
98+
space or using its own DMA. This reduces flash read overhead done
99+
by MCUboot.
100+
Notes:
101+
- not supported when encrypted images are in use, because calculating
102+
SHA requires image to be decrypted first, which is done in RAM.
103+
- currently only supported on internal storage of devices; this
104+
option will not work with devices that use external storage for
105+
either of the image slots.
106+
91107
choice BOOT_IMG_HASH_ALG
92108
prompt "Selected image hash algorithm"
93109
default BOOT_IMG_HASH_ALG_SHA256 if BOOT_IMG_HASH_ALG_SHA256_ALLOW

boot/zephyr/include/mcuboot_config/mcuboot_config.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,13 @@
149149
#define MCUBOOT_DECOMPRESS_IMAGES
150150
#endif
151151

152+
/* Invoke hashing functions directly on storage device. This requires the device
153+
* be able to map storage to address space or RAM.
154+
*/
155+
#ifdef CONFIG_BOOT_IMG_HASH_DIRECTLY_ON_STORAGE
156+
#define MCUBOOT_HASH_STORAGE_DIRECTLY
157+
#endif
158+
152159
#ifdef CONFIG_BOOT_BOOTSTRAP
153160
#define MCUBOOT_BOOTSTRAP 1
154161
#endif

0 commit comments

Comments
 (0)