diff --git a/core/src/boot.py b/core/src/boot.py index 8b94b379c1..dd7a418c24 100644 --- a/core/src/boot.py +++ b/core/src/boot.py @@ -20,6 +20,9 @@ from trezor.ui.layouts.homescreen import Lockscreen 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 # with the correct value during the build process # pylint: disable-next=consider-using-in @@ -68,7 +71,9 @@ async def bootscreen() -> None: allow_all_loader_messages() return else: - await verify_user_pin() + # 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() storage.init_unlocked() enforce_welcome_screen_duration() rotation = storage.device.get_rotation() @@ -94,8 +99,9 @@ async def bootscreen() -> None: utils.halt(e.__class__.__name__) -# Ignoring all non-PIN messages in the boot-phase (turned off in `bootscreen()`). -ignore_nonpin_loader_messages() +# Ignore all automated PIN messages in the boot-phase (turned off in `bootscreen()`), unless Optiga throttling delays are active. +if not utils.USE_OPTIGA or (optiga.get_sec() or 0) < 150: + ignore_nonpin_loader_messages() config.init(show_pin_timeout) translations.init() diff --git a/storage/storage.c b/storage/storage.c index 7c3d32116d..e4f4632c38 100644 --- a/storage/storage.c +++ b/storage/storage.c @@ -779,7 +779,11 @@ static void init_wiped_storage(void) { "set_wipe_code failed"); ui_progress_init(STORAGE_PIN_OP_SET); - ui_message = PROCESSING_MSG; + if (ui_message == NO_MSG) { + ui_message = STARTING_MSG; + } else { + ui_message = PROCESSING_MSG; + } ensure(set_pin(PIN_EMPTY, PIN_EMPTY_LEN, NULL), "init_pin failed"); ui_progress_finish(); }