Skip to content

Commit 2bd0563

Browse files
authored
fix(legacy): fix OK-14922 & OK-14923 & OK-14225; add -DUSE_PRECOMPUTED_CP=0 for small footprint (#260)
1 parent 6634bfd commit 2bd0563

File tree

8 files changed

+25
-13
lines changed

8 files changed

+25
-13
lines changed

legacy/common.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,10 @@ uint32_t drbg_random32(void) {
117117
}
118118

119119
void reset_to_firmware(void) {
120+
#if !EMULATOR
120121
svc_system_privileged();
121122
vector_table_t *ivt = (vector_table_t *)(FLASH_APP_START);
122123
__asm__ volatile("msr msp, %0" ::"r"(ivt->initial_sp_value));
123124
__asm__ volatile("b reset_handler");
125+
#endif
124126
}

legacy/firmware/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,9 @@ CFLAGS += -DUSE_NEM=0
222222
MAKO_RENDER_FLAG = --bitcoin-only
223223
endif
224224

225+
# disable certain optimizations and features when small footprint is required
226+
CFLAGS += -DUSE_PRECOMPUTED_CP=0
227+
225228
%:: %.mako defs
226229
@printf " MAKO $@\n"
227230
$(Q)$(PYTHON) ../vendor/trezor-common/tools/cointool.py render $(MAKO_RENDER_FLAG) $@.mako

legacy/firmware/fsm_msg_common.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,8 @@ void fsm_msgDeviceEraseSector(void) {
876876
ensure(flash_erase(FLASH_BIXIN_DATE_SECTOR), "erase failed");
877877
ensure(flash_unlock_write(), NULL);
878878
ensure(flash_write_word(FLASH_CODE_SECTOR_FIRST, 0x00, 0x00), NULL);
879+
#if !EMULATOR
879880
sys_backtoboot();
881+
#endif
880882
return;
881883
}

legacy/firmware/language.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ const char *languages[][2] = {
704704
// protect.c
705705
{"The new PIN must be different from your wipe code.", ""},
706706
//
707-
{"The recovery phrase are the", " "},
707+
{"The recovery phrase are", " "},
708708
// recovery.c
709709
{"The seed is", "种子"},
710710
// recovery.c recovery.c
@@ -728,6 +728,8 @@ const char *languages[][2] = {
728728
{"To", "接收方"},
729729
// ethereum.c
730730
{"Too much data", ""},
731+
// tron_ui.c
732+
{"Transaction", "交易"},
731733
// starcoin.c
732734
{"Transaction data cannot be decoded", "交易无法解析"},
733735
// ethereum.c
@@ -872,8 +874,6 @@ const char *languages[][2] = {
872874
{"and network fee of", ""},
873875
// fsm_msg_common.h
874876
{"answer to ping?", ""},
875-
//
876-
{"asset,Keep it safe", "凭证,请妥善保管"},
877877
// layout2.c
878878
{"auto-lock your device", ""},
879879
//
@@ -910,6 +910,8 @@ const char *languages[][2] = {
910910
{"contact our support.", ""},
911911
// reset.c
912912
{"create a new wallet?", "创建新的钱包?"},
913+
// tron_ui.c
914+
{"data", "数据"},
913915
// bl_check.c config.c
914916
{"detected.", ""},
915917
// fsm_msg_common.h fsm_msg_common.h
@@ -975,8 +977,6 @@ const char *languages[][2] = {
975977
{"of your recovery phrase", "助记词"},
976978
// recovery.c
977979
{"on your computer", "在电脑上"},
978-
//
979-
{"only way to recover your", "助记词是找回资产唯一"},
980980
// fsm_msg_coin.h
981981
{"own risk!", "风险"},
982982
// protect.c
@@ -1026,6 +1026,8 @@ const char *languages[][2] = {
10261026
{"the computer's", "使用电脑的"},
10271027
// recovery.c recovery.c
10281028
{"the one in the device.", ""},
1029+
// reset.c
1030+
{"the only way to recover", "助记词是找回资产唯一"},
10291031
//
10301032
{"the passphrase!", "密语"},
10311033
// layout2.c
@@ -1069,6 +1071,9 @@ const char *languages[][2] = {
10691071
//
10701072
{"words", "助记词"},
10711073
//
1072-
{"you still have ", "还有"}};
1074+
{"you still have ", "还有"},
1075+
// reset.c
1076+
{"your asset,Keep it safe", "凭证,请妥善保管"},
1077+
};
10731078

10741079
int LANGUAGE_ITEMS = sizeof(languages) / sizeof(languages[0]);

legacy/firmware/protob/messages-tron.options

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ TronSignTx.data max_size:200
99
TronTransferContract.to_address max_size:36
1010

1111
TronTriggerSmartContract.contract_address max_size:36
12-
TronTriggerSmartContract.data max_size:1024
12+
TronTriggerSmartContract.data max_size:2048
1313

1414
TronSignedTx.signature max_size:65
15-
TronSignedTx.serialized_tx max_size:1024
15+
TronSignedTx.serialized_tx max_size:2048
1616

1717
TronSignMessage.address_n max_count:8
1818
TronSignMessage.message max_size:1024

legacy/firmware/reset.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ bool verify_mnemonic(const char *mnemonic) {
304304
memzero(desc, sizeof(desc));
305305
strcat(desc, _("Select your"));
306306
strcat(desc, " ");
307-
strcat(desc, _("mnemonic"));
307+
strcat(desc, _("word"));
308308
strcat(desc, " #");
309309
uint2str(rand_list[index] + 1, desc + strlen(desc));
310310
layoutDialogSwipeCenterAdapter(NULL, &bmp_btn_back, _("Back"),
@@ -474,8 +474,8 @@ bool writedown_mnemonic(const char *mnemonic) {
474474
}
475475
layoutDialogSwipeCenterAdapter(
476476
NULL, &bmp_btn_back, _("Back"), &bmp_btn_forward, _("Next"), NULL, NULL,
477-
_("The recovery phrase are the"), _("only way to recover your"),
478-
_("asset,Keep it safe"), NULL, NULL);
477+
_("The recovery phrase are"), _("the only way to recover"),
478+
_("your asset,Keep it safe"), NULL, NULL);
479479
key = protectWaitKey(0, 1);
480480
if (key != KEY_CONFIRM) {
481481
return false;

legacy/firmware/tron.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ int pack_contract(TronSignTx *msg, uint8_t *buf, int *index,
157157

158158
int ret = *index, len = 0, cmessage_len = 0, cmessage_index = 0, capi_len = 0,
159159
capi_index = 0;
160-
uint8_t cmessage[512] = {0};
160+
uint8_t cmessage[1024] = {0};
161161
uint8_t capi[64] = {0};
162162
uint8_t addr_raw[MAX_ADDR_RAW_SIZE] = {0};
163163

legacy/firmware/tron_ui.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,6 @@ void layoutTronData(const uint8_t *data, uint32_t len, uint32_t total_len) {
8787
if (total_len == printed) summarystart = summary + 4;
8888

8989
layoutDialogSwipe(&bmp_icon_question, _("Cancel"), _("Confirm"), NULL,
90-
_("Transaction data:"), hexdata[0], hexdata[1], hexdata[2],
90+
_("Transaction"), _("data"), hexdata[0], hexdata[1],
9191
summarystart, NULL);
9292
}

0 commit comments

Comments
 (0)