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

Make storage_pin_fails_increase() public.

This commit is contained in:
andrew 2019-01-30 17:33:48 +01:00
parent 7e8c4e783d
commit ebe884ab4d
2 changed files with 4 additions and 3 deletions

View File

@ -517,7 +517,7 @@ static secbool pin_fails_reset(void)
return pin_logs_init(0); return pin_logs_init(0);
} }
static secbool pin_fails_increase(void) secbool storage_pin_fails_increase(void)
{ {
const void *logs = NULL; const void *logs = NULL;
uint16_t len = 0; uint16_t len = 0;
@ -739,7 +739,7 @@ secbool storage_unlock(uint32_t pin)
// First, we increase PIN fail counter in storage, even before checking the // First, we increase PIN fail counter in storage, even before checking the
// PIN. If the PIN is correct, we reset the counter afterwards. If not, we // PIN. If the PIN is correct, we reset the counter afterwards. If not, we
// check if this is the last allowed attempt. // check if this is the last allowed attempt.
if (sectrue != pin_fails_increase()) { if (sectrue != storage_pin_fails_increase()) {
memzero(&pin, sizeof(pin)); memzero(&pin, sizeof(pin));
return secfalse; return secfalse;
} }
@ -994,7 +994,7 @@ static void handle_fault(void)
ensure(secfalse, "fault detected"); ensure(secfalse, "fault detected");
} }
if (sectrue != pin_fails_increase()) { if (sectrue != storage_pin_fails_increase()) {
storage_wipe(); storage_wipe();
ensure(secfalse, "fault detected"); ensure(secfalse, "fault detected");
} }

View File

@ -31,6 +31,7 @@ void storage_wipe(void);
void storage_lock(void); 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);
secbool storage_pin_fails_increase(void);
uint32_t storage_get_pin_rem(void); uint32_t storage_get_pin_rem(void);
secbool storage_change_pin(const uint32_t oldpin, const uint32_t newpin); secbool storage_change_pin(const uint32_t oldpin, const uint32_t newpin);
secbool storage_get(const uint16_t key, void *val, const uint16_t max_len, uint16_t *len); secbool storage_get(const uint16_t key, void *val, const uint16_t max_len, uint16_t *len);