mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 23:48:12 +00:00
embed/extmod/modtrezorconfig: small refactor to storage
This commit is contained in:
parent
113a557f17
commit
b3e668db8b
@ -129,7 +129,7 @@ static secbool pin_get_fails(const uint32_t **pinfail, uint32_t *pofs)
|
|||||||
return sectrue;
|
return sectrue;
|
||||||
}
|
}
|
||||||
|
|
||||||
secbool storage_check_pin(uint32_t pin)
|
secbool storage_check_pin(const uint32_t pin)
|
||||||
{
|
{
|
||||||
const uint32_t *pinfail = NULL;
|
const uint32_t *pinfail = NULL;
|
||||||
uint32_t ofs;
|
uint32_t ofs;
|
||||||
@ -189,7 +189,7 @@ secbool storage_unlock(const uint32_t pin)
|
|||||||
return unlocked;
|
return unlocked;
|
||||||
}
|
}
|
||||||
|
|
||||||
secbool storage_get(uint16_t key, const void **val, uint16_t *len)
|
secbool storage_get(const uint16_t key, const void **val, uint16_t *len)
|
||||||
{
|
{
|
||||||
const uint8_t app = key >> 8;
|
const uint8_t app = key >> 8;
|
||||||
// APP == 0 is reserved for PIN related values
|
// APP == 0 is reserved for PIN related values
|
||||||
@ -203,7 +203,7 @@ secbool storage_get(uint16_t key, const void **val, uint16_t *len)
|
|||||||
return norcow_get(key, val, len);
|
return norcow_get(key, val, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
secbool storage_set(uint16_t key, const void *val, uint16_t len)
|
secbool storage_set(const uint16_t key, const void *val, uint16_t len)
|
||||||
{
|
{
|
||||||
const uint8_t app = key >> 8;
|
const uint8_t app = key >> 8;
|
||||||
// APP == 0 is reserved for PIN related values
|
// APP == 0 is reserved for PIN related values
|
||||||
|
@ -28,11 +28,11 @@ typedef void (*PIN_UI_WAIT_CALLBACK)(uint32_t wait, uint32_t progress);
|
|||||||
|
|
||||||
void storage_init(PIN_UI_WAIT_CALLBACK callback);
|
void storage_init(PIN_UI_WAIT_CALLBACK callback);
|
||||||
void storage_wipe(void);
|
void storage_wipe(void);
|
||||||
secbool storage_check_pin(uint32_t pin);
|
secbool storage_check_pin(const uint32_t pin);
|
||||||
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_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(uint16_t key, const void **val, uint16_t *len);
|
secbool storage_get(const uint16_t key, const void **val, uint16_t *len);
|
||||||
secbool storage_set(uint16_t key, const void *val, uint16_t len);
|
secbool storage_set(const uint16_t key, const void *val, uint16_t len);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -81,7 +81,7 @@ const void *flash_get_address(uint8_t sector, uint32_t offset, uint32_t size)
|
|||||||
if (addr + size > next) {
|
if (addr + size > next) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return addr;
|
return (const void *)addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
secbool flash_erase_sectors(const uint8_t *sectors, int len, void (*progress)(int pos, int len))
|
secbool flash_erase_sectors(const uint8_t *sectors, int len, void (*progress)(int pos, int len))
|
||||||
|
Loading…
Reference in New Issue
Block a user