Skip to content

Commit 8b9f324

Browse files
committed
fix: update aes init with iv
1 parent c3609d5 commit 8b9f324

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ledgerblue/hexLoader.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,11 @@ class HexLoader:
8989
def scp_derive_key(self, ecdh_secret, keyindex):
9090
if self.scpv3:
9191
mac_block = b"\x01" * 16
92-
cipher = AES.new(ecdh_secret, AES.MODE_ECB)
92+
iv = b"\x00" * 16
93+
cipher = AES.new(ecdh_secret, AES.MODE_CBC, iv=iv)
9394
mac_key = cipher.encrypt(mac_block)
9495
enc_block = b"\x02" * 16
95-
cipher = AES.new(ecdh_secret, AES.MODE_ECB)
96+
cipher = AES.new(ecdh_secret, AES.MODE_CBC, iv=iv)
9697
enc_key = cipher.encrypt(enc_block)
9798
return mac_key + enc_key
9899
retry = 0

0 commit comments

Comments
 (0)