diff --git a/src/monero_api.h b/src/monero_api.h index 58b8ca6..4a174c5 100644 --- a/src/monero_api.h +++ b/src/monero_api.h @@ -88,8 +88,8 @@ int monero_apdu_close_tx(void); void ui_init(void); void ui_menu_lock_display(void); void ui_menu_main_display(void); -void ui_menu_info_display(unsigned int value); -void ui_menu_info_display2(unsigned int value, const char *line1, const char *line2); +void ui_menu_show_security_error(void); +void ui_menu_show_tx_aborted(void); void ui_export_viewkey_display(unsigned int value); void ui_menu_any_pubaddr_display(unsigned int value, unsigned char *pub_view, unsigned char *pub_spend, unsigned char is_subbadress, diff --git a/src/monero_init.c b/src/monero_init.c index bfc9e27..215f9b4 100644 --- a/src/monero_init.c +++ b/src/monero_init.c @@ -240,6 +240,6 @@ void monero_lock_and_throw(int sw) { G_monero_vstate.protocol_barrier = PROTOCOL_LOCKED; snprintf(G_monero_vstate.ux_info1, sizeof(G_monero_vstate.ux_info1), "Security Err"); snprintf(G_monero_vstate.ux_info2, sizeof(G_monero_vstate.ux_info2), "%x", sw); - ui_menu_info_display(0); + ui_menu_show_security_error(); THROW(sw); } diff --git a/src/monero_open_tx.c b/src/monero_open_tx.c index 640b287..b799781 100644 --- a/src/monero_open_tx.c +++ b/src/monero_open_tx.c @@ -95,7 +95,7 @@ int monero_apdu_close_tx() { /* ----------------------------------------------------------------------- */ int monero_abort_tx() { monero_reset_tx(1); - ui_menu_info_display2(0, "TX", "Aborted"); + ui_menu_show_tx_aborted(); return 0; } diff --git a/src/monero_ux_nano.c b/src/monero_ux_nano.c index 199945a..132bfcb 100644 --- a/src/monero_ux_nano.c +++ b/src/monero_ux_nano.c @@ -121,17 +121,25 @@ unsigned int ui_menu_info_action(unsigned int value __attribute__((unused))) { return 0; } -void ui_menu_info_display2(unsigned int value __attribute__((unused)), const char* line1, - const char* line2) { +static void ui_menu_info_display2(unsigned int value __attribute__((unused)), const char* line1, + const char* line2) { snprintf(G_monero_vstate.ux_info1, sizeof(G_monero_vstate.ux_info1), "%s", line1); snprintf(G_monero_vstate.ux_info2, sizeof(G_monero_vstate.ux_info2), "%s", line2); ux_flow_init(0, ux_flow_info, NULL); } -void ui_menu_info_display(unsigned int value __attribute__((unused))) { +static void ui_menu_info_display(unsigned int value __attribute__((unused))) { ux_flow_init(0, ux_flow_info, NULL); } +void ui_menu_show_tx_aborted(void) { + ui_menu_info_display2(0, "TX", "Aborted"); +} + +void ui_menu_show_security_error(void) { + ui_menu_info_display(0); +} + /* -------------------------------- OPEN TX UX --------------------------------- */ unsigned int ui_menu_transaction_start(void) { return SW_OK; diff --git a/src/monero_ux_nanos.c b/src/monero_ux_nanos.c index 28ab06c..c4519e0 100644 --- a/src/monero_ux_nanos.c +++ b/src/monero_ux_nanos.c @@ -152,17 +152,25 @@ unsigned int ui_menu_info_button(unsigned int button_mask, return 0; } -void ui_menu_info_display2(unsigned int value __attribute__((unused)), const char* line1, - const char* line2) { +static void ui_menu_info_display2(unsigned int value __attribute__((unused)), const char* line1, + const char* line2) { snprintf(G_monero_vstate.ux_info1, sizeof(G_monero_vstate.ux_info1), "%s", line1); snprintf(G_monero_vstate.ux_info2, sizeof(G_monero_vstate.ux_info2), "%s", line2); UX_DISPLAY(ui_menu_info, NULL); } -void ui_menu_info_display(unsigned int value __attribute__((unused))) { +static void ui_menu_info_display(unsigned int value __attribute__((unused))) { UX_DISPLAY(ui_menu_info, NULL); } +void ui_menu_show_tx_aborted(void) { + ui_menu_info_display2(0, "TX", "Aborted"); +} + +void ui_menu_show_security_error(void) { + ui_menu_info_display(0); +} + /* -------------------------------- OPEN TX UX --------------------------------- */ unsigned int ui_menu_transaction_signed(void) { diff --git a/src/monero_ux_stax.c b/src/monero_ux_stax.c index 0c03bb1..3a1d54d 100644 --- a/src/monero_ux_stax.c +++ b/src/monero_ux_stax.c @@ -91,13 +91,11 @@ static void ui_menu_info_action(void) { } } -void ui_menu_info_display2(unsigned int value __attribute__((unused)), - const char* line1 __attribute__((unused)), - const char* line2 __attribute__((unused))) { +void ui_menu_show_tx_aborted(void) { nbgl_useCaseStatus("Transaction\ncancelled", false, ui_menu_info_action); } -void ui_menu_info_display(unsigned int value __attribute__((unused))) { +void ui_menu_show_security_error(void) { nbgl_useCaseStatus("Security Error", false, ui_menu_info_action); }