1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-28 08:11:02 +00:00

embed/extmod/modtrezorcrypto: use mnemonic_clear where needed

This commit is contained in:
Pavol Rusnak 2019-01-23 18:37:56 +01:00
parent 806805e296
commit 2de0eac7dc
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 7 additions and 3 deletions

View File

@ -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)");
}
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);
@ -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)");
}
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);

@ -1 +1 @@
Subproject commit c316e775a2152db255ace96b6b65ac0f20525ec0
Subproject commit d1c52401e4c76c74a10455682ace0655b7aa644c