mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-27 01:48:17 +00:00
clear pin failures on wipe and when in debug mode
This commit is contained in:
parent
d20671b517
commit
46119bd007
@ -241,6 +241,7 @@ void fsm_msgWipeDevice(WipeDevice *msg)
|
|||||||
storage_reset();
|
storage_reset();
|
||||||
storage_reset_uuid();
|
storage_reset_uuid();
|
||||||
storage_commit();
|
storage_commit();
|
||||||
|
storage_clearPinArea();
|
||||||
// the following does not work on Mac anyway :-/ Linux/Windows are fine, so it is not needed
|
// the following does not work on Mac anyway :-/ Linux/Windows are fine, so it is not needed
|
||||||
// usbReconnect(); // force re-enumeration because of the serial number change
|
// usbReconnect(); // force re-enumeration because of the serial number change
|
||||||
fsm_sendSuccess("Device wiped");
|
fsm_sendSuccess("Device wiped");
|
||||||
|
@ -419,6 +419,15 @@ bool session_isPinCached(void)
|
|||||||
return sessionPinCached;
|
return sessionPinCached;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void storage_clearPinArea()
|
||||||
|
{
|
||||||
|
flash_clear_status_flags();
|
||||||
|
flash_unlock();
|
||||||
|
flash_erase_sector(FLASH_META_SECTOR_LAST, FLASH_CR_PROGRAM_X32);
|
||||||
|
flash_lock();
|
||||||
|
storage_check_flash_errors();
|
||||||
|
}
|
||||||
|
|
||||||
void storage_resetPinFails(uint32_t *pinfailsptr)
|
void storage_resetPinFails(uint32_t *pinfailsptr)
|
||||||
{
|
{
|
||||||
flash_clear_status_flags();
|
flash_clear_status_flags();
|
||||||
|
@ -56,6 +56,7 @@ bool storage_hasPin(void);
|
|||||||
void storage_setPin(const char *pin);
|
void storage_setPin(const char *pin);
|
||||||
void session_cachePin(void);
|
void session_cachePin(void);
|
||||||
bool session_isPinCached(void);
|
bool session_isPinCached(void);
|
||||||
|
void storage_clearPinArea(void);
|
||||||
void storage_resetPinFails(uint32_t *pinfailptr);
|
void storage_resetPinFails(uint32_t *pinfailptr);
|
||||||
bool storage_increasePinFails(uint32_t *pinfailptr);
|
bool storage_increasePinFails(uint32_t *pinfailptr);
|
||||||
uint32_t *storage_getPinFailsPtr(void);
|
uint32_t *storage_getPinFailsPtr(void);
|
||||||
|
@ -50,6 +50,7 @@ int main(void)
|
|||||||
storage_reset(); // wipe storage if debug link
|
storage_reset(); // wipe storage if debug link
|
||||||
storage_reset_uuid();
|
storage_reset_uuid();
|
||||||
storage_commit();
|
storage_commit();
|
||||||
|
storage_clearPinArea(); // reset PIN failures if debug link
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
oledDrawBitmap(40, 0, &bmp_logo64);
|
oledDrawBitmap(40, 0, &bmp_logo64);
|
||||||
|
Loading…
Reference in New Issue
Block a user