Skip to content

Commit a29b047

Browse files
de-nordicahasztag
authored andcommitted
[nrf fromtree] imgtool: Fix x25519 TLV HMAC tag
HMAC-SHA512 has been incorrectly fed only 32 bytes of password. Signed-off-by: Dominik Ermel <[email protected]> (cherry picked from commit 94d85f9)
1 parent e8b234d commit a29b047

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

scripts/imgtool/image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ def ecies_hkdf(self, enckey, plainkey, hmac_sha_alg):
444444
newpk = X25519PrivateKey.generate()
445445
shared = newpk.exchange(enckey._get_public())
446446
derived_key = HKDF(
447-
algorithm=hmac_sha_alg, length=48, salt=None,
447+
algorithm=hmac_sha_alg, length=16 + hmac_sha_alg.digest_size, salt=None,
448448
info=b'MCUBoot_ECIES_v1', backend=default_backend()).derive(shared)
449449
encryptor = Cipher(algorithms.AES(derived_key[:16]),
450450
modes.CTR(bytes([0] * 16)),

0 commit comments

Comments
 (0)