diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt new file mode 100644 index 000000000..e69de29bb diff --git a/common/coin_support/wallet.h b/common/coin_support/wallet.h index 12482dc56..0b78be11a 100644 --- a/common/coin_support/wallet.h +++ b/common/coin_support/wallet.h @@ -44,7 +44,7 @@ #define MAX_NUMBER_OF_MNEMONIC_WORDS 24 /// Max length of mnemonic word -#define MAX_MNEMONIC_WORD_LENGTH 15 +#define MAX_MNEMONIC_WORD_LENGTH 16 /// Max length of passphrase entered #define MAX_PASSPHRASE_INPUT_LENGTH 65 diff --git a/common/interfaces/user_interface/ui_list.c b/common/interfaces/user_interface/ui_list.c index 0b863159c..00adcd44a 100644 --- a/common/interfaces/user_interface/ui_list.c +++ b/common/interfaces/user_interface/ui_list.c @@ -64,7 +64,7 @@ static struct List_Data *data = NULL; static struct List_Object *obj = NULL; -void list_init(const char option_list[24][15], +void list_init(const char option_list[MAX_UI_LIST_WORDS][MAX_UI_LIST_CHAR_LEN], const int number_of_options, const char *heading, bool dynamic_heading) { diff --git a/common/interfaces/user_interface/ui_list.h b/common/interfaces/user_interface/ui_list.h index 249c5d092..1a063aa03 100644 --- a/common/interfaces/user_interface/ui_list.h +++ b/common/interfaces/user_interface/ui_list.h @@ -13,7 +13,11 @@ #include "ui_common.h" -// TODO : Add constant +#define MAX_UI_LIST_WORDS MAX_NUMBER_OF_MNEMONIC_WORDS +#define MAX_UI_LIST_CHAR_LEN MAX_MNEMONIC_WORD_LENGTH + +// TODO: Update count for higher coin list + /** * @brief struct to store list data * @details @@ -24,7 +28,7 @@ * @note */ struct List_Data { - char option_list[24][15]; + char option_list[MAX_UI_LIST_WORDS][MAX_UI_LIST_CHAR_LEN]; int number_of_options; int current_index; bool dynamic_heading; @@ -67,7 +71,7 @@ struct List_Object { * * @note Do not use this if number of options to be displayed in list is 1. */ -void list_init(const char option_list[24][15], +void list_init(const char option_list[MAX_UI_LIST_WORDS][MAX_UI_LIST_CHAR_LEN], int number_of_options, const char *heading, bool dynamic_heading); diff --git a/common/libraries/util/utils.c b/common/libraries/util/utils.c index 8065011eb..379524145 100644 --- a/common/libraries/util/utils.c +++ b/common/libraries/util/utils.c @@ -174,9 +174,10 @@ uint32_t byte_array_to_hex_string(const uint8_t *bytes, return (i * 2 + 1); } -void __single_to_multi_line(const char *input, - const uint16_t input_len, - char output[24][15]) { +void __single_to_multi_line( + const char *input, + const uint16_t input_len, + char output[MAX_NUMBER_OF_MNEMONIC_WORDS][MAX_MNEMONIC_WORD_LENGTH]) { if (input == NULL || output == NULL) return; uint16_t i = 0U; @@ -198,9 +199,10 @@ void __single_to_multi_line(const char *input, } } -void __multi_to_single_line(const char input[24][15], - const uint8_t number_of_mnemonics, - char *output) { +void __multi_to_single_line( + const char input[MAX_NUMBER_OF_MNEMONIC_WORDS][MAX_MNEMONIC_WORD_LENGTH], + const uint8_t number_of_mnemonics, + char *output) { if (input == NULL || output == NULL) return; uint8_t word_len; diff --git a/common/libraries/util/utils.h b/common/libraries/util/utils.h index 9f505c375..d90d59b8c 100644 --- a/common/libraries/util/utils.h +++ b/common/libraries/util/utils.h @@ -182,9 +182,10 @@ uint32_t byte_array_to_hex_string(const uint8_t *bytes, * * @note */ -void __single_to_multi_line(const char *input, - uint16_t input_len, - char output[24][15]); +void __single_to_multi_line( + const char *input, + uint16_t input_len, + char output[MAX_NUMBER_OF_MNEMONIC_WORDS][MAX_MNEMONIC_WORD_LENGTH]); /** * @brief convert multi-d mnemonics to single-d array for trezor crypto @@ -203,9 +204,10 @@ void __single_to_multi_line(const char *input, * * @note */ -void __multi_to_single_line(const char input[24][15], - uint8_t number_of_mnemonics, - char *output); +void __multi_to_single_line( + const char input[MAX_NUMBER_OF_MNEMONIC_WORDS][MAX_MNEMONIC_WORD_LENGTH], + uint8_t number_of_mnemonics, + char *output); /** * @brief Converts a hex string to a byte array. diff --git a/src/level_four/card_health_check/cyt_card_hc.c b/src/level_four/card_health_check/cyt_card_hc.c index 90e0f8d5c..fcbb39df8 100644 --- a/src/level_four/card_health_check/cyt_card_hc.c +++ b/src/level_four/card_health_check/cyt_card_hc.c @@ -109,7 +109,11 @@ void cyt_card_hc() { if (wallet_count == 0) { message_scr_init(ui_text_no_wallets_present); } else if (wallet_count <= MAX_WALLETS_ALLOWED) { - char choices[MAX_WALLETS_ALLOWED][15] = {"", "", "", ""}, heading[50]; + char choices[MAX_WALLETS_ALLOWED][MAX_MNEMONIC_WORD_LENGTH] = {"", + "", + "", + ""}, + heading[50]; for (int i = 0; i < wallet_count; i++) { strcpy(choices[i], (char *)wallet_list[i][0]); }