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

Add storage_lock().

This commit is contained in:
andrew 2019-01-30 16:34:57 +01:00
parent d49e3c9f3c
commit 7228b299b3
2 changed files with 8 additions and 0 deletions

View File

@ -641,6 +641,13 @@ static secbool pin_get_fails(uint32_t *ctr)
return sectrue; return sectrue;
} }
void storage_lock(void)
{
unlocked = secfalse;
memzero(cached_keys, sizeof(cached_keys));
memzero(authentication_sum, sizeof(authentication_sum));
}
static secbool unlock(uint32_t pin) static secbool unlock(uint32_t pin)
{ {
const void *buffer = NULL; const void *buffer = NULL;

View File

@ -29,6 +29,7 @@ typedef void (*PIN_UI_WAIT_CALLBACK)(uint32_t wait, uint32_t progress);
void storage_init(PIN_UI_WAIT_CALLBACK callback, const uint8_t *salt, const uint16_t salt_len); void storage_init(PIN_UI_WAIT_CALLBACK callback, const uint8_t *salt, const uint16_t salt_len);
void storage_wipe(void); void storage_wipe(void);
void storage_wipe_ex(uint32_t new_pin, uint32_t pin_fail_count); void storage_wipe_ex(uint32_t new_pin, uint32_t pin_fail_count);
void storage_lock(void);
secbool storage_unlock(const uint32_t pin); secbool storage_unlock(const uint32_t pin);
secbool storage_has_pin(void); secbool storage_has_pin(void);
uint32_t storage_get_pin_rem(void); uint32_t storage_get_pin_rem(void);