mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-18 20:38:10 +00:00
storage: rename constant
This commit is contained in:
parent
b6ba95625c
commit
353883e0f3
@ -11,7 +11,7 @@
|
|||||||
#include "../../trezorhal/flash.h"
|
#include "../../trezorhal/flash.h"
|
||||||
|
|
||||||
// Byte-length of flash sector containing fail counters.
|
// Byte-length of flash sector containing fail counters.
|
||||||
#define PIN_AREA_LEN 0x4000
|
#define PIN_SECTOR_SIZE 0x4000
|
||||||
|
|
||||||
// Maximum number of failed unlock attempts.
|
// Maximum number of failed unlock attempts.
|
||||||
#define PIN_MAX_TRIES 15
|
#define PIN_MAX_TRIES 15
|
||||||
@ -34,7 +34,7 @@ bool storage_init(void)
|
|||||||
|
|
||||||
static void pin_fails_reset(uint32_t ofs)
|
static void pin_fails_reset(uint32_t ofs)
|
||||||
{
|
{
|
||||||
if (ofs + sizeof(uint32_t) >= PIN_AREA_LEN) {
|
if (ofs + sizeof(uint32_t) >= PIN_SECTOR_SIZE) {
|
||||||
// ofs points to the last word of the PIN fails area. Because there is
|
// ofs points to the last word of the PIN fails area. Because there is
|
||||||
// no space left, we recycle the sector (set all words to 0xffffffff).
|
// no space left, we recycle the sector (set all words to 0xffffffff).
|
||||||
// On next unlock attempt, we start counting from the the first word.
|
// On next unlock attempt, we start counting from the the first word.
|
||||||
@ -87,7 +87,7 @@ static bool pin_fails_read(uint32_t *ofs, uint32_t *ctr)
|
|||||||
if (!ofs || !ctr) {
|
if (!ofs || !ctr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (uint32_t o = 0; o < PIN_AREA_LEN; o += sizeof(uint32_t)) {
|
for (uint32_t o = 0; o < PIN_SECTOR_SIZE; o += sizeof(uint32_t)) {
|
||||||
uint32_t c = 0;
|
uint32_t c = 0;
|
||||||
if (!flash_read_word_rel(FLASH_SECTOR_PIN_AREA, o, &c)) {
|
if (!flash_read_word_rel(FLASH_SECTOR_PIN_AREA, o, &c)) {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user