From d7e763003914ae970d5278f05bd31e1f344582b1 Mon Sep 17 00:00:00 2001 From: Vaibhav Sethia Date: Mon, 18 Nov 2024 14:12:56 +0530 Subject: [PATCH 1/3] fix(app): Refactored display error code --- .../inheritance_app/inheritance_auth_wallet.c | 17 ++++++++++------- .../inheritance_decrypt_data.c | 12 ++++++++++++ .../inheritance_encrypt_data.c | 19 +++++++++++-------- 3 files changed, 33 insertions(+), 15 deletions(-) diff --git a/apps/inheritance_app/inheritance_auth_wallet.c b/apps/inheritance_app/inheritance_auth_wallet.c index 07a775ad0..0574654b0 100644 --- a/apps/inheritance_app/inheritance_auth_wallet.c +++ b/apps/inheritance_app/inheritance_auth_wallet.c @@ -172,13 +172,7 @@ static void auth_wallet_error_default() { SET_ERROR_TYPE(AUTH_WALLET_DEFAULT_ERROR); } -static void auth_wallet_handle_errors() { - auth_wallet_error_type_e type = auth_wallet_error.type; - if (type == AUTH_WALLET_OK) { - return; - } - LOG_ERROR("inheritance_auth_wallet error code:%d ", auth_wallet_error.type); - +static void auth_wallet_display_errors() { // Display any error msg if exists if (0 != strlen(error_screen.core_error_msg)) { if (error_screen.ring_buzzer) { @@ -187,6 +181,14 @@ static void auth_wallet_handle_errors() { delay_scr_init(error_screen.core_error_msg, DELAY_SHORT); clear_core_error_screen(); } +} + +static void auth_wallet_handle_errors() { + auth_wallet_error_type_e type = auth_wallet_error.type; + if (type == AUTH_WALLET_OK) { + return; + } + LOG_ERROR("inheritance_auth_wallet error code:%d ", auth_wallet_error.type); switch (type) { case AUTH_WALLET_USER_ABORT_ERROR: { @@ -471,6 +473,7 @@ auth_wallet_error_type_e inheritance_auth_wallet(inheritance_query_t *query) { delay_scr_init(ui_text_inheritance_wallet_auth_success, DELAY_TIME); SET_ERROR_TYPE(AUTH_WALLET_OK); } else { + auth_wallet_display_errors(); delay_scr_init(ui_text_inheritance_wallet_auth_fail, DELAY_TIME); } auth_wallet_handle_errors(); diff --git a/apps/inheritance_app/inheritance_decrypt_data.c b/apps/inheritance_app/inheritance_decrypt_data.c index b3f2a4613..81d6ba357 100644 --- a/apps/inheritance_app/inheritance_decrypt_data.c +++ b/apps/inheritance_app/inheritance_decrypt_data.c @@ -256,6 +256,17 @@ static void decryption_set_defaults() { SET_ERROR_TYPE(DECRYPTION_ERROR_DEFAULT); } +static void decryption_display_errors() { + // Display any error msg if exists + if (0 != strlen(error_screen.core_error_msg)) { + if (error_screen.ring_buzzer) { + buzzer_start(BUZZER_DURATION); + } + delay_scr_init(error_screen.core_error_msg, DELAY_TIME); + clear_core_error_screen(); + } +} + static void decryption_handle_errors() { if (decryption_error.type == DECRYPTION_OK) { return; @@ -676,6 +687,7 @@ decryption_error_type_e inheritance_decrypt_data(inheritance_query_t *query) { delay_scr_init(ui_text_inheritance_decryption_flow_success, DELAY_SHORT); SET_ERROR_TYPE(DECRYPTION_OK); } else { + decryption_display_errors(); delay_scr_init(ui_text_inheritance_decryption_flow_failure, DELAY_SHORT); } decryption_handle_errors(); diff --git a/apps/inheritance_app/inheritance_encrypt_data.c b/apps/inheritance_app/inheritance_encrypt_data.c index 4d6e28a3b..a7aec3131 100644 --- a/apps/inheritance_app/inheritance_encrypt_data.c +++ b/apps/inheritance_app/inheritance_encrypt_data.c @@ -311,14 +311,7 @@ static void encryption_set_defaults() { SET_ERROR_TYPE(ENCRYPTION_ERROR_DEFAULT); } -static void encryption_handle_errors() { - if (encryption_error.type == ENCRYPTION_OK) { - return; - } - LOG_ERROR("inheritance_encrypt_data Error Code:%d Flow Tag:%d ", - encryption_error.type, - encryption_error.flow); - +static void encryption_display_errors() { // Display any error msg if exists if (0 != strlen(error_screen.core_error_msg)) { if (error_screen.ring_buzzer) { @@ -327,6 +320,15 @@ static void encryption_handle_errors() { delay_scr_init(error_screen.core_error_msg, DELAY_TIME); clear_core_error_screen(); } +} + +static void encryption_handle_errors() { + if (encryption_error.type == ENCRYPTION_OK) { + return; + } + LOG_ERROR("inheritance_encrypt_data Error Code:%d Flow Tag:%d ", + encryption_error.type, + encryption_error.flow); encryption_error_type_e type = encryption_error.type; switch (type) { @@ -808,6 +810,7 @@ encryption_error_type_e inheritance_encrypt_data(inheritance_query_t *query) { delay_scr_init(ui_text_inheritance_encryption_flow_success, DELAY_TIME); SET_ERROR_TYPE(ENCRYPTION_OK); } else { + encryption_display_errors(); delay_scr_init(ui_text_inheritance_encryption_flow_failure, DELAY_TIME); } encryption_handle_errors(); From d274980f41f92af85f7542b3ef584ed5452d48f8 Mon Sep 17 00:00:00 2001 From: Vaibhav Sethia Date: Tue, 19 Nov 2024 17:16:33 +0530 Subject: [PATCH 2/3] fix: Update error msg --- common/core/core_session.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/core/core_session.c b/common/core/core_session.c index 251947c31..4534637d2 100644 --- a/common/core/core_session.c +++ b/common/core/core_session.c @@ -455,7 +455,7 @@ session_error_type_e session_aes_decrypt(uint8_t *InOut_data, uint16_t *len) { ASSERT(InOut_data != NULL); ASSERT(len != NULL); if (session.state != SESSION_LIVE) { - LOG_ERROR("session_aes_encrypt error_code:%d\n", + LOG_ERROR("session_aes_decrypt error_code:%d\n", SESSION_INVALID_STATE_ERROR); return SESSION_INVALID_STATE_ERROR; } @@ -468,13 +468,13 @@ session_error_type_e session_aes_decrypt(uint8_t *InOut_data, uint16_t *len) { aes_decrypt_ctx ctx = {0}; if (EXIT_SUCCESS != aes_decrypt_key256(session.session_key, &ctx)) { - LOG_ERROR("session_aes_encrypt error_code:%d\n", SESSION_ENCRYPTION_ERROR); + LOG_ERROR("aes_decrypt_key256 error_code:%d\n", SESSION_DECRYPTION_ERROR); return SESSION_DECRYPTION_ERROR; } if (aes_cbc_decrypt(payload, InOut_data, size, session.session_iv, &ctx) != EXIT_SUCCESS) { - LOG_ERROR("session_aes_encrypt error_code:%d\n", SESSION_ENCRYPTION_ERROR); + LOG_ERROR("aes_cbc_decrypt error_code:%d\n", SESSION_DECRYPTION_ERROR); return SESSION_DECRYPTION_ERROR; } From 2ffa385eb47e774e30a554a62ebaf5b8c46f46e3 Mon Sep 17 00:00:00 2001 From: Vaibhav Sethia Date: Tue, 19 Nov 2024 20:09:31 +0530 Subject: [PATCH 3/3] chore: Version bump (v0.6.1283) --- version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.txt b/version.txt index f1bdfbcf1..4db7aa4c3 100755 --- a/version.txt +++ b/version.txt @@ -1,3 +1,3 @@ -firmware version=000:006:004:000 +firmware version=000:006:005:003 hardware version=000:001:000:000 magic number=45227A01