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

refactor u2f dialogs into a separate function

This commit is contained in:
Pavol Rusnak 2016-05-16 18:58:13 +02:00
parent ad2bab0186
commit 041eaa5e4b
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
3 changed files with 7 additions and 6 deletions

View File

@ -335,3 +335,7 @@ void layoutSignIdentity(const IdentityType *identity, const char *challenge)
NULL,
NULL);
}
void layoutU2FDialog(const char *verb, const char *appid) {
layoutDialog(DIALOG_ICON_QUESTION, "Cancel", verb, NULL, verb, "U2F security key?", "", appid, "", NULL);
}

View File

@ -40,5 +40,6 @@ void layoutDecryptMessage(const uint8_t *msg, uint32_t len, const char *address)
void layoutAddress(const char *address, const char *desc);
void layoutPublicKey(const uint8_t *pubkey);
void layoutSignIdentity(const IdentityType *identity, const char *challenge);
void layoutU2FDialog(const char *verb, const char *appid);
#endif

View File

@ -568,9 +568,7 @@ void u2f_register(const APDU *a)
// error: testof-user-presence is required
send_u2f_error(U2F_SW_CONDITIONS_NOT_SATISFIED);
buttonUpdate(); // Clear button state
layoutDialog(DIALOG_ICON_QUESTION, "Cancel", "Register",
NULL, "Register U2F", "security key",
"", getReadableAppId(req->appId), "", NULL);
layoutU2FDialog("Register", getReadableAppId(req->appId));
dialog_timeout = U2F_TIMEOUT;
last_req_state = REG;
return;
@ -701,9 +699,7 @@ void u2f_authenticate(const APDU *a)
// error: testof-user-presence is required
send_u2f_error(U2F_SW_CONDITIONS_NOT_SATISFIED);
buttonUpdate(); // Clear button state
layoutDialog(DIALOG_ICON_QUESTION, "Cancel", "Authenticate", NULL,
"Authenticate U2F", "security key",
"", getReadableAppId(req->appId), "", NULL);
layoutU2FDialog("Authenticate", getReadableAppId(req->appId));
dialog_timeout = U2F_TIMEOUT;
last_req_state = AUTH;
return;