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

storage: refactor default/minimum lock storage, change default values

This commit is contained in:
Pavol Rusnak 2018-04-10 23:46:05 +02:00
parent 14233fcc26
commit 783f1c0323
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

View File

@ -882,13 +882,15 @@ void storage_setU2FCounter(uint32_t u2fcounter)
uint32_t storage_getAutoLockDelayMs()
{
return storageRom->has_auto_lock_delay_ms ? storageRom->auto_lock_delay_ms : (10*60*1000U);
const uint32_t default_delay_ms = 10 * 60 * 1000U; // 10 minutes
return storageRom->has_auto_lock_delay_ms ? storageRom->auto_lock_delay_ms : default_delay_ms;
}
void storage_setAutoLockDelayMs(uint32_t auto_lock_delay_ms)
{
const uint32_t min_delay_ms = 10 * 1000U; // 10 seconds
auto_lock_delay_ms = MAX(auto_lock_delay_ms, min_delay_ms);
storageUpdate.has_auto_lock_delay_ms = true;
auto_lock_delay_ms = MAX(auto_lock_delay_ms, 60*1000U);
storageUpdate.auto_lock_delay_ms = auto_lock_delay_ms;
}