Removed blind signing setting

This commit is contained in:
Alexandre Paillier
2024-06-21 09:51:53 +02:00
parent 0623a8c682
commit fbd913bc33
7 changed files with 8 additions and 62 deletions

View File

@@ -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;

View File

@@ -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

View File

@@ -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

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -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) {

View File

@@ -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";