1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-16 19:38:09 +00:00

Interrupt the PIN wait dialog if the PIN_UI_WAIT_CALLBACK function returns sectrue.

This commit is contained in:
andrew 2019-02-06 13:43:15 +01:00
parent 6d9a4962a4
commit 47cd563c81
2 changed files with 7 additions and 3 deletions

View File

@ -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

View File

@ -24,7 +24,7 @@
#include <stddef.h>
#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);