From ac202a4a25e4ddd5d26f35f75ae6da72a6e1d529 Mon Sep 17 00:00:00 2001 From: TamtamHero <10632523+TamtamHero@users.noreply.github.com> Date: Mon, 6 Jul 2020 14:30:38 +0200 Subject: [PATCH] Fix case sensitivity issue for silent mode --- Makefile | 5 +++++ src_features/signTx/logic_signTx.c | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/Makefile b/Makefile index b3800a5..a0bb021 100755 --- a/Makefile +++ b/Makefile @@ -29,8 +29,13 @@ APP_LOAD_PARAMS += --path "45'" #APP_LOAD_PARAMS += --path "1517992542'/1101353413'" APPVERSION_M=1 +<<<<<<< HEAD APPVERSION_N=3 APPVERSION_P=7 +======= +APPVERSION_N=4 +APPVERSION_P=2 +>>>>>>> f9ebc6d... Fix case sensitivity issue for silent mode + bump version 1.4.2 APPVERSION=$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P) APP_LOAD_FLAGS= --appFlags 0x240 --dep Ethereum:$(APPVERSION) diff --git a/src_features/signTx/logic_signTx.c b/src_features/signTx/logic_signTx.c index 5ab17e9..2dcf9ba 100644 --- a/src_features/signTx/logic_signTx.c +++ b/src_features/signTx/logic_signTx.c @@ -264,8 +264,19 @@ customStatus_e customProcessor(txContext_t *context) { return CUSTOM_NOT_HANDLED; } +void to_uppercase(char* str, unsigned char size){ + for (unsigned char i = 0; i < size && str[i] != 0; i++) + { + str[i] = str[i] > 'a' ? str[i] - ('a' - 'A') : str[i]; + } +} + void compareOrCopy(char* preapproved_string, char* parsed_string, bool silent_mode){ if(silent_mode){ + /* ETH address are not fundamentally case sensitive but might + have some for checksum purpose, so let's get rid of these diffs */ + to_uppercase(preapproved_string, strlen(preapproved_string)); + to_uppercase(parsed_string, strlen(parsed_string)); if(os_memcmp(preapproved_string, parsed_string, strlen(preapproved_string))){ THROW(ERR_SILENT_MODE_CHECK_FAILED); }