From fbd913bc3389468f434b2cea44b74cb3669ffb0d Mon Sep 17 00:00:00 2001 From: Alexandre Paillier Date: Fri, 21 Jun 2024 09:51:53 +0200 Subject: [PATCH] Removed blind signing setting --- src/handle_swap_sign_transaction.c | 1 - src/main.c | 5 --- src/shared_context.h | 1 - src_bagl/ui_flow.c | 36 +++---------------- .../cmd_getAppConfiguration.c | 3 +- src_features/signTx/logic_signTx.c | 7 +--- src_nbgl/ui_settings.c | 17 ++------- 7 files changed, 8 insertions(+), 62 deletions(-) diff --git a/src/handle_swap_sign_transaction.c b/src/handle_swap_sign_transaction.c index dd7d613..107365d 100644 --- a/src/handle_swap_sign_transaction.c +++ b/src/handle_swap_sign_transaction.c @@ -95,7 +95,6 @@ void __attribute__((noreturn)) handle_swap_sign_transaction(const chain_config_t if (N_storage.initialized != 0x01) { internalStorage_t storage; - storage.dataAllowed = 0x00; storage.contractDetails = 0x00; storage.initialized = 0x01; storage.displayNonce = 0x00; diff --git a/src/main.c b/src/main.c index a1507b5..1141ff0 100644 --- a/src/main.c +++ b/src/main.c @@ -549,11 +549,6 @@ __attribute__((noreturn)) void coin_main(libargs_t *args) { if (!N_storage.initialized) { internalStorage_t storage; -#ifdef HAVE_ALLOW_DATA - storage.dataAllowed = true; -#else - storage.dataAllowed = false; -#endif storage.contractDetails = false; storage.displayNonce = false; #ifdef HAVE_EIP712_FULL_SUPPORT diff --git a/src/shared_context.h b/src/shared_context.h index dfde37f..9208b0d 100644 --- a/src/shared_context.h +++ b/src/shared_context.h @@ -30,7 +30,6 @@ typedef struct bip32_path_t { } bip32_path_t; typedef struct internalStorage_t { - bool dataAllowed; bool contractDetails; bool displayNonce; #ifdef HAVE_EIP712_FULL_SUPPORT diff --git a/src_bagl/ui_flow.c b/src_bagl/ui_flow.c index 17f7eed..633a111 100644 --- a/src_bagl/ui_flow.c +++ b/src_bagl/ui_flow.c @@ -9,16 +9,14 @@ // Reuse the strings.common.fullAmount buffer for settings displaying. // No risk of collision as this buffer is unused in the settings menu -#define SETTING_BLIND_SIGNING_STATE (strings.common.fullAmount) -#define SETTING_DISPLAY_DATA_STATE (strings.common.fullAmount + (BUF_INCREMENT * 1)) -#define SETTING_DISPLAY_NONCE_STATE (strings.common.fullAmount + (BUF_INCREMENT * 2)) -#define SETTING_VERBOSE_EIP712_STATE (strings.common.fullAmount + (BUF_INCREMENT * 3)) -#define SETTING_VERBOSE_DOMAIN_NAME_STATE (strings.common.fullAmount + (BUF_INCREMENT * 4)) +#define SETTING_DISPLAY_DATA_STATE (strings.common.fullAmount + (BUF_INCREMENT * 0)) +#define SETTING_DISPLAY_NONCE_STATE (strings.common.fullAmount + (BUF_INCREMENT * 1)) +#define SETTING_VERBOSE_EIP712_STATE (strings.common.fullAmount + (BUF_INCREMENT * 2)) +#define SETTING_VERBOSE_DOMAIN_NAME_STATE (strings.common.fullAmount + (BUF_INCREMENT * 3)) #define BOOL_TO_STATE_STR(b) (b ? ENABLED_STR : DISABLED_STR) static void display_settings(const ux_flow_step_t* const start_step); -static void switch_settings_blind_signing(void); static void switch_settings_display_data(void); static void switch_settings_display_nonce(void); #ifdef HAVE_EIP712_FULL_SUPPORT @@ -71,26 +69,6 @@ UX_FLOW(ux_idle_flow, FLOW_LOOP); // clang-format off -UX_STEP_CB( - ux_settings_flow_blind_signing_step, -#ifdef TARGET_NANOS - bnnn_paging, -#else - bnnn, -#endif - switch_settings_blind_signing(), - { -#ifdef TARGET_NANOS - .title = "Blind signing", - .text = -#else - "Blind signing", - "Transaction", - "blind signing", -#endif - SETTING_BLIND_SIGNING_STATE - }); - UX_STEP_CB( ux_settings_flow_display_data_step, #ifdef TARGET_NANOS @@ -169,7 +147,6 @@ UX_STEP_CB( // clang-format on UX_FLOW(ux_settings_flow, - &ux_settings_flow_blind_signing_step, &ux_settings_flow_display_data_step, &ux_settings_flow_display_nonce_step, #ifdef HAVE_EIP712_FULL_SUPPORT @@ -181,7 +158,6 @@ UX_FLOW(ux_settings_flow, &ux_settings_flow_back_step); static void display_settings(const ux_flow_step_t* const start_step) { - strlcpy(SETTING_BLIND_SIGNING_STATE, BOOL_TO_STATE_STR(N_storage.dataAllowed), BUF_INCREMENT); strlcpy(SETTING_DISPLAY_DATA_STATE, BOOL_TO_STATE_STR(N_storage.contractDetails), BUF_INCREMENT); @@ -206,10 +182,6 @@ static void toggle_setting(volatile bool* setting, const ux_flow_step_t* ui_step display_settings(ui_step); } -static void switch_settings_blind_signing(void) { - toggle_setting(&N_storage.dataAllowed, &ux_settings_flow_blind_signing_step); -} - static void switch_settings_display_data(void) { toggle_setting(&N_storage.contractDetails, &ux_settings_flow_display_data_step); } diff --git a/src_features/getAppConfiguration/cmd_getAppConfiguration.c b/src_features/getAppConfiguration/cmd_getAppConfiguration.c index 8b137d5..53f04eb 100644 --- a/src_features/getAppConfiguration/cmd_getAppConfiguration.c +++ b/src_features/getAppConfiguration/cmd_getAppConfiguration.c @@ -12,8 +12,7 @@ void handleGetAppConfiguration(uint8_t p1, UNUSED(workBuffer); UNUSED(dataLength); UNUSED(flags); - G_io_apdu_buffer[0] = (N_storage.dataAllowed ? APP_FLAG_DATA_ALLOWED : 0x00); - G_io_apdu_buffer[0] |= APP_FLAG_EXTERNAL_TOKEN_NEEDED; + G_io_apdu_buffer[0] = APP_FLAG_EXTERNAL_TOKEN_NEEDED; G_io_apdu_buffer[1] = MAJOR_VERSION; G_io_apdu_buffer[2] = MINOR_VERSION; G_io_apdu_buffer[3] = PATCH_VERSION; diff --git a/src_features/signTx/logic_signTx.c b/src_features/signTx/logic_signTx.c index 3b2e281..3e8238f 100644 --- a/src_features/signTx/logic_signTx.c +++ b/src_features/signTx/logic_signTx.c @@ -82,11 +82,6 @@ customStatus_e customProcessor(txContext_t *context) { uint32_t copySize; uint32_t fieldPos = context->currentFieldPos; if (fieldPos == 0) { // not reached if a plugin is available - if (!N_storage.dataAllowed) { - PRINTF("Data field forbidden\n"); - ui_warning_contract_data(); - return CUSTOM_FAULT; - } if (!N_storage.contractDetails) { return CUSTOM_NOT_HANDLED; } @@ -453,7 +448,7 @@ __attribute__((noinline)) static bool finalize_parsing_helper(bool direct, bool THROW(ERR_SILENT_MODE_CHECK_FAILED); } - if (tmpContent.txContent.dataPresent && !N_storage.dataAllowed) { + if (tmpContent.txContent.dataPresent) { reportFinalizeError(direct); ui_warning_contract_data(); if (!direct) { diff --git a/src_nbgl/ui_settings.c b/src_nbgl/ui_settings.c index 455ef32..999d9e7 100644 --- a/src_nbgl/ui_settings.c +++ b/src_nbgl/ui_settings.c @@ -9,8 +9,7 @@ #define SETTING_CONTENTS_NB 1 enum { - BLIND_SIGNING_TOKEN = FIRST_USER_TOKEN, - DEBUG_TOKEN, + DEBUG_TOKEN = FIRST_USER_TOKEN, NONCE_TOKEN, #ifdef HAVE_EIP712_FULL_SUPPORT EIP712_VERBOSE_TOKEN, @@ -21,8 +20,7 @@ enum { }; enum { - BLIND_SIGNING_ID = 0, - DEBUG_ID, + DEBUG_ID = 0, NONCE_ID, #ifdef HAVE_EIP712_FULL_SUPPORT EIP712_VERBOSE_ID, @@ -51,11 +49,6 @@ static void controlsCallback(int token, uint8_t index, int page) { initSettingPage = page; switch (token) { - case BLIND_SIGNING_TOKEN: - value = (N_storage.dataAllowed ? 0 : 1); - switches[BLIND_SIGNING_ID].initState = (nbgl_state_t) value; - nvm_write((void*) &N_storage.dataAllowed, (void*) &value, sizeof(uint8_t)); - break; case DEBUG_TOKEN: value = (N_storage.contractDetails ? 0 : 1); switches[DEBUG_ID].initState = (nbgl_state_t) value; @@ -84,12 +77,6 @@ static void controlsCallback(int token, uint8_t index, int page) { } void ui_menu_settings(void) { - switches[BLIND_SIGNING_ID].initState = N_storage.dataAllowed ? ON_STATE : OFF_STATE; - switches[BLIND_SIGNING_ID].text = "Blind signing"; - switches[BLIND_SIGNING_ID].subText = "Enable transaction blind\nsigning"; - switches[BLIND_SIGNING_ID].token = BLIND_SIGNING_TOKEN; - switches[BLIND_SIGNING_ID].tuneId = TUNE_TAP_CASUAL; - switches[DEBUG_ID].initState = N_storage.contractDetails ? ON_STATE : OFF_STATE; switches[DEBUG_ID].text = "Debug"; switches[DEBUG_ID].subText = "Display contract data\ndetails";