1
0
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:
Alex Beregszaszi 2016-05-25 09:28:53 +01:00
parent 2b6c991179
commit e0395b13eb

View File

@ -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)