1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-15 19:08:07 +00:00

Support interruption of the PIN wait dialog by Cancel and Initialize messages.

This commit is contained in:
andrew 2019-02-06 19:01:06 +01:00 committed by Pavol Rusnak
parent e49e84ea5a
commit 03e9ea4f5c
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
4 changed files with 12 additions and 13 deletions

View File

@ -345,9 +345,6 @@ void config_init(void)
// TODO Add salt.
storage_init(&protectPinUiCallback, (const uint8_t*)"", 0);
// TODO Remove
storage_unlock(1);
uint16_t len = 0;
if (sectrue == storage_get(KEY_UUID, config_uuid, sizeof(config_uuid), &len) && len == sizeof(config_uuid)) {
data2hex(config_uuid, sizeof(config_uuid), config_uuid_str);
@ -643,7 +640,7 @@ bool config_setMnemonic(const char *mnemonic)
return false;
}
if (sectrue != config_set_bool(KEY_INITIALIZED, true)) {
if (!config_set_bool(KEY_INITIALIZED, true)) {
storage_delete(KEY_MNEMONIC);
return false;
}

View File

@ -147,7 +147,7 @@ const char *requestPin(PinMatrixRequestType type, const char *text)
}
}
void protectPinUiCallback(uint32_t wait, uint32_t progress)
secbool protectPinUiCallback(uint32_t wait, uint32_t progress)
{
(void) progress;
@ -166,16 +166,17 @@ void protectPinUiCallback(uint32_t wait, uint32_t progress)
}
layoutDialog(&bmp_icon_info, NULL, NULL, NULL, _("Wrong PIN entered"), NULL, _("Please wait"), secstr, _("to continue ..."), NULL);
/* TODO
if (msg_tiny_id == MessageType_MessageType_Initialize) {
protectAbortedByCancel = false;
protectAbortedByInitialize = true;
// Check for Cancel / Initialize.
protectAbortedByCancel = (msg_tiny_id == MessageType_MessageType_Cancel);
protectAbortedByInitialize = (msg_tiny_id == MessageType_MessageType_Initialize);
if (protectAbortedByCancel || protectAbortedByInitialize) {
msg_tiny_id = 0xFFFF;
usbTiny(0);
fsm_sendFailure(FailureType_Failure_PinCancelled, NULL);
return false;
return sectrue;
}
*/
return secfalse;
}
bool protectPin(bool use_cached)

View File

@ -22,9 +22,10 @@
#include <stdbool.h>
#include "messages-common.pb.h"
#include "secbool.h"
bool protectButton(ButtonRequestType type, bool confirm_only);
void protectPinUiCallback(uint32_t wait, uint32_t progress);
secbool protectPinUiCallback(uint32_t wait, uint32_t progress);
bool protectPin(bool use_cached);
bool protectChangePin(bool removal);
bool protectPassphrase(void);

@ -1 +1 @@
Subproject commit 6d9a4962a427717100517d59a4dcc1012199f0f5
Subproject commit 4429888b9325d200b699a90f7a0e1a07d08f09c0