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

Check input bip32 path again on second pass.

This commit is contained in:
Jochen Hoenicke 2017-07-27 21:21:47 +02:00 committed by Pavol Rusnak
parent 6b615ce405
commit 3c75d28c78

View File

@ -396,6 +396,17 @@ bool compile_input_script_sig(TxInputType *tinput)
return false; return false;
} }
} }
if (in_address_n_count >= 1) {
// check that input address didn't change
size_t count = tinput->address_n_count;
if (count != in_address_n_count) {
return false;
}
if (count >= 2
&& 0 != memcmp(in_address_n, tinput->address_n, (count - 2) * sizeof(uint32_t))) {
return false;
}
}
memcpy(&node, root, sizeof(HDNode)); memcpy(&node, root, sizeof(HDNode));
if (hdnode_private_ckd_cached(&node, tinput->address_n, tinput->address_n_count, NULL) == 0) { if (hdnode_private_ckd_cached(&node, tinput->address_n, tinput->address_n_count, NULL) == 0) {
// Failed to derive private key // Failed to derive private key