1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 23:48:12 +00:00

fixed rlp_length for chain_id > 255 (#381)

This commit is contained in:
HackyMiner 2018-07-20 00:56:11 +09:00 committed by Pavol Rusnak
parent 020a39bf1d
commit 1ef73190b9

View File

@ -568,7 +568,8 @@ void ethereum_signing_init(EthereumSignTx *msg, const HDNode *node)
rlp_length += rlp_calculate_length(1, tx_type);
}
if (chain_id) {
rlp_length += rlp_calculate_length(1, chain_id);
int length = chain_id < 0x100 ? 1: chain_id < 0x10000 ? 2: chain_id < 0x1000000 ? 3 : 4;
rlp_length += rlp_calculate_length(length, chain_id);
rlp_length += rlp_calculate_length(0, 0);
rlp_length += rlp_calculate_length(0, 0);
}