1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-18 04:18:10 +00:00

legacy: show passphrase on device

This commit is contained in:
Pavol Rusnak 2020-07-10 15:24:17 +02:00 committed by Tomas Susanka
parent ed989eb76a
commit e2632b16dc
3 changed files with 44 additions and 0 deletions

View File

@ -597,6 +597,30 @@ const uint8_t *config_getSeed(void) {
memzero(passphrase, sizeof(passphrase));
return NULL;
}
// passphrase is used - confirm on the display
if (passphrase[0] != 0) {
layoutDialogSwipe(&bmp_icon_question, _("Cancel"), _("Confirm"), NULL,
_("Access hidden wallet?"), NULL,
_("Next screen will show"), _("the passphrase!"), NULL,
NULL);
if (!protectButton(ButtonRequestType_ButtonRequest_Other, false)) {
memzero(mnemonic, sizeof(mnemonic));
memzero(passphrase, sizeof(passphrase));
fsm_sendFailure(FailureType_Failure_ActionCancelled,
_("Passphrase dismissed"));
layoutHome();
return NULL;
}
layoutShowPassphrase(passphrase);
if (!protectButton(ButtonRequestType_ButtonRequest_Other, false)) {
memzero(mnemonic, sizeof(mnemonic));
memzero(passphrase, sizeof(passphrase));
fsm_sendFailure(FailureType_Failure_ActionCancelled,
_("Passphrase dismissed"));
layoutHome();
return NULL;
}
}
// if storage was not imported (i.e. it was properly generated or recovered)
bool imported = false;
config_get_bool(KEY_IMPORTED, &imported);

View File

@ -823,6 +823,25 @@ void layoutU2FDialog(const char *verb, const char *appname) {
#endif
void layoutShowPassphrase(const char *passphrase) {
if (layoutLast != layoutShowPassphrase) {
layoutSwipe();
} else {
oledClear();
}
const char **str =
split_message((const uint8_t *)passphrase, strlen(passphrase), 21);
for (int i = 0; i < 3; i++) {
oledDrawString(0, i * 9 + 4, str[i], FONT_FIXED);
}
oledDrawStringCenter(OLED_WIDTH / 2, OLED_HEIGHT - 2 * 9 - 1,
_("Use this passphrase?"), FONT_STANDARD);
oledHLine(OLED_HEIGHT - 21);
layoutButtonNo(_("Cancel"), &bmp_btn_cancel);
layoutButtonYes(_("Confirm"), &bmp_btn_confirm);
oledRefresh();
}
#if !BITCOIN_ONLY
void layoutNEMDialog(const BITMAP *icon, const char *btnNo, const char *btnYes,

View File

@ -69,6 +69,7 @@ void layoutXPUB(const char *xpub, int index, int page, bool ours);
void layoutSignIdentity(const IdentityType *identity, const char *challenge);
void layoutDecryptIdentity(const IdentityType *identity);
void layoutU2FDialog(const char *verb, const char *appname);
void layoutShowPassphrase(const char *passphrase);
void layoutNEMDialog(const BITMAP *icon, const char *btnNo, const char *btnYes,
const char *desc, const char *line1, const char *address);