Skip to content

Commit 210b738

Browse files
de-nordicnvlsianpu
authored andcommitted
[nrf fromtree] 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]> (cherry picked from commit 3771916)
1 parent a101653 commit 210b738

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
@@ -657,6 +657,15 @@ config BOOT_ENCRYPT_X25519
657657
help
658658
Hidden option selecting x25519 encryption.
659659

660+
config BOOT_HMAC_SHA512
661+
bool "Use SHA512 for HMAC/HKDF"
662+
depends on BOOT_ENCRYPT_X25519
663+
depends on BOOT_USE_PSA_CRYPTO
664+
help
665+
By default SHA256 is used for HKDF/HMAC in key exchange expansion
666+
and verification. This options switches to SHA512. The option is
667+
mainly useful to reduce numer of compiled in SHA algorithms.
668+
660669
config BOOT_ENCRYPTION_KEY_FILE
661670
string "Encryption key file"
662671
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
@@ -155,6 +155,13 @@
155155
#define MCUBOOT_ENCRYPT_X25519
156156
#endif
157157

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

0 commit comments

Comments
 (0)