Skip to content

Commit

Permalink
Review from Askibin
Browse files Browse the repository at this point in the history
  • Loading branch information
fbeutin-ledger committed Oct 12, 2022
1 parent 1b84548 commit f131fe4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ typedef enum InstructionCode {
InsSignOffchainMessage = 0x07
} InstructionCode;

extern bool G_called_from_swap;
extern volatile bool G_called_from_swap;

// display stepped screens
extern unsigned int ux_step;
Expand Down
7 changes: 3 additions & 4 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

ApduCommand G_command;
unsigned char G_io_seproxyhal_spi_buffer[IO_SEPROXYHAL_BUFFER_SIZE_B];
bool G_called_from_swap;
volatile bool G_called_from_swap;

static void reset_main_globals(void) {
MEMCLEAR(G_command);
Expand Down Expand Up @@ -126,6 +126,7 @@ void app_main(void) {
THROW(ApduReplySdkExceptionIoReset);
}
CATCH_OTHER(e) {
G_called_from_swap = false;
switch (e & 0xF000) {
case 0x6000:
sw = e;
Expand All @@ -148,8 +149,6 @@ void app_main(void) {
tx += 2;
}
FINALLY {
// Restrict silent swap mode to the first APDU received
G_called_from_swap = false;
}
}
END_TRY;
Expand Down Expand Up @@ -354,7 +353,7 @@ static void library_main_helper(libargs_t *args) {
}

static void library_main(libargs_t *args) {
bool end = false;
volatile bool end = false;
/* This loop ensures that library_main_helper and os_lib_end are called
* within a try context, even if an exception is thrown */
while (1) {
Expand Down
2 changes: 1 addition & 1 deletion src/signMessage.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ void handle_sign_message_ui(volatile unsigned int *flags) {
os_sched_exit(0);
} else {
PRINTF("Refused blind signing incorrect Swap transaction\n");
sendResponse(0, false);
THROW(ApduReplySolanaSummaryFinalizeFailed);
}
} else {
MEMCLEAR(flow_steps);
Expand Down

0 comments on commit f131fe4

Please sign in to comment.