1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-14 03:30:02 +00:00

legacy: use fixed font for showing internal entropy

(cherry picked from commit 3b1f44945a)
This commit is contained in:
Pavol Rusnak 2019-07-31 18:34:33 +02:00
parent 93ef10d564
commit ee95e58f4a
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

View File

@ -23,6 +23,7 @@
#include "fsm.h"
#include "gettext.h"
#include "layout2.h"
#include "oled.h"
#include "memzero.h"
#include "messages.h"
#include "messages.pb.h"
@ -65,20 +66,36 @@ void reset_init(bool display_random, uint32_t _strength,
random_buffer(int_entropy, 32);
char ent_str[4][17];
data2hex(int_entropy, 8, ent_str[0]);
data2hex(int_entropy + 8, 8, ent_str[1]);
data2hex(int_entropy + 16, 8, ent_str[2]);
data2hex(int_entropy + 24, 8, ent_str[3]);
if (display_random) {
layoutDialogSwipe(&bmp_icon_info, _("Cancel"), _("Continue"), NULL,
_("Internal entropy:"), ent_str[0], ent_str[1],
ent_str[2], ent_str[3], NULL);
if (!protectButton(ButtonRequestType_ButtonRequest_ResetDevice, false)) {
fsm_sendFailure(FailureType_Failure_ActionCancelled, NULL);
layoutHome();
return;
for (int start = 0; start < 2; start++) {
char ent_str[4][17];
char desc[] = "Internal entropy _/2:";
data2hex(int_entropy + start * 16, 4, ent_str[0]);
data2hex(int_entropy + start * 16 + 4, 4, ent_str[1]);
data2hex(int_entropy + start * 16 + 8, 4, ent_str[2]);
data2hex(int_entropy + start * 16 + 12, 4, ent_str[3]);
layoutLast = layoutDialogSwipe;
layoutSwipe();
desc[17] = '1' + start;
oledDrawStringCenter(OLED_WIDTH / 2, 0, desc, FONT_STANDARD);
oledDrawStringCenter(OLED_WIDTH / 2, 2 + 1 * 9, ent_str[0], FONT_FIXED);
oledDrawStringCenter(OLED_WIDTH / 2, 2 + 2 * 9, ent_str[1], FONT_FIXED);
oledDrawStringCenter(OLED_WIDTH / 2, 2 + 3 * 9, ent_str[2], FONT_FIXED);
oledDrawStringCenter(OLED_WIDTH / 2, 2 + 4 * 9, ent_str[3], FONT_FIXED);
oledHLine(OLED_HEIGHT - 13);
layoutButtonNo(_("Cancel"));
layoutButtonYes(_("Continue"));
// 40 is the maximum pixels used for a row
oledSCA(2 + 1 * 9, 2 + 1 * 9 + 6, 40);
oledSCA(2 + 2 * 9, 2 + 2 * 9 + 6, 40);
oledSCA(2 + 3 * 9, 2 + 3 * 9 + 6, 40);
oledSCA(2 + 4 * 9, 2 + 4 * 9 + 6, 40);
oledRefresh();
if (!protectButton(ButtonRequestType_ButtonRequest_ResetDevice, false)) {
fsm_sendFailure(FailureType_Failure_ActionCancelled, NULL);
layoutHome();
return;
}
}
}