Skip to content

Commit

Permalink
Remove useless flag NO_CONSENT
Browse files Browse the repository at this point in the history
  • Loading branch information
cedelavergne-ledger committed Apr 29, 2024
1 parent 41c9ece commit 0e2f4f4
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 38 deletions.
4 changes: 0 additions & 4 deletions makefile_conf/features.mk
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ ifneq ($(TARGET_NAME),TARGET_NANOS)
endif
endif

ifneq ($(NOCONSENT),)
DEFINES += NO_CONSENT
endif

# Check features incompatibilities
# --------------------------------
# NFTs
Expand Down
7 changes: 1 addition & 6 deletions src_features/getEth2PublicKey/cmd_getEth2PublicKey.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,15 @@ void handleGetEth2PublicKey(uint8_t p1,

getEth2PublicKey(bip32.path, bip32.length, tmpCtx.publicKeyContext.publicKey.W);

#ifndef NO_CONSENT
if (p1 == P1_NON_CONFIRM)
#endif // NO_CONSENT
{
*tx = set_result_get_eth2_publicKey();
THROW(0x9000);
}
#ifndef NO_CONSENT
else {
} else {
ui_display_public_eth2();

*flags |= IO_ASYNCH_REPLY;
}
#endif // NO_CONSENT
}

#endif
7 changes: 1 addition & 6 deletions src_features/getPublicKey/cmd_getPublicKey.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,11 @@ void handleGetPublicKey(uint8_t p1,
THROW(APDU_RESPONSE_INVALID_DATA);
}

#ifndef NO_CONSENT
if (p1 == P1_NON_CONFIRM)
#endif // NO_CONSENT
{
*tx = set_result_get_publicKey();
THROW(APDU_RESPONSE_OK);
}
#ifndef NO_CONSENT
else {
} else {
snprintf(strings.common.fullAddress,
sizeof(strings.common.fullAddress),
"0x%.*s",
Expand All @@ -79,5 +75,4 @@ void handleGetPublicKey(uint8_t p1,

*flags |= IO_ASYNCH_REPLY;
}
#endif // NO_CONSENT
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,11 @@ void handlePerformPrivacyOperation(uint8_t p1,
THROW(0x6A80);
}

#ifndef NO_CONSENT
if (p1 == P1_NON_CONFIRM)
#endif // NO_CONSENT
{
*tx = set_result_perform_privacy_operation();
THROW(0x9000);
}
#ifndef NO_CONSENT
else {
} else {
snprintf(strings.common.fullAddress,
sizeof(strings.common.fullAddress),
"0x%.*s",
Expand All @@ -120,5 +116,4 @@ void handlePerformPrivacyOperation(uint8_t p1,

*flags |= IO_ASYNCH_REPLY;
}
#endif // NO_CONSENT
}
4 changes: 0 additions & 4 deletions src_features/signMessage/cmd_signMessage.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,7 @@ bool handleSignPersonalMessage(uint8_t p1,
} else // hash only
{
if (tmpCtx.messageSigningContext.remainingLength == 0) {
#ifdef NO_CONSENT
io_seproxyhal_touch_signMessage_ok();
#else
ui_191_switch_to_sign();
#endif
} else {
apdu_reply(APDU_RESPONSE_OK);
}
Expand Down
4 changes: 0 additions & 4 deletions src_features/signMessageEIP712_v0/cmd_signMessage712.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ void handleSignEIP712Message_v0(uint8_t p1,
workBuffer + KECCAK256_HASH_BYTESIZE,
KECCAK256_HASH_BYTESIZE);

#ifdef NO_CONSENT
io_seproxyhal_touch_signMessage_ok(NULL);
#else // NO_CONSENT
ui_sign_712_v0();
#endif // NO_CONSENT

*flags |= IO_ASYNCH_REPLY;
}
9 changes: 1 addition & 8 deletions src_features/signTx/logic_signTx.c
Original file line number Diff line number Diff line change
Expand Up @@ -535,20 +535,13 @@ __attribute__((noinline)) static bool finalize_parsing_helper(bool direct, bool

void finalizeParsing(bool direct) {
bool use_standard_UI = true;
bool no_consent_check;

if (!finalize_parsing_helper(direct, &use_standard_UI)) {
return;
}
// If called from swap, the user has already validated a standard transaction
// And we have already checked the fields of this transaction above
no_consent_check = G_called_from_swap && use_standard_UI;

#ifdef NO_CONSENT
no_consent_check = true;
#endif // NO_CONSENT

if (no_consent_check) {
if (G_called_from_swap && use_standard_UI) {
io_seproxyhal_touch_tx_ok(NULL);
} else {
if (use_standard_UI) {
Expand Down

0 comments on commit 0e2f4f4

Please sign in to comment.