mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 23:48:12 +00:00
firmware/storage: cache PIN after set
This commit is contained in:
parent
0cf5ef837f
commit
fa3481e37d
@ -246,7 +246,7 @@ void session_clear(bool clear_pin)
|
||||
sessionPassphraseCached = false;
|
||||
memzero(&sessionPassphrase, sizeof(sessionPassphrase));
|
||||
if (clear_pin) {
|
||||
sessionPinCached = false;
|
||||
session_uncachePin();
|
||||
}
|
||||
}
|
||||
|
||||
@ -290,9 +290,6 @@ static void storage_commit_locked(bool update)
|
||||
sessionSeedCached = false;
|
||||
sessionPassphraseCached = false;
|
||||
}
|
||||
if (storageUpdate.has_pin) {
|
||||
sessionPinCached = false;
|
||||
}
|
||||
|
||||
storageUpdate.version = STORAGE_VERSION;
|
||||
if (!storageUpdate.has_node && !storageUpdate.has_mnemonic) {
|
||||
@ -678,7 +675,7 @@ void storage_setPin(const char *pin)
|
||||
{
|
||||
storageUpdate.has_pin = true;
|
||||
strlcpy(storageUpdate.pin, pin, sizeof(storageUpdate.pin));
|
||||
sessionPinCached = false;
|
||||
session_cachePin();
|
||||
}
|
||||
|
||||
const char *storage_getPin(void)
|
||||
@ -729,6 +726,11 @@ void session_cachePin(void)
|
||||
sessionPinCached = true;
|
||||
}
|
||||
|
||||
void session_uncachePin(void)
|
||||
{
|
||||
sessionPinCached = false;
|
||||
}
|
||||
|
||||
bool session_isPinCached(void)
|
||||
{
|
||||
return sessionPinCached;
|
||||
|
@ -122,6 +122,7 @@ bool storage_hasPin(void);
|
||||
const char *storage_getPin(void);
|
||||
void storage_setPin(const char *pin);
|
||||
void session_cachePin(void);
|
||||
void session_uncachePin(void);
|
||||
bool session_isPinCached(void);
|
||||
void storage_clearPinArea(void);
|
||||
void storage_resetPinFails(uint32_t flash_pinfails);
|
||||
|
Loading…
Reference in New Issue
Block a user