1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-18 13:38:12 +00:00

core/crypto: Fix endianity in DER length encoding.

This commit is contained in:
Andrew Kozlik 2020-05-25 15:44:51 +02:00 committed by Andrew Kozlik
parent e7f230d66e
commit 872768928b

View File

@ -4,7 +4,7 @@ def encode_length(l: int) -> bytes:
elif l <= 0xFF:
return bytes([0x81, l])
elif l <= 0xFFFF:
return bytes([0x82, l & 0xFF, l >> 8])
return bytes([0x82, l >> 8, l & 0xFF])
else:
raise ValueError