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
5 changes: 4 additions & 1 deletion legacy/firmware/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,11 @@ bool config_verifyPin(const char *pin, pin_type_t pin_type) {
if (!passphrase_protection && pin_type == PIN_TYPE_USER_AND_PASSPHRASE_PIN) {
pin_type = PIN_TYPE_USER;
}
bool is_check_type = (pin_type == PIN_TYPE_USER_CHECK ||
pin_type == PIN_TYPE_PASSPHRASE_PIN_CHECK ||
pin_type == PIN_TYPE_USER_AND_PASSPHRASE_PIN_CHECK);
bool result = (sectrue == se_verifyPin(pin, pin_type));
if (!result) {
if (!result && !is_check_type) {
se_clearPinStateCache();
is_passphrase_pin_enabled = false;
session_seed_cached_btc = false;
Expand Down
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 427
#define I18N_ITEMS_COUNT 430
#define I18N_LANGUAGE_ITEMS 8

typedef enum {
Expand Down
34 changes: 20 additions & 14 deletions legacy/firmware/i18n/keys.h
Original file line number Diff line number Diff line change
Expand Up @@ -867,31 +867,37 @@
#define C__PIN_ALREADY_USED_DO_YOU_WANT_TO_OVERWRITE_IT 412
// PIN already used! Please try a different one
#define C__PIN_ALREADY_USED_PLEASE_TRY_A_DIFFERENT_ONE 413
// Before start, verify your Standard Wallet PIN
#define C__BEFORE_START_VERIFY_YOUR_TANDARD_WALLET_PIN 414
// TRON Energy Rental
#define T_ENERGY_RENTAL 415
#define T_ENERGY_RENTAL 414
// Recipient is a known energy rental service provider address.
#define I_ENERGY_RENTAL 416
#define I_ENERGY_RENTAL 415
// Confirm Phrase
#define T__CONFIRM_PHRASE 417
#define T__CONFIRM_PHRASE 416
// Save Passphrase
#define T__SAVE_PASSPHRASE 418
#define T__SAVE_PASSPHRASE 417
// Remove PIN
#define T__REMOVE_PIN 419
#define T__REMOVE_PIN 418
// Management Security Key
#define M__MANAGEMENT_SECURITY_KEY 420
#define M__MANAGEMENT_SECURITY_KEY 419
// Incorrect PIN! The PIN you entered is incorrect
#define C__INCORRECT_PIN_THE_PIN_YOU_ENTERED_IS_INCORRECT 421
#define C__INCORRECT_PIN_THE_PIN_YOU_ENTERED_IS_INCORRECT 420
// Lock the screen?
#define C__LOCK_THE_SCREEN 422
#define C__LOCK_THE_SCREEN 421
// Confirm Typed Data
#define T_CONFIRM_TYPED_DATA 423
#define T_CONFIRM_TYPED_DATA 422
// {} authorization. Check dApp trust first.
#define I_TYPED_DATA_AUTHORIZATION_WARNING 424
#define I_TYPED_DATA_AUTHORIZATION_WARNING 423
// Review Struct
#define I_REVIEW_STRUCT 425
#define I_REVIEW_STRUCT 424
// Tips: Press “ ” both at once to switch case / numbers / symbols.
#define C__TIPS_PRESS_BOTH_AT_ONCE_TO_SWITCH_CASE_NUMBERS_SYMBOLS 426
#define C__TIPS_PRESS_BOTH_AT_ONCE_TO_SWITCH_CASE_NUMBERS_SYMBOLS 425
// Safe Transaction
#define T_CONFIRM_SAFE_TX 426
// Delegatecall may let external code affect your wallet.
#define I_SAFE_DELEGATE_WARNING 427
// View execTransaction
#define I_VIEW_EXEC_TRANSACTION 428
// Next, enter the PIN you want to change
#define C__NEXT_ENTER_THE_PIN_YOU_WANT_TO_CHANGE 429
#endif
// clang-format on
5 changes: 4 additions & 1 deletion legacy/firmware/i18n/locales/de.inc
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,6 @@ const char *const languages_de[] = {
"Sie haben Passphrase nicht aktiviert",
"PIN bereits verwendet! Möchten Sie ihn überschreiben?",
"PIN bereits verwendet! Bitte versuchen Sie einen anderen.",
"Bevor Sie beginnen, überprüfen Sie Ihre Standard-Wallet-PIN",
"TRON Energy-Miete",
"Der Empfänger ist eine bekannte Adresse eines Energie-Mietdienstleisters.",
"Phrase bestätigen",
Expand All @@ -426,4 +425,8 @@ const char *const languages_de[] = {
"{}-Autorisierung. Überprüfe zuerst das Vertrauen in die dApp.",
"Struktur bewerten",
"Tipps: „ “drücken, um Buchstaben, Zahlen und Symbole zu wechseln.",
"Safe-Transaktion",
"Delegatecall kann es externem Code ermöglichen, Ihre Wallet zu beeinflussen.",
"execTransaction anzeigen",
"Geben Sie als Nächstes die PIN ein, die Sie ändern möchten",
};
5 changes: 4 additions & 1 deletion legacy/firmware/i18n/locales/en.inc
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,6 @@ const char *const languages_en[] = {
"You do not have Passphrase turned on",
"PIN Already Used!
Do you want to overwrite it?",
"PIN already used! Please try a different one",
"Before start, verify your Standard Wallet PIN",
"TRON Energy Rental",
"Recipient is a known energy rental service provider address.",
"Confirm Phrase",
Expand All @@ -426,4 +425,8 @@ const char *const languages_en[] = {
"{} authorization. Check dApp trust first.",
"Review Struct",
"Tips: Press “ ” both at once to switch case / numbers / symbols.",
"Safe Transaction",
"Delegatecall may let external code affect your wallet.",
"View execTransaction",
"Next, enter the PIN you want to change",
};
5 changes: 4 additions & 1 deletion legacy/firmware/i18n/locales/es.inc
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,6 @@ const char *const languages_es[] = {
"No tienes activada la Passphrase",
"¡PIN ya utilizado!
¿Deseas sobrescribirlo?",
"¡PIN ya utilizado! Por favor, prueba con otro diferente",
"Antes de comenzar, verifica el PIN de tu Billetera Estándar",
"Alquiler de energía TRON",
"El destinatario es una dirección conocida de un proveedor de servicios de alquiler de energía.",
"Confirmar frase",
Expand All @@ -426,4 +425,8 @@ const char *const languages_es[] = {
"{} autorización. Verifica primero la confiabilidad de la dApp.",
"Estructura de revisión",
"Consejos: Pulsa “ ”para cambiar entre letras, números y símbolos.",
"Safe transacción",
"Delegatecall puede permitir que el código externo afecte tu billetera.",
"Ver execTransaction",
"A continuación, introduce el PIN que quieres cambiar",
};
5 changes: 4 additions & 1 deletion legacy/firmware/i18n/locales/ja.inc
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,6 @@ const char *const languages_ja[] = {
"Passphrase が有効になっていません",
"このPINはすでに使用されています!
上書きしますか?",
"そのPINはすでに使用されています。別のものをお試しください。",
"開始する前に、Standard WalletのPINを確認してください",
"TRONエネルギーレンタル",
"受取人は、既知のエネルギーレンタルサービスプロバイダーのアドレスです。",
"フレーズの確認",
Expand All @@ -426,4 +425,8 @@ const char *const languages_ja[] = {
"{} の認可。まず dApp の信頼性を確認してください。",
"レビュー構造体",
"ヒント:「 」を押すと、文字・数字・記号を切り替えられます。",
"Safe 取引",
"delegatecall により、外部コードがあなたのウォレットに影響を及ぼす可能性があります。",
"execTransaction を表示",
"次に、変更したいPINを入力してください",
};
5 changes: 4 additions & 1 deletion legacy/firmware/i18n/locales/ko_kr.inc
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,6 @@ const char *const languages_ko_kr[] = {
"Passphrase 가 활성화되어 있지 않습니다.",
"이미 사용된 PIN입니다!
덮어쓰시겠습니까?",
"이미 사용된 PIN입니다! 다른 PIN을 시도해 주세요",
"시작하기 전에 Standard Wallet PIN을 확인하세요",
"TRON 에너지 렌탈",
"수신자는 알려진 에너지 렌탈 서비스 제공업체 주소입니다.",
"문구 확인",
Expand All @@ -426,4 +425,8 @@ const char *const languages_ko_kr[] = {
"{} 인가. 먼저 dApp 신뢰를 확인하세요.",
"리뷰 구조체",
"팁: 대/소문자·숫자·기호를 전환하려면 “ ”을(를) 동시에 누르세요.",
"Safe 트랜잭션",
"Delegatecall은 외부 코드가 지갑에 영향을 미치게 할 수 있습니다.",
"execTransaction 보기",
"다음으로, 변경하려는 PIN을 입력하세요",
};
5 changes: 4 additions & 1 deletion legacy/firmware/i18n/locales/pt_br.inc
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,6 @@ const char *const languages_pt_br[] = {
"Você não tem o Passphrase ativado",
"PIN já utilizado! Deseja sobrescrever?",
"PIN já utilizado! Por favor, tente um diferente",
"Antes de começar, verifique o PIN da sua Carteira Padrão",
"Aluguel de Energia TRON",
"O destinatário é um endereço conhecido de provedor de serviços de aluguel de energia.",
"Confirmar Passphrase",
Expand All @@ -426,4 +425,8 @@ const char *const languages_pt_br[] = {
"Autorização de {}. Verifique a confiança do dApp primeiro.",
"Revisar Struct",
"Dicas: Pressione \" \" para alternar entre letras, números e símbolos.",
"Transação Safe",
"Delegatecall pode permitir que código externo afete sua carteira.",
"Ver execTransaction",
"Em seguida, digite o PIN que você deseja alterar",
};
7 changes: 5 additions & 2 deletions legacy/firmware/i18n/locales/zh_cn.inc
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ const char *const languages_zh_cn[] = {
"编辑单词 #{}",
"绑定 PIN 码",
"禁用 Passphrase?隐藏钱包 PIN 码将无法解锁设备",
"设置多个 PIN 码并分别关联不同的 Passphrase,您就可以轻松切换访问不同的钱包。输入对应的 PIN 码,就能打开相应的钱包。",
"通过为不同的 Passphrase 设置不同的 PIN 码,您可以轻松切换并访问对应的钱包。只需输入特定的 PIN 码,就能打开与之关联的钱包。",
"设置隐藏钱包 PIN 码",
"达到限制:最多可设置 3 个 PIN 码!您想要删除一些隐藏钱包 PIN 码吗?",
"绑定 Passphrase",
Expand All @@ -413,7 +413,6 @@ const char *const languages_zh_cn[] = {
"您尚未开启 Passphrase",
"此 PIN 码已被使用!您要覆盖它吗?",
"PIN已被使用!请尝试其他的",
"开始前,请验证您的标准钱包 PIN 码",
"TRON 能量租赁",
"收款地址是已知的能量租赁服务提供商。",
"确认助记词",
Expand All @@ -426,4 +425,8 @@ const char *const languages_zh_cn[] = {
"{} 授权。请先检查 dApp 信任度。",
"审查结构体",
"提示:同时按下\" \"来切换大小写/数字/符号。",
"Safe 交易",
"Delegatecall 可能让外部代码影响您的钱包。",
"查看执行交易",
"接下来,输入您要更改的 PIN 码",
};
7 changes: 5 additions & 2 deletions legacy/firmware/i18n/locales/zh_tw.inc
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ const char *const languages_zh_tw[] = {
"編輯單字 #{}",
"綁定 PIN 碼",
"停用 Passphrase?隱藏錢包 PIN 碼將無法解鎖裝置",
"設置多個 PIN 碼並分別關聯不同的 Passphrase,您就可以輕松切換訪問不同的錢包。輸入對應的 PIN 碼,就能打開相應的錢包。",
"通過爲不同的 Passphrase 設置不同的 PIN 碼,您可以輕鬆切換並訪問對應的錢包。隻需輸入特定的 PIN 碼,就能打開與之關聯的錢包。",
"設置隱藏錢包 PIN 碼",
"達到限製:最多可設置 3 個 PIN 碼!您想要刪除一些隱藏錢包 PIN 碼嗎?",
"綁定 Passphrase",
Expand All @@ -413,7 +413,6 @@ const char *const languages_zh_tw[] = {
"您尚未開啟 Passphrase",
"此 PIN 碼已被使用!您要覆寫它嗎?",
"PIN 已被使用!請嘗試不同的 PIN",
"開始前,請驗證您的標準錢包 PIN 碼",
"TRON 能量租賃",
"收款地址是已知的能量租賃服務提供商。",
"確認助記詞",
Expand All @@ -426,4 +425,8 @@ const char *const languages_zh_tw[] = {
"{} 授權。請先檢查 dApp 信任度。",
"檢閱結構體",
"提示:同時按下「 」來切換大小寫/數字/符號。",
"Safe 交易",
"Delegatecall 可能讓外部程式碼影響您的錢包。",
"查看執行交易",
"接下來,輸入您要變更的 PIN 碼",
};
28 changes: 19 additions & 9 deletions legacy/firmware/menu_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void menu_changePin(int index) {
layoutDialogCenterAdapterV2(_(M__CHANGE_PIN), NULL, &bmp_bottom_left_arrow,
&bmp_bottom_right_arrow, NULL, NULL, NULL, NULL,
NULL, NULL,
_(C__BEFORE_START_VERIFY_YOUR_CURRENT_PIN));
_(C__NEXT_ENTER_THE_PIN_YOU_WANT_TO_CHANGE));
key = protectWaitKey(0, 1);
if (key != KEY_CONFIRM) {
return;
Expand Down Expand Up @@ -751,10 +751,6 @@ static const struct menu_item security_set_menu_items_base[] = {
NULL},
{"Passphrase", NULL, false, .sub_menu = &passphrase_manage_menu, NULL, true,
NULL},
#if !BITCOIN_ONLY
{"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 @@ -988,9 +984,11 @@ static void menu_pin_input_for_attach(void) {
static char main_pin_copy[MAX_PIN_LEN + 1] = "";
static char pin1_copy[MAX_PIN_LEN + 1] = "";
static char pin2_copy[MAX_PIN_LEN + 1] = "";
bool was_passphrase_enabled = is_passphrase_pin_enabled;
bool expect_standard_prompt = session_isUnlocked() && was_passphrase_enabled;

get_main_pin : {
if (session_isUnlocked() && is_passphrase_pin_enabled) {
if (expect_standard_prompt) {
layoutDialogCenterAdapterV2(
_(T__ENTER_PIN), NULL, &bmp_bottom_left_close, &bmp_bottom_right_arrow,
NULL, NULL, NULL, NULL, NULL, NULL,
Expand All @@ -1003,7 +1001,7 @@ get_main_pin : {
}

const char *pin_title;
if (session_isUnlocked() && is_passphrase_pin_enabled) {
if (expect_standard_prompt) {
pin_title = _(T__STANDARD_PIN);
} else {
pin_title = _(T__ENTER_PIN);
Expand All @@ -1017,10 +1015,12 @@ get_main_pin : {
strlcpy(g_temp_main_pin, main_pin, sizeof(g_temp_main_pin));

bool main_ok = config_verifyPin(main_pin, PIN_TYPE_USER_CHECK);
is_passphrase_pin_enabled = was_passphrase_enabled;
pin_result_t main_pin_result = se_get_pin_result_type();
(void)main_pin_result; // avoid -Werror when RTT logging is disabled
if (!main_ok) {
protectPinErrorTips(true);
expect_standard_prompt = true;
goto get_main_pin;
}
}
Expand Down Expand Up @@ -1068,6 +1068,7 @@ get_main_pin : {

bool passphrase_pin_exists =
config_verifyPin(pin1_copy, PIN_TYPE_PASSPHRASE_PIN_CHECK);
is_passphrase_pin_enabled = was_passphrase_enabled;
pin_result_t check_result = se_get_pin_result_type();
(void)check_result;

Expand Down Expand Up @@ -1292,9 +1293,11 @@ static uint8_t wait_for_confirm_only(uint8_t mode) {
}

static bool require_standard_pin(bool cancel_allowed) {
bool was_passphrase_enabled = is_passphrase_pin_enabled;
bool expect_standard_prompt = session_isUnlocked() && was_passphrase_enabled;
while (1) {
const char *pin_title;
if (session_isUnlocked() && is_passphrase_pin_enabled) {
if (expect_standard_prompt) {
pin_title = _(T__STANDARD_PIN);
} else {
pin_title = _(T__ENTER_PIN);
Expand All @@ -1303,22 +1306,27 @@ static bool require_standard_pin(bool cancel_allowed) {
const char *pin = protectInputPin(pin_title, DEFAULT_PIN_LEN, MAX_PIN_LEN,
cancel_allowed);
if (!pin || pin == PIN_CANCELED_BY_BUTTON) {
is_passphrase_pin_enabled = was_passphrase_enabled;
return false;
}

bool ok = config_unlock(pin, PIN_TYPE_USER_CHECK);
if (!ok) {
protectPinErrorTips(true);
is_passphrase_pin_enabled = was_passphrase_enabled;
expect_standard_prompt = true;
continue;
}

pin_result_t result = se_get_pin_result_type();
if (result != USER_PIN_ENTERED && result != PIN_SUCCESS) {
protectPinErrorTips(true);
is_passphrase_pin_enabled = was_passphrase_enabled;
expect_standard_prompt = true;
continue;
}

is_passphrase_pin_enabled = false;
is_passphrase_pin_enabled = was_passphrase_enabled;
return true;
}
}
Expand Down Expand Up @@ -1495,8 +1503,10 @@ static void menu_remove_pin_input(void) {
strncpy(pin_to_remove, entered_pin, MAX_PIN_LEN);
pin_to_remove[MAX_PIN_LEN] = '\0';

bool was_passphrase_enabled = is_passphrase_pin_enabled;
bool passphrase_pin_exists =
config_verifyPin(pin_to_remove, PIN_TYPE_PASSPHRASE_PIN_CHECK);
is_passphrase_pin_enabled = was_passphrase_enabled;
pin_result_t remove_check = se_get_pin_result_type();
(void)remove_check;

Expand Down
Loading
Loading