From 96f8ada0a5c8aee45bf657ac06842a015d379976 Mon Sep 17 00:00:00 2001 From: Aido Date: Wed, 26 Apr 2023 21:16:01 +0100 Subject: [PATCH] Removed duplicated nano code --- CHANGELOG.md | 3 +- TODO.md | 1 + src/nanos_enter_phrase.c | 88 ++++- src/nanox_enter_phrase.c | 62 ++-- src/ui.h | 3 +- src/{ux_nanox.c => ux_nano.c} | 13 +- src/{ux_nanox.h => ux_nano.h} | 41 ++- ...ux_nanos_keyboard.c => ux_nano_keyboard.c} | 244 ++++++++++++- src/ux_nanos.c | 203 ----------- src/ux_nanos.h | 111 ------ src/ux_nanox_keyboard.c | 339 ------------------ 11 files changed, 372 insertions(+), 736 deletions(-) rename src/{ux_nanox.c => ux_nano.c} (95%) rename src/{ux_nanox.h => ux_nano.h} (91%) rename src/{ux_nanos_keyboard.c => ux_nano_keyboard.c} (67%) delete mode 100644 src/ux_nanos.c delete mode 100644 src/ux_nanos.h delete mode 100644 src/ux_nanox_keyboard.c diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f93616d..59f27240 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,11 @@ # Change log -## [1.2.0] - 2023-04-21 +## [1.3.0] - 2023-04-27 ### Added - ### Changed +- Removed duplicated Nano code - Simplified flow code ### Fixed diff --git a/TODO.md b/TODO.md index 0468cf60..0a404e48 100755 --- a/TODO.md +++ b/TODO.md @@ -12,6 +12,7 @@ ### Done ✓ +- [x] Remove duplicated Nano code - [x] Simplified flow code - [x] Add flow to set SSKR threshold values - [x] Add automated tests diff --git a/src/nanos_enter_phrase.c b/src/nanos_enter_phrase.c index debd29dc..d2466585 100644 --- a/src/nanos_enter_phrase.c +++ b/src/nanos_enter_phrase.c @@ -21,6 +21,78 @@ // allow to edit back any entered word #define RESTORE_WORD_MAX_BACKWARD_STEPS 24 +const bagl_element_t screen_onboarding_word_list_elements[] = { + // erase + {{BAGL_RECTANGLE, 0x00, 0, 0, 128, 32, 0, 0, BAGL_FILL, 0x000000, 0xFFFFFF, 0, 0}, NULL}, + + {{BAGL_LABELINE, + 0x01, + 0, + 12, + 128, + 32, + 0, + 0, + 0, + 0xFFFFFF, + 0x000000, + BAGL_FONT_OPEN_SANS_REGULAR_11px | BAGL_FONT_ALIGNMENT_CENTER, + 0}, + G_ux.string_buffer}, + {{BAGL_RECTANGLE, 0x02, 32, 16, 64, 14, 0, 4, BAGL_FILL, 0xFFFFFF, 0x000000, 0, 0}, NULL}, + {{BAGL_LABELINE, + 0x02, + 0, + 26, + 128, + 32, + 0, + 0, + 0, + 0x000000, + 0xFFFFFF, + BAGL_FONT_OPEN_SANS_EXTRABOLD_11px | BAGL_FONT_ALIGNMENT_CENTER, + 0}, + G_ux.string_buffer}, + + // left/rights icons + {{BAGL_ICON, 0x03, 3, 12, 4, 7, 0, 0, 0, 0xFFFFFF, 0x000000, 0, 0}, (const char*) &C_icon_left}, + {{BAGL_ICON, 0x04, 121, 12, 4, 7, 0, 0, 0, 0xFFFFFF, 0x000000, 0, 0}, + (const char*) &C_icon_right}, + + // supplementary static entry + {{BAGL_ICON, 0x05, 16, 9, 14, 14, 0, 0, 0, 0xFFFFFF, 0x000000, 0, 0}, + (const char*) &C_icon_back}, + {{BAGL_LABELINE, + 0x05, + 41, + 12, + 128, + 32, + 0, + 0, + 0, + 0xFFFFFF, + 0x000000, + BAGL_FONT_OPEN_SANS_EXTRABOLD_11px, + 0}, + "Restart from"}, + {{BAGL_LABELINE, + 0x06, + 41, + 26, + 128, + 32, + 0, + 0, + 0, + 0xFFFFFF, + 0x000000, + BAGL_FONT_OPEN_SANS_EXTRABOLD_11px, + 0}, + G_ux.string_buffer}, +}; + const bagl_element_t* screen_onboarding_restore_word_before_element_display_callback( const bagl_element_t* element); @@ -45,7 +117,7 @@ UX_STEP_NOCB(ux_bip39_nomatch_step_2, }); UX_STEP_VALID(ux_bip39_nomatch_step_3, pb, ui_idle_init(), {&C_icon_back_x, "Return to menu"}); -UX_FLOW(flow_final_bip39_nomatch, +UX_FLOW(ux_bip39_nomatch_flow, &ux_bip39_nomatch_step_1, &ux_bip39_nomatch_step_2, &ux_bip39_nomatch_step_3); @@ -60,7 +132,7 @@ UX_STEP_CB(ux_bip39_match_step_2, pb, os_sched_exit(0), {&C_icon_dashboard_x, "Q UX_STEP_CB(ux_bip39_match_step_3, pbb, set_sskr_descriptor_values(); , {&SSKR_ICON, "Generate", "SSKR phrases"}); -UX_FLOW(flow_final_bip39_match, +UX_FLOW(ux_bip39_match_flow, &ux_bip39_match_step_1, &ux_bip39_match_step_2, &ux_bip39_match_step_3); @@ -79,7 +151,7 @@ UX_STEP_NOCB(ux_sskr_nomatch_step_2, }); UX_STEP_VALID(ux_sskr_nomatch_step_3, pb, ui_idle_init(), {&C_icon_back_x, "Return to menu"}); -UX_FLOW(flow_final_sskr_nomatch, +UX_FLOW(ux_sskr_nomatch_flow, &ux_sskr_nomatch_step_1, &ux_sskr_nomatch_step_2, &ux_sskr_nomatch_step_3); @@ -93,7 +165,7 @@ UX_STEP_CB(ux_sskr_match_step_1, pbb, os_sched_exit(0);, UX_STEP_CB(ux_sskr_match_step_2, pb, os_sched_exit(0), {&C_icon_dashboard_x, "Quit"}); UX_STEP_CB(ux_sskr_match_step_3, pbb, generate_bip39();, {&BIP39_ICON, "Generate", "BIP39 phrase"}); -UX_FLOW(flow_final_sskr_match, &ux_sskr_match_step_1, &ux_sskr_match_step_2, &ux_sskr_match_step_3); +UX_FLOW(ux_sskr_match_flow, &ux_sskr_match_step_1, &ux_sskr_match_step_2, &ux_sskr_match_step_3); void screen_processing_postinit(unsigned int stack_slot) { // ensure when pin is modal over the processing screen( at end of install) the processing screen @@ -319,12 +391,12 @@ void compare_recovery_phrase(void) { if (os_secure_memcmp(buffer, buffer_device, 64)) { memset(G_bolos_ux_context.words_buffer, 0, G_bolos_ux_context.words_buffer_length); (G_bolos_ux_context.onboarding_type == BOLOS_UX_ONBOARDING_BIP39) - ? ux_flow_init(0, flow_final_bip39_nomatch, NULL) - : ux_flow_init(0, flow_final_sskr_nomatch, NULL); + ? ux_flow_init(0, ux_bip39_nomatch_flow, NULL) + : ux_flow_init(0, ux_sskr_nomatch_flow, NULL); } else { (G_bolos_ux_context.onboarding_type == BOLOS_UX_ONBOARDING_BIP39) - ? ux_flow_init(0, flow_final_bip39_match, NULL) - : ux_flow_init(0, flow_final_sskr_match, NULL); + ? ux_flow_init(0, ux_bip39_match_flow, NULL) + : ux_flow_init(0, ux_sskr_match_flow, NULL); } } diff --git a/src/nanox_enter_phrase.c b/src/nanox_enter_phrase.c index cedf6271..e746bdce 100644 --- a/src/nanox_enter_phrase.c +++ b/src/nanox_enter_phrase.c @@ -154,56 +154,54 @@ UX_STEP_VALID(ux_wrong_seed_step, }); UX_FLOW(ux_wrong_seed_flow, &ux_wrong_seed_step); -UX_STEP_NOCB(ux_bip39_failed_check_step_1, pbb, {&C_icon_warning, "BIP39 Phrase", "doesn't match"}); -UX_STEP_NOCB(ux_bip39_failed_check_step_2, +UX_STEP_NOCB(ux_bip39_nomatch_step_1, pbb, {&C_icon_warning, "BIP39 Phrase", "doesn't match"}); +UX_STEP_NOCB(ux_bip39_nomatch_step_2, nn, { "Check length", "order and spelling", }); -UX_STEP_VALID(ux_bip39_failed_check_step_3, pb, ui_idle_init(), {&C_icon_back_x, "Return to menu"}); -UX_FLOW(ux_bip39_failed_check_flow, - &ux_bip39_failed_check_step_1, - &ux_bip39_failed_check_step_2, - &ux_bip39_failed_check_step_3); +UX_STEP_VALID(ux_bip39_nomatch_step_3, pb, ui_idle_init(), {&C_icon_back_x, "Return to menu"}); +UX_FLOW(ux_bip39_nomatch_flow, + &ux_bip39_nomatch_step_1, + &ux_bip39_nomatch_step_2, + &ux_bip39_nomatch_step_3); -UX_STEP_VALID(ux_bip39_success_step_1, +UX_STEP_VALID(ux_bip39_match_step_1, pbb, os_sched_exit(-1), {&C_icon_validate_14, "BIP39 Phrase", "is correct"}); -UX_STEP_CB(ux_bip39_success_step_2, pb, os_sched_exit(0), {&C_icon_dashboard_x, "Quit"}); -UX_STEP_CB(ux_bip39_success_step_3, pbb, set_sskr_descriptor_values(); +UX_STEP_CB(ux_bip39_match_step_2, pb, os_sched_exit(0), {&C_icon_dashboard_x, "Quit"}); +UX_STEP_CB(ux_bip39_match_step_3, pbb, set_sskr_descriptor_values(); , {&SSKR_ICON, "Generate", "SSKR phrases"}); -UX_FLOW(ux_bip39_succesful_check_flow, - &ux_bip39_success_step_1, - &ux_bip39_success_step_2, - &ux_bip39_success_step_3); +UX_FLOW(ux_bip39_match_flow, + &ux_bip39_match_step_1, + &ux_bip39_match_step_2, + &ux_bip39_match_step_3); -UX_STEP_NOCB(ux_sskr_failed_check_step_1, pbb, {&C_icon_warning, "SSKR Phrase", "doesn't match"}); -UX_STEP_NOCB(ux_sskr_failed_check_step_2, +UX_STEP_NOCB(ux_sskr_nomatch_step_1, pbb, {&C_icon_warning, "SSKR Phrase", "doesn't match"}); +UX_STEP_NOCB(ux_sskr_nomatch_step_2, nn, { "Check length", "order and spelling", }); -UX_STEP_VALID(ux_sskr_failed_check_step_3, pb, ui_idle_init(), {&C_icon_back_x, "Return to menu"}); -UX_FLOW(ux_sskr_failed_check_flow, - &ux_sskr_failed_check_step_1, - &ux_sskr_failed_check_step_2, - &ux_sskr_failed_check_step_3); +UX_STEP_VALID(ux_sskr_nomatch_step_3, pb, ui_idle_init(), {&C_icon_back_x, "Return to menu"}); +UX_FLOW(ux_sskr_nomatch_flow, + &ux_sskr_nomatch_step_1, + &ux_sskr_nomatch_step_2, + &ux_sskr_nomatch_step_3); -UX_STEP_VALID(ux_sskr_success_step_1, +UX_STEP_VALID(ux_sskr_match_step_1, pbb, os_sched_exit(-1), {&C_icon_validate_14, "SSKR Phrase", "is correct"}); -UX_STEP_CB(ux_sskr_success_step_2, pb, os_sched_exit(0), {&C_icon_dashboard_x, "Quit"}); -UX_STEP_CB(ux_sskr_success_step_3, pbb, generate_bip39();, {&BIP39_ICON, "Generate", "BIP39 phrases"}); +UX_STEP_CB(ux_sskr_match_step_2, pb, os_sched_exit(0), {&C_icon_dashboard_x, "Quit"}); +UX_STEP_CB(ux_sskr_match_step_3, pbb, generate_bip39(); + , {&BIP39_ICON, "Generate", "BIP39 phrases"}); -UX_FLOW(ux_sskr_succesful_check_flow, - &ux_sskr_success_step_1, - &ux_sskr_success_step_2, - &ux_sskr_success_step_3); +UX_FLOW(ux_sskr_match_flow, &ux_sskr_match_step_1, &ux_sskr_match_step_2, &ux_sskr_match_step_3); unsigned int screen_onboarding_restore_word_select_button(unsigned int button_mask, unsigned int button_mask_counter); @@ -578,12 +576,12 @@ void screen_onboarding_restore_word_validate(void) { // Display loading icon to user ux_flow_init(0, ux_load_flow, NULL); if (compare_recovery_phrase()) { - ux_flow_init(0, ux_bip39_succesful_check_flow, NULL); + ux_flow_init(0, ux_bip39_match_flow, NULL); } else { memset(G_bolos_ux_context.words_buffer, 0, G_bolos_ux_context.words_buffer_length); - ux_flow_init(0, ux_bip39_failed_check_flow, NULL); + ux_flow_init(0, ux_bip39_nomatch_flow, NULL); } } } else { @@ -617,12 +615,12 @@ void screen_onboarding_restore_word_validate(void) { // Display loading icon to user ux_flow_init(0, ux_load_flow, NULL); if (compare_recovery_phrase()) { - ux_flow_init(0, ux_sskr_succesful_check_flow, NULL); + ux_flow_init(0, ux_sskr_match_flow, NULL); } else { memset(G_bolos_ux_context.words_buffer, 0, G_bolos_ux_context.words_buffer_length); - ux_flow_init(0, ux_sskr_failed_check_flow, NULL); + ux_flow_init(0, ux_sskr_nomatch_flow, NULL); } } } diff --git a/src/ui.h b/src/ui.h index cf807efa..92d48a00 100644 --- a/src/ui.h +++ b/src/ui.h @@ -22,14 +22,13 @@ #include #include "glyphs.h" +#include "ux_nano.h" #if defined(TARGET_NANOS) -#include "ux_nanos.h" #define ARRAYLEN(array) (sizeof(array) / sizeof(array[0])) #define BIP39_ICON C_bip39_nanos #define SSKR_ICON C_sskr_nanos #elif defined(TARGET_NANOX) || defined(TARGET_NANOS2) -#include "ux_nanox.h" #define BIP39_ICON C_bip39_nanox #define SSKR_ICON C_sskr_nanox #endif diff --git a/src/ux_nanox.c b/src/ux_nano.c similarity index 95% rename from src/ux_nanox.c rename to src/ux_nano.c index 5b94dc59..ff39e5d2 100644 --- a/src/ux_nanox.c +++ b/src/ux_nano.c @@ -1,5 +1,6 @@ /******************************************************************************* - * (c) 2016-2022 Ledger SAS + * Ledger Blue - Secure firmware + * (c) 2016, 2017 Ledger * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,9 +15,7 @@ * limitations under the License. ********************************************************************************/ -#include "ux_nanox.h" - -#if defined(TARGET_NANOX) || defined(TARGET_NANOS2) +#include "ux_nano.h" #ifdef OS_IO_SEPROXYHAL @@ -28,8 +27,8 @@ unsigned short io_timeout(unsigned short last_timeout) { return 1; } -void io_seproxyhal_display(const bagl_element_t* element) { - io_seproxyhal_display_default((bagl_element_t*) element); +void io_seproxyhal_display(const bagl_element_t *element) { + io_seproxyhal_display_default((bagl_element_t *) element); } void bolos_ux_hslider3_init(unsigned int total_count) { @@ -127,5 +126,3 @@ void bolos_ux_hslider3_previous(void) { } #endif // OS_IO_SEPROXYHAL - -#endif diff --git a/src/ux_nanox.h b/src/ux_nano.h similarity index 91% rename from src/ux_nanox.h rename to src/ux_nano.h index d0410209..d1f27b07 100644 --- a/src/ux_nanox.h +++ b/src/ux_nano.h @@ -18,7 +18,11 @@ #include "ux_common/common.h" -#if defined(HAVE_BOLOS_UX) && (defined(TARGET_NANOX) || defined(TARGET_NANOS2)) +#if defined(HAVE_BOLOS_UX) + +#if defined(TARGET_NANOS) +typedef unsigned int (*callback_t)(unsigned int); +#endif // bolos ux context (not mandatory if redesigning a bolos ux) typedef struct bolos_ux_context { @@ -52,13 +56,14 @@ typedef struct bolos_ux_context { unsigned int words_buffer_length; // after an int to make sure it's aligned - char string_buffer[MAX(64, sizeof(bagl_icon_details_t) + BOLOS_APP_ICON_SIZE_B - 1)]; + char string_buffer[MAX( + 64, + sizeof(bagl_icon_details_t) + BOLOS_APP_ICON_SIZE_B - 1)]; // to store the seed wholly // 128 of words (215 => hashed to 64, or 128) + HMAC_LENGTH*2 = 256 #define WORDS_BUFFER_MAX_SIZE_B 257 char words_buffer[WORDS_BUFFER_MAX_SIZE_B]; -#define MAX_PIN_LENGTH 8 -#define MIN_PIN_LENGTH 4 + char pin_digit_buffer; // digit to be displayed appmain_t flow_end_callback; @@ -66,14 +71,7 @@ typedef struct bolos_ux_context { // label line for common PIN and common keyboard screen (displayed over the entry) const char* common_label; - // slider management / menu list management - unsigned int hslider3_before; - unsigned int hslider3_current; - unsigned int hslider3_after; - unsigned int hslider3_total; - - keyboard_callback_t keyboard_callback; - +#if (defined(TARGET_NANOX) || defined(TARGET_NANOS2)) unsigned int overlay_refresh; unsigned int battery_percentage; unsigned int status_batt_level; @@ -92,6 +90,18 @@ typedef struct bolos_ux_context { #define BATTERY_LOW_LEVEL_PERCENT 25 #define BATTERY_CRITICAL_LEVEL_PERCENT 10 #define BATTERY_AUTO_POWER_OFF_LEVEL_PERCENT 2 +#endif + +#define MAX_PIN_LENGTH 8 +#define MIN_PIN_LENGTH 4 + + // slider management / menu list management + unsigned int hslider3_before; + unsigned int hslider3_current; + unsigned int hslider3_after; + unsigned int hslider3_total; + + keyboard_callback_t keyboard_callback; // detect stack/global variable overlap // have a zero byte to avoid buffer overflow from strings in the ux (we never know) @@ -125,7 +135,8 @@ void generate_bip39(void); #include "ux_common/common_bip39.h" #include "ux_common/common_sskr.h" -// to be included into all flow that needs to go back to the dashboard -extern const ux_flow_step_t ux_ob_goto_dashboard_step; +#if defined(TARGET_NANOS) +void screen_processing_init(void); +#endif -#endif // HAVE_BOLOS_UX_H && (TARGET_NANOX || TARGET_NANOS2) +#endif // HAVE_BOLOS_UX_H diff --git a/src/ux_nanos_keyboard.c b/src/ux_nano_keyboard.c similarity index 67% rename from src/ux_nanos_keyboard.c rename to src/ux_nano_keyboard.c index e630c853..3c40fbc2 100644 --- a/src/ux_nanos_keyboard.c +++ b/src/ux_nano_keyboard.c @@ -16,9 +16,9 @@ #include "ui.h" -#ifdef TARGET_NANOS +#ifdef OS_IO_SEPROXYHAL -//#ifdef OS_IO_SEPROXYHAL +#if defined(TARGET_NANOS) const bagl_element_t screen_common_keyboard_elements[] = { @@ -217,10 +217,216 @@ const bagl_element_t screen_common_keyboard_elements[] = { {{BAGL_ICON, 0x00, 121, 12, 4, 7, 0, 0, 0, 0xFFFFFF, 0x000000, 0, 0}, (const char*) &C_icon_right}, }; +#elif defined(TARGET_NANOX) || defined(TARGET_NANOS2) + +const bagl_element_t screen_common_keyboard_elements[] = { + + // erase + {{BAGL_RECTANGLE, 0x00, 0, 0, 128, 64, 0, 0, BAGL_FILL, 0x000000, 0xFFFFFF, 0, 0}, NULL}, + + // title + {{BAGL_LABELINE, + 0x04, + 0, + 20, + 128, + 32 - 5, + 0, + 0, + 0, + 0xFFFFFF, + 0x000000, + BAGL_FONT_OPEN_SANS_REGULAR_11px | BAGL_FONT_ALIGNMENT_CENTER, + 0}, + NULL}, + + // typed word + {{BAGL_LABELINE, + 0x10, + 128 / 2 - 12 / 2 - 40, + 48 + 5, + 14, + 14, + 0, + 0, + 0, + 0xFFFFFF, + 0x000000, + BAGL_FONT_OPEN_SANS_EXTRABOLD_11px | BAGL_FONT_ALIGNMENT_CENTER, + 0}, + NULL}, + {{BAGL_LABELINE, + 0x11, + 128 / 2 - 12 / 2 - 30, + 48 + 5, + 14, + 14, + 0, + 0, + 0, + 0xFFFFFF, + 0x000000, + BAGL_FONT_OPEN_SANS_EXTRABOLD_11px | BAGL_FONT_ALIGNMENT_CENTER, + 0}, + NULL}, + {{BAGL_LABELINE, + 0x12, + 128 / 2 - 12 / 2 - 20, + 48 + 5, + 14, + 14, + 0, + 0, + 0, + 0xFFFFFF, + 0x000000, + BAGL_FONT_OPEN_SANS_EXTRABOLD_11px | BAGL_FONT_ALIGNMENT_CENTER, + 0}, + NULL}, + {{BAGL_LABELINE, + 0x13, + 128 / 2 - 12 / 2 - 10, + 48 + 5, + 14, + 14, + 0, + 0, + 0, + 0xFFFFFF, + 0x000000, + BAGL_FONT_OPEN_SANS_EXTRABOLD_11px | BAGL_FONT_ALIGNMENT_CENTER, + 0}, + NULL}, + {{BAGL_LABELINE, + 0x14, + 128 / 2 - 12 / 2, + 48 + 5, + 14, + 14, + 0, + 0, + 0, + 0xFFFFFF, + 0x000000, + BAGL_FONT_OPEN_SANS_EXTRABOLD_11px | BAGL_FONT_ALIGNMENT_CENTER, + 0}, + NULL}, + {{BAGL_LABELINE, + 0x15, + 128 / 2 - 12 / 2 + 10, + 48 + 5, + 14, + 14, + 0, + 0, + 0, + 0xFFFFFF, + 0x000000, + BAGL_FONT_OPEN_SANS_EXTRABOLD_11px | BAGL_FONT_ALIGNMENT_CENTER, + 0}, + NULL}, + {{BAGL_LABELINE, + 0x16, + 128 / 2 - 12 / 2 + 20, + 48 + 5, + 14, + 14, + 0, + 0, + 0, + 0xFFFFFF, + 0x000000, + BAGL_FONT_OPEN_SANS_EXTRABOLD_11px | BAGL_FONT_ALIGNMENT_CENTER, + 0}, + NULL}, + {{BAGL_LABELINE, + 0x17, + 128 / 2 - 12 / 2 + 30, + 48 + 5, + 14, + 14, + 0, + 0, + 0, + 0xFFFFFF, + 0x000000, + BAGL_FONT_OPEN_SANS_EXTRABOLD_11px | BAGL_FONT_ALIGNMENT_CENTER, + 0}, + NULL}, + {{BAGL_LABELINE, + 0x18, + 128 / 2 - 12 / 2 + 40, + 48 + 5, + 14, + 14, + 0, + 0, + 0, + 0xFFFFFF, + 0x000000, + BAGL_FONT_OPEN_SANS_EXTRABOLD_11px | BAGL_FONT_ALIGNMENT_CENTER, + 0}, + NULL}, + + // slider elements + {{BAGL_LABELINE, + 0x01, + 29, + 36, + 14, + 13, + 0, + 0, + BAGL_FILL, + 0xFFFFFF, + 0x000000, + BAGL_FONT_OPEN_SANS_REGULAR_11px | BAGL_FONT_ALIGNMENT_CENTER, + 0}, + NULL}, + {{BAGL_LINE, 0x06, 48, 32, 4, 1, 0, 0, 0, 0xFFFFFF, 0x000000, 0, 0}, NULL}, + {{BAGL_RECTANGLE, 0x00, 57, 36 - 10, 14, 14, 0, 4, BAGL_FILL, 0xFFFFFF, 0x000000, 0, 0}, NULL}, + {{BAGL_LABELINE, + 0x02, + 58, + 36, + 12, + 13, + 0, + 0, + BAGL_FILL, + 0x000000, + 0xFFFFFF, + BAGL_FONT_OPEN_SANS_EXTRABOLD_11px | BAGL_FONT_ALIGNMENT_CENTER, + 0}, + NULL}, + {{BAGL_LINE, 0x07, 76, 32, 4, 1, 0, 0, 0, 0xFFFFFF, 0x000000, 0, 0}, NULL}, + {{BAGL_LABELINE, + 0x03, + 85, + 36, + 14, + 13, + 0, + 0, + BAGL_FILL, + 0xFFFFFF, + 0x000000, + BAGL_FONT_OPEN_SANS_REGULAR_11px | BAGL_FONT_ALIGNMENT_CENTER, + 0}, + NULL}, + + // left/rights icons + {{BAGL_ICON, 0x0A, 2, 28, 4, 7, 0, 0, 0, 0xFFFFFF, 0x000000, 0, 0}, (const char*) &C_icon_left}, + {{BAGL_ICON, 0x0B, 122, 28, 4, 7, 0, 0, 0, 0xFFFFFF, 0x000000, 0, 0}, + (const char*) &C_icon_right}, +}; +#endif // TARGETS const bagl_element_t* screen_common_keyboard_before_element_display_callback( const bagl_element_t* element) { +#ifdef TARGET_NANOS const bagl_element_t* e; +#endif // copy element to be displayed memcpy(&G_ux.tmp_element, PIC(element), sizeof(G_ux.tmp_element)); @@ -233,21 +439,9 @@ const bagl_element_t* screen_common_keyboard_before_element_display_callback( G_bolos_ux_context.hslider3_before); // current item (both line and invert rectangle) - case 0x22: case 0x02: - e = G_bolos_ux_context.keyboard_callback(KEYBOARD_RENDER_ITEM, - G_bolos_ux_context.hslider3_current); - - // if the current component to display is not TEXT, then don't display the invert - // rectangle, to avoid graphic glitch - if (element->component.userid == 0x22) { - if (e->component.type == BAGL_ICON) { - return NULL; - } - } - return e; - break; - + return G_bolos_ux_context.keyboard_callback(KEYBOARD_RENDER_ITEM, + G_bolos_ux_context.hslider3_current); case 0x03: if (G_bolos_ux_context.hslider3_after == BOLOS_UX_HSLIDER3_NONE) { return 0; @@ -261,12 +455,28 @@ const bagl_element_t* screen_common_keyboard_before_element_display_callback( } break; +#if defined(TARGET_NANOX) || defined(TARGET_NANOS2) + case 0x04: + // display the title + G_ux.tmp_element.text = G_bolos_ux_context.common_label; + break; +#endif case 0x07: if (G_bolos_ux_context.hslider3_after == BOLOS_UX_HSLIDER3_NONE) { return 0; // don't display } break; +#ifdef TARGET_NANOS + case 0x22: + e = G_bolos_ux_context.keyboard_callback(KEYBOARD_RENDER_ITEM, + G_bolos_ux_context.hslider3_current); + if (e->component.type == BAGL_ICON) { + return NULL; + } + return e; + break; +#endif default: if (element->component.userid & 0x10) { // request the xieth word char @@ -338,4 +548,4 @@ void screen_common_keyboard_init(unsigned int stack_slot, ux_stack_display(stack_slot); } -#endif +#endif // OS_IO_SEPROXYHAL diff --git a/src/ux_nanos.c b/src/ux_nanos.c deleted file mode 100644 index 3fbdb6b1..00000000 --- a/src/ux_nanos.c +++ /dev/null @@ -1,203 +0,0 @@ -/******************************************************************************* - * Ledger Blue - Secure firmware - * (c) 2016, 2017 Ledger - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ********************************************************************************/ - -#include "ux_nanos.h" - -#if defined(TARGET_NANOS) - -//#ifdef OS_IO_SEPROXYHAL - -bolos_ux_context_t G_bolos_ux_context; - -unsigned short io_timeout(unsigned short last_timeout) { - UNUSED(last_timeout); - // infinite timeout - return 1; -} - -void io_seproxyhal_display(const bagl_element_t *element) { - io_seproxyhal_display_default(element); -} - -void bolos_ux_hslider3_init(unsigned int total_count) { - G_bolos_ux_context.hslider3_total = total_count; - switch (total_count) { - case 0: - G_bolos_ux_context.hslider3_before = BOLOS_UX_HSLIDER3_NONE; - G_bolos_ux_context.hslider3_current = BOLOS_UX_HSLIDER3_NONE; - G_bolos_ux_context.hslider3_after = BOLOS_UX_HSLIDER3_NONE; - break; - case 1: - G_bolos_ux_context.hslider3_before = BOLOS_UX_HSLIDER3_NONE; - G_bolos_ux_context.hslider3_current = 0; - G_bolos_ux_context.hslider3_after = BOLOS_UX_HSLIDER3_NONE; - break; - case 2: - G_bolos_ux_context.hslider3_before = BOLOS_UX_HSLIDER3_NONE; - // G_bolos_ux_context.hslider3_before = 1; // full rotate - G_bolos_ux_context.hslider3_current = 0; - G_bolos_ux_context.hslider3_after = 1; - break; - default: - G_bolos_ux_context.hslider3_before = total_count - 1; - G_bolos_ux_context.hslider3_current = 0; - G_bolos_ux_context.hslider3_after = 1; - break; - } -} - -void bolos_ux_hslider3_set_current(unsigned int current) { - // index is reachable ? - if (G_bolos_ux_context.hslider3_total > current) { - // reach it - while (G_bolos_ux_context.hslider3_current != current) { - bolos_ux_hslider3_next(); - } - } -} - -void bolos_ux_hslider3_next(void) { - switch (G_bolos_ux_context.hslider3_total) { - case 0: - case 1: - break; - case 2: - switch (G_bolos_ux_context.hslider3_current) { - case 0: - G_bolos_ux_context.hslider3_before = 0; - G_bolos_ux_context.hslider3_current = 1; - G_bolos_ux_context.hslider3_after = BOLOS_UX_HSLIDER3_NONE; - break; - case 1: - G_bolos_ux_context.hslider3_before = BOLOS_UX_HSLIDER3_NONE; - G_bolos_ux_context.hslider3_current = 0; - G_bolos_ux_context.hslider3_after = 1; - break; - } - break; - default: - G_bolos_ux_context.hslider3_before = G_bolos_ux_context.hslider3_current; - G_bolos_ux_context.hslider3_current = G_bolos_ux_context.hslider3_after; - G_bolos_ux_context.hslider3_after = - (G_bolos_ux_context.hslider3_after + 1) % G_bolos_ux_context.hslider3_total; - break; - } -} - -void bolos_ux_hslider3_previous(void) { - switch (G_bolos_ux_context.hslider3_total) { - case 0: - case 1: - break; - case 2: - switch (G_bolos_ux_context.hslider3_current) { - case 0: - G_bolos_ux_context.hslider3_before = 0; - G_bolos_ux_context.hslider3_current = 1; - G_bolos_ux_context.hslider3_after = BOLOS_UX_HSLIDER3_NONE; - break; - case 1: - G_bolos_ux_context.hslider3_before = BOLOS_UX_HSLIDER3_NONE; - G_bolos_ux_context.hslider3_current = 0; - G_bolos_ux_context.hslider3_after = 1; - break; - } - break; - default: - G_bolos_ux_context.hslider3_after = G_bolos_ux_context.hslider3_current; - G_bolos_ux_context.hslider3_current = G_bolos_ux_context.hslider3_before; - G_bolos_ux_context.hslider3_before = - (G_bolos_ux_context.hslider3_before + G_bolos_ux_context.hslider3_total - 1) % - G_bolos_ux_context.hslider3_total; - break; - } -} - -const bagl_element_t screen_onboarding_word_list_elements[] = { - // erase - {{BAGL_RECTANGLE, 0x00, 0, 0, 128, 32, 0, 0, BAGL_FILL, 0x000000, 0xFFFFFF, 0, 0}, NULL}, - - {{BAGL_LABELINE, - 0x01, - 0, - 12, - 128, - 32, - 0, - 0, - 0, - 0xFFFFFF, - 0x000000, - BAGL_FONT_OPEN_SANS_REGULAR_11px | BAGL_FONT_ALIGNMENT_CENTER, - 0}, - G_ux.string_buffer}, - {{BAGL_RECTANGLE, 0x02, 32, 16, 64, 14, 0, 4, BAGL_FILL, 0xFFFFFF, 0x000000, 0, 0}, NULL}, - {{BAGL_LABELINE, - 0x02, - 0, - 26, - 128, - 32, - 0, - 0, - 0, - 0x000000, - 0xFFFFFF, - BAGL_FONT_OPEN_SANS_EXTRABOLD_11px | BAGL_FONT_ALIGNMENT_CENTER, - 0}, - G_ux.string_buffer}, - - // left/rights icons - {{BAGL_ICON, 0x03, 3, 12, 4, 7, 0, 0, 0, 0xFFFFFF, 0x000000, 0, 0}, - (const char *) &C_icon_left}, - {{BAGL_ICON, 0x04, 121, 12, 4, 7, 0, 0, 0, 0xFFFFFF, 0x000000, 0, 0}, - (const char *) &C_icon_right}, - - // supplementary static entry - {{BAGL_ICON, 0x05, 16, 9, 14, 14, 0, 0, 0, 0xFFFFFF, 0x000000, 0, 0}, - (const char *) &C_icon_back}, - {{BAGL_LABELINE, - 0x05, - 41, - 12, - 128, - 32, - 0, - 0, - 0, - 0xFFFFFF, - 0x000000, - BAGL_FONT_OPEN_SANS_EXTRABOLD_11px, - 0}, - "Restart from"}, - {{BAGL_LABELINE, - 0x06, - 41, - 26, - 128, - 32, - 0, - 0, - 0, - 0xFFFFFF, - 0x000000, - BAGL_FONT_OPEN_SANS_EXTRABOLD_11px, - 0}, - G_ux.string_buffer}, -}; - -#endif diff --git a/src/ux_nanos.h b/src/ux_nanos.h deleted file mode 100644 index 3d4d0d29..00000000 --- a/src/ux_nanos.h +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * (c) 2016-2022 Ledger SAS - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ********************************************************************************/ - -#pragma once - -#include "ux_common/common.h" - -#if defined(HAVE_BOLOS_UX) && defined(TARGET_NANOS) - -typedef unsigned int (*callback_t)(unsigned int); - -// bolos ux context (not mandatory if redesigning a bolos ux) -typedef struct bolos_ux_context { -#define BOLOS_UX_ONBOARDING_NEW 1 -#define BOLOS_UX_ONBOARDING_NEW_12 12 -#define BOLOS_UX_ONBOARDING_NEW_18 18 -#define BOLOS_UX_ONBOARDING_NEW_24 24 -#define BOLOS_UX_ONBOARDING_RESTORE 2 -#define BOLOS_UX_ONBOARDING_RESTORE_12 12 -#define BOLOS_UX_ONBOARDING_RESTORE_18 18 -#define BOLOS_UX_ONBOARDING_RESTORE_24 24 - unsigned int onboarding_kind; - -// Type of onboarding we are performing (BIP39 or SSKR) -#define BOLOS_UX_ONBOARDING_BIP39 0U -#define BOLOS_UX_ONBOARDING_SSKR 1U - unsigned int onboarding_type; - -// State of the dynamic display -#define STATIC_SCREEN 0U -#define DYNAMIC_SCREEN 1U - unsigned int current_state; - -#ifdef HAVE_ELECTRUM - unsigned int onboarding_algorithm; -#endif - - unsigned int onboarding_step; - unsigned int onboarding_index; - unsigned int onboarding_words_checked; - - unsigned int words_buffer_length; - // after an int to make sure it's aligned - char string_buffer[MAX( - 64, - sizeof(bagl_icon_details_t) + BOLOS_APP_ICON_SIZE_B - 1)]; // to store the seed wholly - - char words_buffer[257]; // 128 of words (215 => hashed to 64, or 128) + - // HMAC_LENGTH*2 = 256 - -#define MAX_PIN_LENGTH 8 -#define MIN_PIN_LENGTH 4 - - // slider management - unsigned int hslider3_before; - unsigned int hslider3_current; - unsigned int hslider3_after; - unsigned int hslider3_total; - - keyboard_callback_t keyboard_callback; - -// detect stack/global variable overlap -// have a zero byte to avoid buffer overflow from strings in the ux (we never -// know) -#define CANARY_MAGIC 0x7600E9AB - unsigned int canary; - - // for CheckSeed app only - uint8_t processing; - - uint8_t sskr_share_count; - uint8_t sskr_share_index; - unsigned int sskr_group_descriptor[1][2]; - unsigned int sskr_words_buffer_length; - char sskr_words_buffer[]; -} bolos_ux_context_t; - -extern bolos_ux_context_t G_bolos_ux_context; - -// update before, current, after index for horizontal slider with 3 positions -// slider distinguish handling from the data, to be more generic :) -#define BOLOS_UX_HSLIDER3_NONE (-1UL) - -void screen_common_keyboard_init(unsigned int stack_slot, - unsigned int current_element, - unsigned int nb_elements, - keyboard_callback_t callback); - -void screen_processing_init(void); -void set_sskr_descriptor_values(void); -void generate_bip39(void); - -#include "ux_common/common_bip39.h" -#include "ux_common/common_sskr.h" - -extern const bagl_element_t screen_onboarding_word_list_elements[9]; - -#endif // HAVE_BOLOS_UX && TARGET_NANOS diff --git a/src/ux_nanox_keyboard.c b/src/ux_nanox_keyboard.c deleted file mode 100644 index f8bfcfde..00000000 --- a/src/ux_nanox_keyboard.c +++ /dev/null @@ -1,339 +0,0 @@ -/******************************************************************************* - * (c) 2016-2022 Ledger SAS - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ********************************************************************************/ - -#include "ui.h" - -#if defined(TARGET_NANOX) || defined(TARGET_NANOS2) - -#ifdef OS_IO_SEPROXYHAL - -const bagl_element_t screen_common_keyboard_elements[] = { - - // erase - {{BAGL_RECTANGLE, 0x00, 0, 0, 128, 64, 0, 0, BAGL_FILL, 0x000000, 0xFFFFFF, 0, 0}, NULL}, - - // title - {{BAGL_LABELINE, - 0x04, - 0, - 20, - 128, - 32 - 5, - 0, - 0, - 0, - 0xFFFFFF, - 0x000000, - BAGL_FONT_OPEN_SANS_REGULAR_11px | BAGL_FONT_ALIGNMENT_CENTER, - 0}, - NULL}, - - // typed word - {{BAGL_LABELINE, - 0x10, - 128 / 2 - 12 / 2 - 40, - 48 + 5, - 14, - 14, - 0, - 0, - 0, - 0xFFFFFF, - 0x000000, - BAGL_FONT_OPEN_SANS_EXTRABOLD_11px | BAGL_FONT_ALIGNMENT_CENTER, - 0}, - NULL}, - {{BAGL_LABELINE, - 0x11, - 128 / 2 - 12 / 2 - 30, - 48 + 5, - 14, - 14, - 0, - 0, - 0, - 0xFFFFFF, - 0x000000, - BAGL_FONT_OPEN_SANS_EXTRABOLD_11px | BAGL_FONT_ALIGNMENT_CENTER, - 0}, - NULL}, - {{BAGL_LABELINE, - 0x12, - 128 / 2 - 12 / 2 - 20, - 48 + 5, - 14, - 14, - 0, - 0, - 0, - 0xFFFFFF, - 0x000000, - BAGL_FONT_OPEN_SANS_EXTRABOLD_11px | BAGL_FONT_ALIGNMENT_CENTER, - 0}, - NULL}, - {{BAGL_LABELINE, - 0x13, - 128 / 2 - 12 / 2 - 10, - 48 + 5, - 14, - 14, - 0, - 0, - 0, - 0xFFFFFF, - 0x000000, - BAGL_FONT_OPEN_SANS_EXTRABOLD_11px | BAGL_FONT_ALIGNMENT_CENTER, - 0}, - NULL}, - {{BAGL_LABELINE, - 0x14, - 128 / 2 - 12 / 2, - 48 + 5, - 14, - 14, - 0, - 0, - 0, - 0xFFFFFF, - 0x000000, - BAGL_FONT_OPEN_SANS_EXTRABOLD_11px | BAGL_FONT_ALIGNMENT_CENTER, - 0}, - NULL}, - {{BAGL_LABELINE, - 0x15, - 128 / 2 - 12 / 2 + 10, - 48 + 5, - 14, - 14, - 0, - 0, - 0, - 0xFFFFFF, - 0x000000, - BAGL_FONT_OPEN_SANS_EXTRABOLD_11px | BAGL_FONT_ALIGNMENT_CENTER, - 0}, - NULL}, - {{BAGL_LABELINE, - 0x16, - 128 / 2 - 12 / 2 + 20, - 48 + 5, - 14, - 14, - 0, - 0, - 0, - 0xFFFFFF, - 0x000000, - BAGL_FONT_OPEN_SANS_EXTRABOLD_11px | BAGL_FONT_ALIGNMENT_CENTER, - 0}, - NULL}, - {{BAGL_LABELINE, - 0x17, - 128 / 2 - 12 / 2 + 30, - 48 + 5, - 14, - 14, - 0, - 0, - 0, - 0xFFFFFF, - 0x000000, - BAGL_FONT_OPEN_SANS_EXTRABOLD_11px | BAGL_FONT_ALIGNMENT_CENTER, - 0}, - NULL}, - {{BAGL_LABELINE, - 0x18, - 128 / 2 - 12 / 2 + 40, - 48 + 5, - 14, - 14, - 0, - 0, - 0, - 0xFFFFFF, - 0x000000, - BAGL_FONT_OPEN_SANS_EXTRABOLD_11px | BAGL_FONT_ALIGNMENT_CENTER, - 0}, - NULL}, - - // slider elements - {{BAGL_LABELINE, - 0x01, - 29, - 36, - 14, - 13, - 0, - 0, - BAGL_FILL, - 0xFFFFFF, - 0x000000, - BAGL_FONT_OPEN_SANS_REGULAR_11px | BAGL_FONT_ALIGNMENT_CENTER, - 0}, - NULL}, - {{BAGL_LINE, 0x06, 48, 32, 4, 1, 0, 0, 0, 0xFFFFFF, 0x000000, 0, 0}, NULL}, - {{BAGL_RECTANGLE, 0x00, 57, 36 - 10, 14, 14, 0, 4, BAGL_FILL, 0xFFFFFF, 0x000000, 0, 0}, NULL}, - {{BAGL_LABELINE, - 0x02, - 58, - 36, - 12, - 13, - 0, - 0, - BAGL_FILL, - 0x000000, - 0xFFFFFF, - BAGL_FONT_OPEN_SANS_EXTRABOLD_11px | BAGL_FONT_ALIGNMENT_CENTER, - 0}, - NULL}, - {{BAGL_LINE, 0x07, 76, 32, 4, 1, 0, 0, 0, 0xFFFFFF, 0x000000, 0, 0}, NULL}, - {{BAGL_LABELINE, - 0x03, - 85, - 36, - 14, - 13, - 0, - 0, - BAGL_FILL, - 0xFFFFFF, - 0x000000, - BAGL_FONT_OPEN_SANS_REGULAR_11px | BAGL_FONT_ALIGNMENT_CENTER, - 0}, - NULL}, - - // left/rights icons - {{BAGL_ICON, 0x0A, 2, 28, 4, 7, 0, 0, 0, 0xFFFFFF, 0x000000, 0, 0}, (const char*) &C_icon_left}, - {{BAGL_ICON, 0x0B, 122, 28, 4, 7, 0, 0, 0, 0xFFFFFF, 0x000000, 0, 0}, - (const char*) &C_icon_right}, -}; - -const bagl_element_t* screen_common_keyboard_before_element_display_callback( - const bagl_element_t* element) { - // copy element to be displayed - memcpy(&G_ux.tmp_element, PIC(element), sizeof(G_ux.tmp_element)); - - switch (element->component.userid) { - case 0x01: - if (G_bolos_ux_context.hslider3_before == BOLOS_UX_HSLIDER3_NONE) { - return 0; - } - return G_bolos_ux_context.keyboard_callback(KEYBOARD_RENDER_ITEM, - G_bolos_ux_context.hslider3_before); - - case 0x02: - return G_bolos_ux_context.keyboard_callback(KEYBOARD_RENDER_ITEM, - G_bolos_ux_context.hslider3_current); - - case 0x03: - if (G_bolos_ux_context.hslider3_after == BOLOS_UX_HSLIDER3_NONE) { - return 0; - } - return G_bolos_ux_context.keyboard_callback(KEYBOARD_RENDER_ITEM, - G_bolos_ux_context.hslider3_after); - - case 0x06: - if (G_bolos_ux_context.hslider3_before == BOLOS_UX_HSLIDER3_NONE) { - return 0; // don't display - } - break; - - case 0x04: - // display the title - G_ux.tmp_element.text = G_bolos_ux_context.common_label; - break; - - case 0x07: - if (G_bolos_ux_context.hslider3_after == BOLOS_UX_HSLIDER3_NONE) { - return 0; // don't display - } - break; - - default: - if (element->component.userid & 0x10) { - // request the xieth word char - return G_bolos_ux_context.keyboard_callback(KEYBOARD_RENDER_WORD, - element->component.userid & 0x0F); - } - break; - } - // return the probably modded element by the callback function - return &G_ux.tmp_element; -} - -unsigned int screen_common_keyboard_button(unsigned int button_mask, - unsigned int button_mask_counter) { - UNUSED(button_mask_counter); - - switch (button_mask) { - case BUTTON_EVT_RELEASED | BUTTON_LEFT | BUTTON_RIGHT: // validate current digit - - // validate the item, and if accepted, then redisplay current screen, else don't draw - // anything - if (G_bolos_ux_context.keyboard_callback(KEYBOARD_ITEM_VALIDATED, - G_bolos_ux_context.hslider3_current)) { - goto redraw; - } - break; - - case BUTTON_EVT_FAST | BUTTON_LEFT: - case BUTTON_EVT_RELEASED | BUTTON_LEFT: - bolos_ux_hslider3_previous(); - goto redraw; - - case BUTTON_EVT_FAST | BUTTON_RIGHT: - case BUTTON_EVT_RELEASED | BUTTON_RIGHT: - bolos_ux_hslider3_next(); - - redraw: - ux_stack_display(G_ux.stack_count - 1); - break; - } - return 1; -} - -void screen_common_keyboard_init(unsigned int stack_slot, - unsigned int current_element, - unsigned int nb_elements, - keyboard_callback_t callback) { - unsigned int current = G_bolos_ux_context.hslider3_current; - ux_stack_init(stack_slot); - - // initiate the rotating modulo iterator - bolos_ux_hslider3_init(nb_elements); - if (current_element == COMMON_KEYBOARD_INDEX_UNCHANGED) { - bolos_ux_hslider3_set_current(current); - } else { - bolos_ux_hslider3_set_current(current_element); - } - - G_ux.stack[stack_slot].element_arrays[0].element_array = screen_common_keyboard_elements; - G_ux.stack[stack_slot].element_arrays[0].element_array_count = - ARRAYLEN(screen_common_keyboard_elements); - G_ux.stack[stack_slot].element_arrays_count = 1; - G_ux.stack[stack_slot].screen_before_element_display_callback = - screen_common_keyboard_before_element_display_callback; // used for each screen of the - // validate pin flow - G_ux.stack[stack_slot].button_push_callback = screen_common_keyboard_button; - G_bolos_ux_context.keyboard_callback = callback; - - ux_stack_display(stack_slot); -} - -#endif // OS_IO_SEPROXYHAL - -#endif // TARGETS