mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-08 22:40:59 +00:00
Fix RLP length calculation
This commit is contained in:
parent
2b6c991179
commit
e0395b13eb
@ -74,13 +74,13 @@ static int rlp_calculate_length(int length, uint8_t firstbyte) {
|
||||
if (length == 1 && firstbyte <= 0x7f) {
|
||||
return 1;
|
||||
} else if (length <= 55) {
|
||||
return 2;
|
||||
return 1 + length;
|
||||
} else if (length <= 0xff) {
|
||||
return 2;
|
||||
return 2 + length;
|
||||
} else if (length <= 0xffff) {
|
||||
return 3;
|
||||
return 3 + length;
|
||||
} else
|
||||
return 4;
|
||||
return 4 + length;
|
||||
}
|
||||
|
||||
static inline void hash_data(const uint8_t *buf, size_t size)
|
||||
|
Loading…
Reference in New Issue
Block a user