1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-18 19:31:04 +00:00

feat(core): Show PIN initialization progress when Optiga throttling delays are active

This commit is contained in:
Andrew Kozlik 2024-07-06 16:36:03 +02:00 committed by Andrew Kozlik
parent 9420b38a35
commit a4cf0b2c72
2 changed files with 14 additions and 4 deletions

View File

@ -20,6 +20,9 @@ from trezor.ui.layouts.homescreen import Lockscreen
from apps.common.request_pin import can_lock_device, verify_user_pin from apps.common.request_pin import can_lock_device, verify_user_pin
if utils.USE_OPTIGA:
from trezor.crypto import optiga
# have to use "==" over "in (list)" so that it can be statically replaced # have to use "==" over "in (list)" so that it can be statically replaced
# with the correct value during the build process # with the correct value during the build process
# pylint: disable-next=consider-using-in # pylint: disable-next=consider-using-in
@ -68,6 +71,8 @@ async def bootscreen() -> None:
allow_all_loader_messages() allow_all_loader_messages()
return return
else: else:
# Even if PIN is not configured, storage needs to be unlocked, unless it has just been initialized.
if not config.is_unlocked():
await verify_user_pin() await verify_user_pin()
storage.init_unlocked() storage.init_unlocked()
enforce_welcome_screen_duration() enforce_welcome_screen_duration()
@ -94,8 +99,9 @@ async def bootscreen() -> None:
utils.halt(e.__class__.__name__) utils.halt(e.__class__.__name__)
# Ignoring all non-PIN messages in the boot-phase (turned off in `bootscreen()`). # Ignore all automated PIN messages in the boot-phase (turned off in `bootscreen()`), unless Optiga throttling delays are active.
ignore_nonpin_loader_messages() if not utils.USE_OPTIGA or (optiga.get_sec() or 0) < 150:
ignore_nonpin_loader_messages()
config.init(show_pin_timeout) config.init(show_pin_timeout)
translations.init() translations.init()

View File

@ -779,7 +779,11 @@ static void init_wiped_storage(void) {
"set_wipe_code failed"); "set_wipe_code failed");
ui_progress_init(STORAGE_PIN_OP_SET); ui_progress_init(STORAGE_PIN_OP_SET);
if (ui_message == NO_MSG) {
ui_message = STARTING_MSG;
} else {
ui_message = PROCESSING_MSG; ui_message = PROCESSING_MSG;
}
ensure(set_pin(PIN_EMPTY, PIN_EMPTY_LEN, NULL), "init_pin failed"); ensure(set_pin(PIN_EMPTY, PIN_EMPTY_LEN, NULL), "init_pin failed");
ui_progress_finish(); ui_progress_finish();
} }