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

don't clear PIN on Initialize

This commit is contained in:
Pavol Rusnak 2015-03-31 16:31:29 +02:00
parent 956546ae54
commit 4cbf29505d
3 changed files with 8 additions and 6 deletions

View File

@ -113,7 +113,7 @@ void fsm_msgInitialize(Initialize *msg)
(void)msg;
recovery_abort();
signing_abort();
session_clear();
session_clear(false); // do not clear PIN
fsm_msgGetFeatures(0);
}
@ -447,7 +447,7 @@ void fsm_msgCipherKeyValue(CipherKeyValue *msg)
void fsm_msgClearSession(ClearSession *msg)
{
(void)msg;
session_clear();
session_clear(true); // clear PIN as well
fsm_sendSuccess("Session cleared");
}

View File

@ -117,14 +117,16 @@ void storage_reset(void)
// reset storage struct
memset(&storage, 0, sizeof(storage));
storage.version = STORAGE_VERSION;
session_clear();
session_clear(true); // clear PIN as well
}
void session_clear(void)
void session_clear(bool clear_pin)
{
sessionRootNodeCached = false; memset(&sessionRootNode, 0, sizeof(sessionRootNode));
sessionPassphraseCached = false; memset(&sessionPassphrase, 0, sizeof(sessionPassphrase));
sessionPinCached = false;
if (clear_pin) {
sessionPinCached = false;
}
}
static uint8_t meta_backup[FLASH_META_LEN];

View File

@ -29,7 +29,7 @@ void storage_init(void);
void storage_reset_uuid(void);
void storage_reset(void);
void storage_commit(void);
void session_clear(void);
void session_clear(bool clear_pin);
void storage_loadDevice(LoadDevice *msg);