Skip to content

Commit 3771916

Browse files
committed
zephyr: Support for HKDF/HMAC with SHA512
The commit adds CONFIG_BOOT_HMAC_SHA512 that enables MCUboot configuration option MCUBOOT_HMAC_SHA512, that is used for switching HKDF/HMAC in ECIES key exchange to SHA512, from default SHA256. This option, currently, is only available for ECIES-X25519 with PSA as crypto backend. Signed-off-by: Dominik Ermel <[email protected]>
1 parent 1d83177 commit 3771916

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

boot/zephyr/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,15 @@ config BOOT_ENCRYPT_X25519
609609
help
610610
Hidden option selecting x25519 encryption.
611611

612+
config BOOT_HMAC_SHA512
613+
bool "Use SHA512 for HMAC/HKDF"
614+
depends on BOOT_ENCRYPT_X25519
615+
depends on BOOT_USE_PSA_CRYPTO
616+
help
617+
By default SHA256 is used for HKDF/HMAC in key exchange expansion
618+
and verification. This options switches to SHA512. The option is
619+
mainly useful to reduce numer of compiled in SHA algorithms.
620+
612621
config BOOT_ENCRYPTION_KEY_FILE
613622
string "Encryption key file"
614623
depends on BOOT_ENCRYPT_IMAGE

boot/zephyr/include/mcuboot_config/mcuboot_config.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,13 @@
157157
#define MCUBOOT_ENCRYPT_X25519
158158
#endif
159159

160+
/* Support for HMAC/HKDF using SHA512; this is used in key exchange where
161+
* HKDF is used for key expansion and HMAC is used for key verification.
162+
*/
163+
#ifdef CONFIG_BOOT_HMAC_SHA512
164+
#define MCUBOOT_HMAC_SHA512
165+
#endif
166+
160167
#ifdef CONFIG_BOOT_DECOMPRESSION
161168
#define MCUBOOT_DECOMPRESS_IMAGES
162169
#endif

0 commit comments

Comments
 (0)