mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-30 09:11:07 +00:00
embed/extmod/modtrezorcrypto: use mnemonic_clear where needed
This commit is contained in:
parent
806805e296
commit
2de0eac7dc
@ -81,7 +81,9 @@ STATIC mp_obj_t mod_trezorcrypto_bip39_generate(mp_obj_t strength) {
|
|||||||
mp_raise_ValueError("Invalid bit strength (only 128, 160, 192, 224 and 256 values are allowed)");
|
mp_raise_ValueError("Invalid bit strength (only 128, 160, 192, 224 and 256 values are allowed)");
|
||||||
}
|
}
|
||||||
const char *mnemo = mnemonic_generate(bits);
|
const char *mnemo = mnemonic_generate(bits);
|
||||||
return mp_obj_new_str_copy(&mp_type_str, (const uint8_t *)mnemo, strlen(mnemo));
|
mp_obj_t res = mp_obj_new_str_copy(&mp_type_str, (const uint8_t *)mnemo, strlen(mnemo));
|
||||||
|
mnemonic_clear();
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_trezorcrypto_bip39_generate_obj, mod_trezorcrypto_bip39_generate);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_trezorcrypto_bip39_generate_obj, mod_trezorcrypto_bip39_generate);
|
||||||
|
|
||||||
@ -96,7 +98,9 @@ STATIC mp_obj_t mod_trezorcrypto_bip39_from_data(mp_obj_t data) {
|
|||||||
mp_raise_ValueError("Invalid data length (only 16, 20, 24, 28 and 32 bytes are allowed)");
|
mp_raise_ValueError("Invalid data length (only 16, 20, 24, 28 and 32 bytes are allowed)");
|
||||||
}
|
}
|
||||||
const char *mnemo = mnemonic_from_data(bin.buf, bin.len);
|
const char *mnemo = mnemonic_from_data(bin.buf, bin.len);
|
||||||
return mp_obj_new_str_copy(&mp_type_str, (const uint8_t *)mnemo, strlen(mnemo));
|
mp_obj_t res = mp_obj_new_str_copy(&mp_type_str, (const uint8_t *)mnemo, strlen(mnemo));
|
||||||
|
mnemonic_clear();
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_trezorcrypto_bip39_from_data_obj, mod_trezorcrypto_bip39_from_data);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_trezorcrypto_bip39_from_data_obj, mod_trezorcrypto_bip39_from_data);
|
||||||
|
|
||||||
|
2
vendor/trezor-crypto
vendored
2
vendor/trezor-crypto
vendored
@ -1 +1 @@
|
|||||||
Subproject commit c316e775a2152db255ace96b6b65ac0f20525ec0
|
Subproject commit d1c52401e4c76c74a10455682ace0655b7aa644c
|
Loading…
Reference in New Issue
Block a user