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

legacy: make fake/real words indistinguishable in simple recovery

This commit is contained in:
Pavol Rusnak 2019-07-31 16:52:03 +02:00
parent ddd3e9c577
commit d9c02bb924
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

View File

@ -444,34 +444,25 @@ static void recovery_digit(const char digit) {
* Ask the user for the next word. * Ask the user for the next word.
*/ */
void next_word(void) { void next_word(void) {
layoutLast = layoutDialogSwipe;
layoutSwipe();
oledDrawStringCenter(OLED_WIDTH / 2, 8, _("Please enter"), FONT_STANDARD);
word_pos = word_order[word_index]; word_pos = word_order[word_index];
if (word_pos == 0) { if (word_pos == 0) {
const char *const *wl = mnemonic_wordlist(); const char *const *wl = mnemonic_wordlist();
strlcpy(fake_word, wl[random_uniform(2048)], sizeof(fake_word)); strlcpy(fake_word, wl[random_uniform(2048)], sizeof(fake_word));
layoutLast = layoutDialogSwipe;
layoutSwipe();
oledDrawStringCenter(OLED_WIDTH / 2, 8, _("Please enter the word"), FONT_STANDARD);
oledDrawStringCenter(OLED_WIDTH / 2, 24, fake_word, FONT_FIXED | FONT_DOUBLE); oledDrawStringCenter(OLED_WIDTH / 2, 24, fake_word, FONT_FIXED | FONT_DOUBLE);
oledDrawStringCenter(OLED_WIDTH / 2, 48, _("on your computer"), FONT_STANDARD);
// 30 is the maximum pixels used for a pixel row in the BIP39 word "abstract"
oledSCA(24 - 2, 24 + 15 + 2, 30);
oledInvert(0, 24 - 2, OLED_WIDTH - 1, 24 + 15 + 2);
oledRefresh();
} else { } else {
fake_word[0] = 0; fake_word[0] = 0;
char desc[] = "##th word"; char desc[] = "the ##th word";
format_number(desc, word_pos); format_number(desc + 4, word_pos);
layoutLast = layoutDialogSwipe; oledDrawStringCenter(OLED_WIDTH / 2, 24, desc, FONT_FIXED | FONT_DOUBLE);
layoutSwipe(); }
oledDrawStringCenter(OLED_WIDTH / 2, 8, _("Please enter the"), FONT_STANDARD); oledDrawStringCenter(OLED_WIDTH / 2, 48, _("on your computer"), FONT_STANDARD);
oledDrawStringCenter(OLED_WIDTH / 2, 24, (word_pos < 10 ? desc + 1 : desc), FONT_FIXED | FONT_DOUBLE); // 35 is the maximum pixels used for a pixel row ("the 21st word")
oledDrawStringCenter(OLED_WIDTH / 2, 48, _("of your mnemonic"), FONT_STANDARD); oledSCA(24 - 2, 24 + 15 + 2, 35);
// 30 is the maximum pixels used for a pixel row in the BIP39 word "abstract"
oledSCA(24 - 2, 24 + 15 + 2, 30);
oledInvert(0, 24 - 2, OLED_WIDTH - 1, 24 + 15 + 2); oledInvert(0, 24 - 2, OLED_WIDTH - 1, 24 + 15 + 2);
oledRefresh(); oledRefresh();
}
recovery_request(); recovery_request();
} }