mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-07 22:10:57 +00:00
adjust reset_device loop to match recovery_device loop
This commit is contained in:
parent
cf95f50997
commit
9d1cc7933d
@ -94,11 +94,11 @@ void reset_entropy(const uint8_t *ext_entropy, uint32_t len)
|
|||||||
memset(int_entropy, 0, 32);
|
memset(int_entropy, 0, 32);
|
||||||
awaiting_entropy = false;
|
awaiting_entropy = false;
|
||||||
|
|
||||||
int pass, idx, i = 0, j;
|
int pass, word_pos, i = 0, j;
|
||||||
|
|
||||||
for (pass = 0; pass < 2; pass++) {
|
for (pass = 0; pass < 2; pass++) {
|
||||||
i = 0;
|
i = 0;
|
||||||
for (idx = 0; idx < (int)strength/32*3; idx++) {
|
for (word_pos = 1; word_pos <= (int)strength/32*3; word_pos++) {
|
||||||
// copy current_word
|
// copy current_word
|
||||||
j = 0;
|
j = 0;
|
||||||
while (storage.mnemonic[i] != ' ' && storage.mnemonic[i] != 0 && j + 1 < (int)sizeof(current_word)) {
|
while (storage.mnemonic[i] != ' ' && storage.mnemonic[i] != 0 && j + 1 < (int)sizeof(current_word)) {
|
||||||
@ -106,25 +106,33 @@ void reset_entropy(const uint8_t *ext_entropy, uint32_t len)
|
|||||||
i++; j++;
|
i++; j++;
|
||||||
}
|
}
|
||||||
current_word[j] = 0; if (storage.mnemonic[i] != 0) i++;
|
current_word[j] = 0; if (storage.mnemonic[i] != 0) i++;
|
||||||
char descbuf[] = "__. word is:";
|
char desc[] = "##th word";
|
||||||
char *desc = descbuf;
|
if (word_pos < 10) {
|
||||||
if (idx + 1 < 10) {
|
desc[0] = ' ';
|
||||||
desc++;
|
|
||||||
} else {
|
} else {
|
||||||
descbuf[0] = '0' + (idx + 1) / 10;
|
desc[0] = '0' + word_pos / 10;
|
||||||
}
|
}
|
||||||
descbuf[1] = '0' + (idx + 1) % 10;
|
desc[1] = '0' + word_pos % 10;
|
||||||
if (idx + 1 == (int)strength/32*3) { // last word
|
if (word_pos == 1 || word_pos == 21) {
|
||||||
|
desc[2] = 's'; desc[3] = 't';
|
||||||
|
} else
|
||||||
|
if (word_pos == 2 || word_pos == 22) {
|
||||||
|
desc[2] = 'n'; desc[3] = 'd';
|
||||||
|
} else
|
||||||
|
if (word_pos == 3 || word_pos == 23) {
|
||||||
|
desc[2] = 'r'; desc[3] = 'd';
|
||||||
|
}
|
||||||
|
if (word_pos == (int)strength/32*3) { // last word
|
||||||
if (pass == 1) {
|
if (pass == 1) {
|
||||||
layoutDialogSwipe(DIALOG_ICON_INFO, NULL, "Finish", NULL, "Please check the seed", NULL, desc, NULL, current_word, NULL);
|
layoutDialogSwipe(DIALOG_ICON_INFO, NULL, "Finish", NULL, "Please check the seed", NULL, (word_pos < 10 ? desc + 1 : desc), NULL, current_word, NULL);
|
||||||
} else {
|
} else {
|
||||||
layoutDialogSwipe(DIALOG_ICON_INFO, NULL, "Again", NULL, "Write down the seed", NULL, desc, NULL, current_word, NULL);
|
layoutDialogSwipe(DIALOG_ICON_INFO, NULL, "Again", NULL, "Write down the seed", NULL, (word_pos < 10 ? desc + 1 : desc), NULL, current_word, NULL);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (pass == 1) {
|
if (pass == 1) {
|
||||||
layoutDialogSwipe(DIALOG_ICON_INFO, NULL, "Next", NULL, "Please check the seed", NULL, desc, NULL, current_word, NULL);
|
layoutDialogSwipe(DIALOG_ICON_INFO, NULL, "Next", NULL, "Please check the seed", NULL, (word_pos < 10 ? desc + 1 : desc), NULL, current_word, NULL);
|
||||||
} else {
|
} else {
|
||||||
layoutDialogSwipe(DIALOG_ICON_INFO, NULL, "Next", NULL, "Write down the seed", NULL, desc, NULL, current_word, NULL);
|
layoutDialogSwipe(DIALOG_ICON_INFO, NULL, "Next", NULL, "Write down the seed", NULL, (word_pos < 10 ? desc + 1 : desc), NULL, current_word, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!protectButton(ButtonRequestType_ButtonRequest_ConfirmWord, true)) {
|
if (!protectButton(ButtonRequestType_ButtonRequest_ConfirmWord, true)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user