mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-18 05:28:40 +00:00
core: disable trezor-crypto BIP32 cache
This commit is contained in:
parent
67c09020ab
commit
2cedc687e6
@ -36,6 +36,7 @@ CPPDEFINES_MOD += [
|
|||||||
'AES_128',
|
'AES_128',
|
||||||
'AES_192',
|
'AES_192',
|
||||||
'RAND_PLATFORM_INDEPENDENT',
|
'RAND_PLATFORM_INDEPENDENT',
|
||||||
|
('USE_BIP32_CACHE', '0'),
|
||||||
('USE_KECCAK', '1'),
|
('USE_KECCAK', '1'),
|
||||||
('USE_ETHEREUM', '1' if EVERYTHING else '0'),
|
('USE_ETHEREUM', '1' if EVERYTHING else '0'),
|
||||||
('USE_MONERO', '1' if EVERYTHING else '0'),
|
('USE_MONERO', '1' if EVERYTHING else '0'),
|
||||||
|
@ -34,6 +34,7 @@ CPPPATH_MOD += [
|
|||||||
CPPDEFINES_MOD += [
|
CPPDEFINES_MOD += [
|
||||||
'AES_128',
|
'AES_128',
|
||||||
'AES_192',
|
'AES_192',
|
||||||
|
('USE_BIP32_CACHE', '0'),
|
||||||
('USE_KECCAK', '1'),
|
('USE_KECCAK', '1'),
|
||||||
('USE_ETHEREUM', '1' if EVERYTHING else '0'),
|
('USE_ETHEREUM', '1' if EVERYTHING else '0'),
|
||||||
('USE_MONERO', '1' if EVERYTHING else '0'),
|
('USE_MONERO', '1' if EVERYTHING else '0'),
|
||||||
|
@ -240,19 +240,18 @@ STATIC mp_obj_t mod_trezorcrypto_HDNode_derive_path(mp_obj_t self,
|
|||||||
mp_raise_ValueError("Path cannot be longer than 32 indexes");
|
mp_raise_ValueError("Path cannot be longer than 32 indexes");
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert path to int array
|
for (uint32_t pi = 0; pi < plen; pi++) {
|
||||||
uint32_t pi;
|
if (pi == plen - 1) {
|
||||||
uint32_t pints[plen];
|
// fingerprint is calculated from the parent of the final derivation
|
||||||
for (pi = 0; pi < plen; pi++) {
|
o->fingerprint = hdnode_fingerprint(&o->hdnode);
|
||||||
pints[pi] = trezor_obj_get_uint(pitems[pi]);
|
|
||||||
}
|
}
|
||||||
|
uint32_t pitem = trezor_obj_get_uint(pitems[pi]);
|
||||||
if (!hdnode_private_ckd_cached(&o->hdnode, pints, plen, &o->fingerprint)) {
|
if (!hdnode_private_ckd(&o->hdnode, pitem)) {
|
||||||
// derivation failed, reset the state and raise
|
|
||||||
o->fingerprint = 0;
|
o->fingerprint = 0;
|
||||||
memzero(&o->hdnode, sizeof(o->hdnode));
|
memzero(&o->hdnode, sizeof(o->hdnode));
|
||||||
mp_raise_ValueError("Failed to derive path");
|
mp_raise_ValueError("Failed to derive path");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return mp_const_none;
|
return mp_const_none;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user