1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-17 21:22:10 +00:00

legacy: set initialized in storage to false if no mnemonic is present

This commit is contained in:
Tomas Susanka 2020-06-18 20:13:56 +02:00
parent e630279487
commit 4239e8d551
2 changed files with 7 additions and 2 deletions

View File

@ -400,6 +400,12 @@ void config_init(void) {
storage_init(&protectPinUiCallback, HW_ENTROPY_DATA, HW_ENTROPY_LEN);
memzero(HW_ENTROPY_DATA, sizeof(HW_ENTROPY_DATA));
// imported xprv is not supported anymore so we set initialized to false
// if no mnemonic is present
if (config_isInitialized() && !config_hasMnemonic()) {
config_set_bool(KEY_INITIALIZED, false);
}
// Auto-unlock storage if no PIN is set.
if (storage_is_unlocked() == secfalse && storage_has_pin() == secfalse) {
storage_unlock(PIN_EMPTY, NULL);

View File

@ -46,8 +46,7 @@ bool get_features(Features *resp) {
config_getLanguage(resp->language, sizeof(resp->language));
resp->has_label = config_getLabel(resp->label, sizeof(resp->label));
resp->has_initialized = true;
// imported xprv is not supported anymore so we require mnemonic
resp->initialized = config_isInitialized() && config_hasMnemonic();
resp->initialized = config_isInitialized();
resp->has_imported = config_getImported(&(resp->imported));
resp->has_pin_cached = true;
resp->pin_cached = session_isUnlocked() && config_hasPin();