From deccf192e96baf20d0d2142f8f5cab67f6cab643 Mon Sep 17 00:00:00 2001 From: Christopher Tarry Date: Mon, 22 Jan 2024 20:29:42 -0500 Subject: [PATCH] rename io_seproxyhal_cancel, remove io_seproxyhal_display(), io_event() and io_exchange_al() --- src/app_main.c | 76 +--------------------------------------------- src/calcTxnHash.c | 2 +- src/getPublicKey.c | 2 +- src/sia_ux.h | 2 +- src/signHash.c | 2 +- 5 files changed, 5 insertions(+), 79 deletions(-) diff --git a/src/app_main.c b/src/app_main.c index 7d16d57..3bf045a 100644 --- a/src/app_main.c +++ b/src/app_main.c @@ -207,7 +207,7 @@ void io_exchange_with_code(uint16_t code, uint16_t tx) { io_exchange(CHANNEL_APDU | IO_RETURN_AFTER_TX, tx); } -unsigned int io_seproxyhal_cancel(void) { +unsigned int io_reject(void) { io_exchange_with_code(SW_USER_REJECTED, 0); // Return to the main screen. ui_idle(); @@ -272,80 +272,6 @@ static handler_fn_t *lookupHandler(uint8_t ins) { // Next, we'll look at how the various commands are implemented. We'll start // with the simplest command, signHash.c. -// override point, but nothing more to do -#ifdef HAVE_BAGL -void io_seproxyhal_display(const bagl_element_t *element) { - io_seproxyhal_display_default((bagl_element_t *) element); -} -#endif - -uint8_t io_event(uint8_t channel) { - UNUSED(channel); - - switch (G_io_seproxyhal_spi_buffer[0]) { - case SEPROXYHAL_TAG_BUTTON_PUSH_EVENT: -#ifdef HAVE_BAGL - UX_BUTTON_PUSH_EVENT(G_io_seproxyhal_spi_buffer); -#endif // HAVE_BAGL - break; - case SEPROXYHAL_TAG_STATUS_EVENT: - if (G_io_apdu_media == IO_APDU_MEDIA_USB_HID && // - !(U4BE(G_io_seproxyhal_spi_buffer, 3) & // - SEPROXYHAL_TAG_STATUS_EVENT_FLAG_USB_POWERED)) { - THROW(EXCEPTION_IO_RESET); - } - __attribute__((fallthrough)); - case SEPROXYHAL_TAG_DISPLAY_PROCESSED_EVENT: -#ifdef HAVE_BAGL - UX_DISPLAYED_EVENT({}); -#endif // HAVE_BAGL -#ifdef HAVE_NBGL - UX_DEFAULT_EVENT(); -#endif // HAVE_NBGL - break; -#ifdef HAVE_NBGL - case SEPROXYHAL_TAG_FINGER_EVENT: - UX_FINGER_EVENT(G_io_seproxyhal_spi_buffer); - break; -#endif // HAVE_NBGL - case SEPROXYHAL_TAG_TICKER_EVENT: - UX_TICKER_EVENT(G_io_seproxyhal_spi_buffer, {}); - break; - default: - UX_DEFAULT_EVENT(); - break; - } - - if (!io_seproxyhal_spi_is_status_sent()) { - io_seproxyhal_general_status(); - } - - return 1; -} - -uint16_t io_exchange_al(uint8_t channel, uint16_t tx_len) { - switch (channel & ~(IO_FLAGS)) { - case CHANNEL_KEYBOARD: - break; - case CHANNEL_SPI: - if (tx_len) { - io_seproxyhal_spi_send(G_io_apdu_buffer, tx_len); - - if (channel & IO_RESET_AFTER_REPLIED) { - halt(); - } - - return 0; - } else { - return io_seproxyhal_spi_recv(G_io_apdu_buffer, sizeof(G_io_apdu_buffer), 0); - } - default: - THROW(INVALID_PARAMETER); - } - - return 0; -} - void app_main() { // Mark the transaction context as uninitialized. explicit_bzero(&global, sizeof(global)); diff --git a/src/calcTxnHash.c b/src/calcTxnHash.c index 6334f32..1230625 100644 --- a/src/calcTxnHash.c +++ b/src/calcTxnHash.c @@ -53,7 +53,7 @@ UX_STEP_VALID(ux_sign_txn_flow_2_step, io_seproxyhal_touch_txn_hash_ok(), {&C_icon_validate_14, "Approve"}); -UX_STEP_VALID(ux_sign_txn_flow_3_step, pb, io_seproxyhal_cancel(), {&C_icon_crossmark, "Reject"}); +UX_STEP_VALID(ux_sign_txn_flow_3_step, pb, io_reject(), {&C_icon_crossmark, "Reject"}); // Flow for the signing transaction menu: // #1 screen: "Sign this txn?" diff --git a/src/getPublicKey.c b/src/getPublicKey.c index f8fc139..c4c2f8b 100644 --- a/src/getPublicKey.c +++ b/src/getPublicKey.c @@ -56,7 +56,7 @@ UX_STEP_VALID(ux_approve_pk_flow_2_step, io_seproxyhal_touch_pk_ok(), {&C_icon_validate_14, "Approve"}); -UX_STEP_VALID(ux_approve_pk_flow_3_step, pb, io_seproxyhal_cancel(), {&C_icon_crossmark, "Reject"}); +UX_STEP_VALID(ux_approve_pk_flow_3_step, pb, io_reject(), {&C_icon_crossmark, "Reject"}); // Flow for the public key/address menu: // #1 screen: "generate address/public key from key #x?" diff --git a/src/sia_ux.h b/src/sia_ux.h index 6041cae..fe9df95 100644 --- a/src/sia_ux.h +++ b/src/sia_ux.h @@ -71,6 +71,6 @@ void ui_menu_about(void); void io_exchange_with_code(uint16_t code, uint16_t tx); // standard "reject" function so we don't repeat code -unsigned int io_seproxyhal_cancel(void); +unsigned int io_reject(void); #endif /* SIA_UX_H */ \ No newline at end of file diff --git a/src/signHash.c b/src/signHash.c index 0268b77..f157560 100644 --- a/src/signHash.c +++ b/src/signHash.c @@ -59,7 +59,7 @@ UX_STEP_VALID(ux_approve_hash_flow_2_step, UX_STEP_VALID(ux_approve_hash_flow_3_step, pb, - io_seproxyhal_cancel(), + io_reject(), {&C_icon_crossmark, "Reject"}); // Flow for the signing hash menu: