Rename called_from_swap to G_called_from_swap
This commit is contained in:
@@ -149,7 +149,7 @@ eth_plugin_result_t eth_plugin_perform_init(uint8_t *contractAddress,
|
||||
}
|
||||
|
||||
// Do not handle a plugin if running in swap mode
|
||||
if (called_from_swap && (contractAddress != NULL)) {
|
||||
if (G_called_from_swap && (contractAddress != NULL)) {
|
||||
PRINTF("eth_plug_init aborted in swap mode\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ bool copy_transaction_parameters(create_transaction_parameters_t* sign_transacti
|
||||
void handle_swap_sign_transaction(chain_config_t* config) {
|
||||
chainConfig = config;
|
||||
reset_app_context();
|
||||
called_from_swap = true;
|
||||
G_called_from_swap = true;
|
||||
io_seproxyhal_init();
|
||||
|
||||
if (N_storage.initialized != 0x01) {
|
||||
|
||||
@@ -52,7 +52,7 @@ cx_sha3_t global_sha3;
|
||||
|
||||
uint8_t appState;
|
||||
uint16_t apdu_response_code;
|
||||
bool called_from_swap;
|
||||
bool G_called_from_swap;
|
||||
pluginType_t pluginType;
|
||||
#ifdef HAVE_STARKWARE
|
||||
bool quantumSet;
|
||||
@@ -77,7 +77,7 @@ chain_config_t *chainConfig = NULL;
|
||||
void reset_app_context() {
|
||||
// PRINTF("!!RESET_APP_CONTEXT\n");
|
||||
appState = APP_STATE_IDLE;
|
||||
called_from_swap = false;
|
||||
G_called_from_swap = false;
|
||||
pluginType = OLD_INTERNAL;
|
||||
#ifdef HAVE_STARKWARE
|
||||
quantumSet = false;
|
||||
|
||||
@@ -213,7 +213,7 @@ extern strings_t strings;
|
||||
extern cx_sha3_t global_sha3;
|
||||
extern const internalStorage_t N_storage_real;
|
||||
|
||||
extern bool called_from_swap;
|
||||
extern bool G_called_from_swap;
|
||||
|
||||
typedef enum {
|
||||
EXTERNAL, // External plugin, set by setExternalPlugin.
|
||||
|
||||
@@ -49,7 +49,7 @@ void handleGetEth2PublicKey(uint8_t p1,
|
||||
unsigned int *tx) {
|
||||
bip32_path_t bip32;
|
||||
|
||||
if (!called_from_swap) {
|
||||
if (!G_called_from_swap) {
|
||||
reset_app_context();
|
||||
}
|
||||
if ((p1 != P1_CONFIRM) && (p1 != P1_NON_CONFIRM)) {
|
||||
|
||||
@@ -16,7 +16,7 @@ void handleGetPublicKey(uint8_t p1,
|
||||
bip32_path_t bip32;
|
||||
cx_ecfp_private_key_t privateKey;
|
||||
|
||||
if (!called_from_swap) {
|
||||
if (!G_called_from_swap) {
|
||||
reset_app_context();
|
||||
}
|
||||
|
||||
|
||||
@@ -424,8 +424,8 @@ void finalizeParsing(bool direct) {
|
||||
}
|
||||
|
||||
// User has just validated a swap but ETH received apdus about a non standard plugin / contract
|
||||
if (called_from_swap && !use_standard_UI) {
|
||||
PRINTF("ERR_SILENT_MODE_CHECK_FAILED, called_from_swap\n");
|
||||
if (G_called_from_swap && !use_standard_UI) {
|
||||
PRINTF("ERR_SILENT_MODE_CHECK_FAILED, G_called_from_swap\n");
|
||||
THROW(ERR_SILENT_MODE_CHECK_FAILED);
|
||||
}
|
||||
|
||||
@@ -447,7 +447,7 @@ void finalizeParsing(bool direct) {
|
||||
sizeof(displayBuffer),
|
||||
&global_sha3,
|
||||
chainConfig->chainId);
|
||||
if (called_from_swap) {
|
||||
if (G_called_from_swap) {
|
||||
// Ensure the values are the same that the ones that have been previously validated
|
||||
if (strcasecmp_workaround(strings.common.fullAddress, displayBuffer) != 0) {
|
||||
PRINTF("ERR_SILENT_MODE_CHECK_FAILED, address check failed\n");
|
||||
@@ -466,7 +466,7 @@ void finalizeParsing(bool direct) {
|
||||
ticker,
|
||||
displayBuffer,
|
||||
sizeof(displayBuffer));
|
||||
if (called_from_swap) {
|
||||
if (G_called_from_swap) {
|
||||
// Ensure the values are the same that the ones that have been previously validated
|
||||
if (strcmp(strings.common.fullAmount, displayBuffer) != 0) {
|
||||
PRINTF("ERR_SILENT_MODE_CHECK_FAILED, amount check failed\n");
|
||||
@@ -484,7 +484,7 @@ void finalizeParsing(bool direct) {
|
||||
&tmpContent.txContent.startgas,
|
||||
displayBuffer,
|
||||
sizeof(displayBuffer));
|
||||
if (called_from_swap) {
|
||||
if (G_called_from_swap) {
|
||||
// Ensure the values are the same that the ones that have been previously validated
|
||||
if (strcmp(strings.common.maxFee, displayBuffer) != 0) {
|
||||
PRINTF("ERR_SILENT_MODE_CHECK_FAILED, fees check failed\n");
|
||||
@@ -510,7 +510,7 @@ void finalizeParsing(bool direct) {
|
||||
|
||||
// If called from swap, the user as already validated a standard transaction
|
||||
// We have already checked the fields of this transaction above
|
||||
no_consent_check = called_from_swap && use_standard_UI;
|
||||
no_consent_check = G_called_from_swap && use_standard_UI;
|
||||
|
||||
#ifdef NO_CONSENT
|
||||
no_consent_check = true;
|
||||
|
||||
@@ -61,7 +61,7 @@ unsigned int io_seproxyhal_touch_tx_ok(__attribute__((unused)) const bagl_elemen
|
||||
G_io_apdu_buffer[tx++] = 0x00;
|
||||
// Send back the response, do not restart the event loop
|
||||
io_exchange(CHANNEL_APDU | IO_RETURN_AFTER_TX, tx);
|
||||
if (called_from_swap) {
|
||||
if (G_called_from_swap) {
|
||||
os_sched_exit(0);
|
||||
}
|
||||
reset_app_context();
|
||||
|
||||
Reference in New Issue
Block a user