From 872768928b16fb37d10d07bcc6636eafab59aec9 Mon Sep 17 00:00:00 2001 From: Andrew Kozlik Date: Mon, 25 May 2020 15:44:51 +0200 Subject: [PATCH] core/crypto: Fix endianity in DER length encoding. --- core/src/trezor/crypto/der.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/trezor/crypto/der.py b/core/src/trezor/crypto/der.py index c64b4b973..ac99aa3e7 100644 --- a/core/src/trezor/crypto/der.py +++ b/core/src/trezor/crypto/der.py @@ -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