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

config: Erase HW_ENTROPY_DATA when no longer needed. This assumes that config.init() is called only once in production. For the emulator tests config.init() can be called repeatedly, since HW_ENTROPY_DATA is null-initialized to begin with.

This commit is contained in:
Andrew Kozlik 2019-02-11 16:15:25 +01:00 committed by Pavol Rusnak
parent fd6eb333a6
commit 06ef27a718
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

View File

@ -27,6 +27,7 @@
#include "storage.h" #include "storage.h"
#include "common.h" #include "common.h"
#include "memzero.h"
STATIC mp_obj_t ui_wait_callback = mp_const_none; STATIC mp_obj_t ui_wait_callback = mp_const_none;
@ -51,6 +52,7 @@ STATIC mp_obj_t mod_trezorconfig_init(size_t n_args, const mp_obj_t *args) {
} else { } else {
storage_init(NULL, HW_ENTROPY_DATA, HW_ENTROPY_LEN); storage_init(NULL, HW_ENTROPY_DATA, HW_ENTROPY_LEN);
} }
memzero(HW_ENTROPY_DATA, sizeof(HW_ENTROPY_DATA));
return mp_const_none; return mp_const_none;
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_trezorconfig_init_obj, 0, 1, mod_trezorconfig_init); STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_trezorconfig_init_obj, 0, 1, mod_trezorconfig_init);