Skip to content

Commit 9cc97d9

Browse files
committed
zephyr: Add CONFIG_BOOT_BYPASS_KEY_MATCH
Add Zephyr support for MCUBOOT_BYPASS_KEY_MATCH Signed-off-by: Dominik Ermel <[email protected]>
1 parent d15926c commit 9cc97d9

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

boot/zephyr/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,18 @@ config BOOT_SIGNATURE_TYPE_RSA
222222
select BOOT_IMG_HASH_ALG_SHA256_ALLOW
223223
select BOOT_AES_MBEDTLS_DEPENDENCIES if MBEDTLS_BUILTIN && BOOT_ENCRYPT_IMAGE
224224

225+
config BOOT_BYPASS_KEY_MATCH
226+
bool "Do not match TLV key hash against built in key"
227+
depends on !BOOT_SIGNATURE_TYPE_NONE
228+
help
229+
MCUboot reads, from TLV, hash of key thath should be used to verify
230+
signature and tries to match it against list of keys, to select the
231+
key from known keys. This pointless when there is only single key
232+
compiled in, as the key can be used whether it is the right one
233+
or not, the signature verification process will verify the key.
234+
Enabling this option turns off key matching, slightly reducing
235+
MCUboot code and boot time.
236+
225237
if BOOT_SIGNATURE_TYPE_RSA
226238
config BOOT_SIGNATURE_TYPE_RSA_LEN
227239
int "RSA signature length"

boot/zephyr/include/mcuboot_config/mcuboot_config.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,15 @@
153153
#define MCUBOOT_ENCRYPT_X25519
154154
#endif
155155

156+
/* Turn off check of public key hash against compiled in key
157+
* before attempting signature verification. When there is only
158+
* one key, matching is pointless, the signature may just be
159+
* verified with the only key that there is.
160+
*/
161+
#ifdef CONFIG_BOOT_BYPASS_KEY_MATCH
162+
#define MCUBOOT_BYPASS_KEY_MATCH
163+
#endif
164+
156165
#ifdef CONFIG_BOOT_DECOMPRESSION
157166
#define MCUBOOT_DECOMPRESS_IMAGES
158167
#endif

0 commit comments

Comments
 (0)