Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion legacy/firmware/i18n/i18n.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <stdio.h>
#include "keys.h"

#define I18N_ITEMS_COUNT 423
#define I18N_ITEMS_COUNT 427
#define I18N_LANGUAGE_ITEMS 8

typedef enum {
Expand Down
8 changes: 8 additions & 0 deletions legacy/firmware/i18n/keys.h
Original file line number Diff line number Diff line change
Expand Up @@ -885,5 +885,13 @@
#define C__INCORRECT_PIN_THE_PIN_YOU_ENTERED_IS_INCORRECT 421
// Lock the screen?
#define C__LOCK_THE_SCREEN 422
// Confirm Typed Data
#define T_CONFIRM_TYPED_DATA 423
// {} authorization. Check dApp trust first.
#define I_TYPED_DATA_AUTHORIZATION_WARNING 424
// Review Struct
#define I_REVIEW_STRUCT 425
// Tips: Press “ ” both at once to switch case / numbers / symbols.
#define C__TIPS_PRESS_BOTH_AT_ONCE_TO_SWITCH_CASE_NUMBERS_SYMBOLS 426
#endif
// clang-format on
6 changes: 5 additions & 1 deletion legacy/firmware/i18n/locales/de.inc
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ const char *const languages_de[] = {
"Memo:",
"Multi-Senden:",
"Beim Eingeben der PIN auf\n\" \" klicken, um zu\nverringern, und auf \" \"\nklicken, um zu erhöhen.",
"Beim Eingeben der PIN klicken Sie auf die Schaltfläche „ “, um zu erhöhen, und auf die Schaltfläche „ “, um zu verringern.",
"Beim Eingeben der PIN \nklicken Sie auf die Schaltfläche „ “, \num zu erhöhen, und auf die Schaltfläche „ “, \num zu verringern.",
"Transaktion aktualisieren",
"Transaktions-ID:",
"Neue Transaktionsgebühr:",
Expand Down Expand Up @@ -422,4 +422,8 @@ const char *const languages_de[] = {
"Verwaltungsschlüssel",
"Falsche PIN! Die von Ihnen eingegebene PIN ist falsch.",
"Den Bildschirm sperren?",
"Eingegebene Daten bestätigen",
"{}-Autorisierung. Überprüfe zuerst das Vertrauen in die dApp.",
"Struktur bewerten",
"Tipps: „ “drücken, um Buchstaben, Zahlen und Symbole zu wechseln.",
};
6 changes: 5 additions & 1 deletion legacy/firmware/i18n/locales/en.inc
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ const char *const languages_en[] = {
"It will temporarily allow you to perform some actions with potentially risky.",
"Are you sure to temporarily disable Safety-Checks?",
"Enter PIN",
"CAUTION!\nDevice will be reset after {} more times wrong",
"CAUTION!\nDevice will reset after {} more wrong attempts.",
"Incorrect PIN!\n0 attempt left, device\nwill be reset now...",
"Erasing...",
"Reset completed\nConfirm to restart.",
Expand Down Expand Up @@ -422,4 +422,8 @@ const char *const languages_en[] = {
"Management Security Key",
"Incorrect PIN! The PIN you entered is incorrect",
"Lock the screen?",
"Confirm Typed Data",
"{} authorization. Check dApp trust first.",
"Review Struct",
"Tips: Press “ ” both at once to switch case / numbers / symbols.",
};
4 changes: 4 additions & 0 deletions legacy/firmware/i18n/locales/es.inc
Original file line number Diff line number Diff line change
Expand Up @@ -422,4 +422,8 @@ const char *const languages_es[] = {
"Clave de Gestión",
"¡PIN incorrecto! El PIN que ingresaste es incorrecto",
"¿Bloquear la pantalla?",
"Confirmar datos escritos",
"{} autorización. Verifica primero la confiabilidad de la dApp.",
"Estructura de revisión",
"Consejos: Pulsa “ ”para cambiar entre letras, números y símbolos.",
};
4 changes: 4 additions & 0 deletions legacy/firmware/i18n/locales/ja.inc
Original file line number Diff line number Diff line change
Expand Up @@ -422,4 +422,8 @@ const char *const languages_ja[] = {
"管理セキュリティキー",
"PINが正しくありません!入力したPINが間違っています。",
"画面をロックしますか?",
"型付きデータ確認",
"{} の認可。まず dApp の信頼性を確認してください。",
"レビュー構造体",
"ヒント:「 」を押すと、文字・数字・記号を切り替えられます。",
};
6 changes: 5 additions & 1 deletion legacy/firmware/i18n/locales/ko_kr.inc
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ const char *const languages_ko_kr[] = {
"거래 유형:",
"메모:",
"멀티 전송:",
"PIN을 입력할 때, \" \" 버튼을 클릭하면 감소하고, \" \" 버튼을 클릭하면 증가합니다.",
"PIN을 입력할 때,\n \" \" 버튼을 클릭하면 감소하고,\n \" \" 버튼을 클릭하면 증가합니다.",
"PIN을 입력할 때, \" \" 버튼을 클릭하면 증가하고, \" \" 버튼을 클릭하면 감소합니다.",
"거래 업데이트",
"거래 ID:",
Expand Down Expand Up @@ -422,4 +422,8 @@ const char *const languages_ko_kr[] = {
"관리 보안 키",
"잘못된 PIN입니다! 입력하신 PIN이 올바르지 않습니다.",
"화면을 잠그시겠습니까?",
"입력된 데이터 확인",
"{} 인가. 먼저 dApp 신뢰를 확인하세요.",
"리뷰 구조체",
"팁: 대/소문자·숫자·기호를 전환하려면 “ ”을(를) 동시에 누르세요.",
};
6 changes: 5 additions & 1 deletion legacy/firmware/i18n/locales/pt_br.inc
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ const char *const languages_pt_br[] = {
"Desativar as Verificações de Segurança temporariamente?",
"Informe o PIN",
"ATENÇÃO!\nO dispositivo será reiniciado após {} tentativas incorretas adicionais.",
"PIN Incorreto! 0\ntentativas restantes o\ndispositivo será\nredefinido agora...",
"PIN Incorreto! \n0 tentativas restantes \ndispositivo será redefinido agora...",
"Apagando…",
"Redefinição concluída\nConfirme para reiniciar.",
"Inserir Passphrase",
Expand Down Expand Up @@ -422,4 +422,8 @@ const char *const languages_pt_br[] = {
"Chave de Gerenciamento",
"PIN incorreto! O PIN que você inseriu está incorreto",
"Bloquear a tela?",
"Confirmar Dados Digitados",
"Autorização de {}. Verifique a confiança do dApp primeiro.",
"Revisar Struct",
"Dicas: Pressione \" \" para alternar entre letras, números e símbolos.",
};
4 changes: 4 additions & 0 deletions legacy/firmware/i18n/locales/zh_cn.inc
Original file line number Diff line number Diff line change
Expand Up @@ -422,4 +422,8 @@ const char *const languages_zh_cn[] = {
"管理安全密钥",
"PIN 码错误!您输入的 PIN 码不正确",
"锁定屏幕?",
"确认结构化数据",
"{} 授权。请先检查 dApp 信任度。",
"审查结构体",
"提示:同时按下\" \"来切换大小写/数字/符号。",
};
4 changes: 4 additions & 0 deletions legacy/firmware/i18n/locales/zh_tw.inc
Original file line number Diff line number Diff line change
Expand Up @@ -422,4 +422,8 @@ const char *const languages_zh_tw[] = {
"管理安全金鑰",
"PIN 碼錯誤!您輸入的 PIN 碼不正確",
"鎖定螢幕?",
"確認結構數據",
"{} 授權。請先檢查 dApp 信任度。",
"檢閱結構體",
"提示:同時按下「 」來切換大小寫/數字/符號。",
};
25 changes: 22 additions & 3 deletions legacy/firmware/menu_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ static void menu_remove_pin_option(int index);
static void menu_set_new_passphrase_option(int index);
static void clear_temp_pin_data(void);
static void menu_remove_pin_from_limit_warning(void);
static uint8_t wait_for_confirm_only(uint8_t mode);
static void menu_remove_pin_input(void);
static void menu_remove_pin_confirmation(const char *pin_to_remove);
static bool require_standard_pin(bool cancel_allowed);
Expand Down Expand Up @@ -751,7 +752,7 @@ static const struct menu_item security_set_menu_items_base[] = {
{"Passphrase", NULL, false, .sub_menu = &passphrase_manage_menu, NULL, true,
NULL},
#if !BITCOIN_ONLY
{"FIDO Keys", NULL, true, menu_fido2_resident_credential, NULL, false,
{"Security Keys", NULL, true, menu_fido2_resident_credential, NULL, false,
NULL},
#endif
{"Reset Device", NULL, true, menu_erase_device, NULL, false, NULL},
Expand Down Expand Up @@ -1192,7 +1193,7 @@ static uint8_t menu_attach_passphrase_warning_pagination(
layoutDialogCenterAdapterV2(
_(T__SAVE_PASSPHRASE), NULL, NULL, &bmp_bottom_right_arrow, NULL,
NULL, NULL, NULL, NULL, NULL, _(C__PASSPHRASE_SAVE_DESC));
uint8_t save_key = protectWaitKey(0, 1);
uint8_t save_key = wait_for_confirm_only(0);
if (save_key == KEY_CONFIRM) {
secbool pin_unlocked = se_getSecsta();

Expand Down Expand Up @@ -1224,7 +1225,7 @@ static uint8_t menu_attach_passphrase_warning_pagination(
NULL, &bmp_icon_ok, NULL, &bmp_bottom_right_arrow, NULL, NULL,
NULL, NULL, NULL, NULL,
_(C__PASSPHRASE_SET_AND_ATTACHED_TO_PIN));
protectWaitKey(0, 1);
wait_for_confirm_only(1);

if (override) {
session_clear(true);
Expand Down Expand Up @@ -1272,6 +1273,24 @@ static void clear_temp_pin_data(void) {
memset(g_temp_main_pin, 0, sizeof(g_temp_main_pin));
}

static uint8_t wait_for_confirm_only(uint8_t mode) {
while (1) {
uint8_t key = protectWaitKey(0, mode);
if (key == KEY_CONFIRM) {
return KEY_CONFIRM;
}
if (key == KEY_CANCEL) {
if (protectAbortedByCancel) {
return KEY_CANCEL;
}
continue;
}
if (key == KEY_NULL) {
return KEY_NULL;
}
}
}

static bool require_standard_pin(bool cancel_allowed) {
while (1) {
const char *pin_title;
Expand Down
18 changes: 18 additions & 0 deletions legacy/firmware/protect.c
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,7 @@ bool protectChangePinOnDevice(bool is_prompt, bool set, bool cancel_allowed) {
pin_result_t pin_result = PIN_SUCCESS;
bool deleted_passphrase_pin = false;
bool deleted_passphrase_current = false;
bool lock_required = false;

pin_set:
if (config_hasPin()) {
Expand Down Expand Up @@ -1367,6 +1368,7 @@ bool protectChangePinOnDevice(bool is_prompt, bool set, bool cancel_allowed) {
if (is_current) {
is_passphrase_pin_enabled = false;
}
lock_required = is_current;
break;
} else {
layoutDialogCenterAdapterV2(
Expand Down Expand Up @@ -1461,6 +1463,7 @@ bool protectChangePinOnDevice(bool is_prompt, bool set, bool cancel_allowed) {
memzero(new_pin, sizeof(new_pin));
if (deleted_passphrase_pin && deleted_passphrase_current) {
is_passphrase_pin_enabled = false;
lock_required = true;
}
if (is_prompt) {
layoutDialogCenterAdapter(
Expand All @@ -1475,6 +1478,21 @@ bool protectChangePinOnDevice(bool is_prompt, bool set, bool cancel_allowed) {
}
}
}
if (lock_required) {
session_clear(true); // lock after confirmation when main PIN replaces
// passphrase PIN
layoutHome();
se_clearPinStateCache();
for (int attempt = 0; attempt < 5; ++attempt) {
bool unlocked = session_isUnlocked();
if (!unlocked) {
break;
}
se_clearSecsta();
delay_ms(100);
se_clearPinStateCache();
}
}
}
return ret;
}
Expand Down
Loading