Fix case sensitivity issue for silent mode

This commit is contained in:
TamtamHero
2020-07-06 14:30:38 +02:00
parent 9d4dfbe1bf
commit ac202a4a25
2 changed files with 16 additions and 0 deletions

View File

@@ -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)

View File

@@ -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);
}