diff --git a/storage.c b/storage.c index 6e0f1144a4..992805eebb 100644 --- a/storage.c +++ b/storage.c @@ -745,14 +745,18 @@ secbool storage_unlock(uint32_t pin) } else { progress = ((wait - rem) * 10 + i) * 100 / wait; } - ui_callback(rem, progress); + if (sectrue == ui_callback(rem, progress)) { + return secfalse; + } } hal_delay(100); } } // Show last frame if we were waiting if ((wait > 0) && ui_callback) { - ui_callback(0, 1000); + if (sectrue == ui_callback(0, 1000)) { + return secfalse; + } } // First, we increase PIN fail counter in storage, even before checking the diff --git a/storage.h b/storage.h index 5c62d92ee4..2c8ca48f62 100644 --- a/storage.h +++ b/storage.h @@ -24,7 +24,7 @@ #include #include "secbool.h" -typedef void (*PIN_UI_WAIT_CALLBACK)(uint32_t wait, uint32_t progress); +typedef secbool (*PIN_UI_WAIT_CALLBACK)(uint32_t wait, uint32_t progress); void storage_init(PIN_UI_WAIT_CALLBACK callback, const uint8_t *salt, const uint16_t salt_len); void storage_wipe(void);