Skip to content

Commit

Permalink
Misc modifications from previous review
Browse files Browse the repository at this point in the history
  • Loading branch information
fbeutin-ledger committed Oct 26, 2023
1 parent 2946910 commit a347fae
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/eth_plugin_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ typedef enum {
ETH_PLUGIN_INTERFACE_VERSION_3 = 3,
ETH_PLUGIN_INTERFACE_VERSION_4 = 4,
ETH_PLUGIN_INTERFACE_VERSION_5 = 5,
ETH_PLUGIN_INTERFACE_VERSION_LATEST = 6
ETH_PLUGIN_INTERFACE_VERSION_LATEST = 6,
} eth_plugin_interface_version_t;

typedef enum {
Expand All @@ -25,7 +25,7 @@ typedef enum {
ETH_PLUGIN_PROVIDE_INFO = 0x0104,
ETH_PLUGIN_QUERY_CONTRACT_ID = 0x0105,
ETH_PLUGIN_QUERY_CONTRACT_UI = 0x0106,
ETH_PLUGIN_CHECK_PRESENCE = 0x01FF
ETH_PLUGIN_CHECK_PRESENCE = 0x01FF,

} eth_plugin_msg_t;

Expand All @@ -39,14 +39,14 @@ typedef enum {
ETH_PLUGIN_RESULT_SUCCESSFUL = 0x03, // Used for comparison
ETH_PLUGIN_RESULT_OK = 0x04,
ETH_PLUGIN_RESULT_OK_ALIAS = 0x05,
ETH_PLUGIN_RESULT_FALLBACK = 0x06
ETH_PLUGIN_RESULT_FALLBACK = 0x06,

} eth_plugin_result_t;

typedef enum {

ETH_UI_TYPE_AMOUNT_ADDRESS = 0x01,
ETH_UI_TYPE_GENERIC = 0x02
ETH_UI_TYPE_GENERIC = 0x02,

} eth_ui_type_t;

Expand Down
19 changes: 14 additions & 5 deletions src_features/provideDomainName/cmd_provide_domain_name.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,13 @@ static bool handle_challenge(const s_tlv_data *data,
s_domain_name_info *domain_name_info,
s_sig_ctx *sig_ctx) {
uint32_t value;

(void) domain_name_info;
(void) sig_ctx;
return get_uint_from_data(data, &value) && (value == get_challenge());

if (!get_uint_from_data(data, &value)) {
return false;
}
return (value == get_challenge());
}

/**
Expand All @@ -223,8 +226,8 @@ static bool handle_sign_key_id(const s_tlv_data *data,
s_domain_name_info *domain_name_info,
s_sig_ctx *sig_ctx) {
uint32_t value;

(void) domain_name_info;

if (!get_uint_from_data(data, &value) || (value > UINT8_MAX)) {
return false;
}
Expand All @@ -247,7 +250,10 @@ static bool handle_sign_algo(const s_tlv_data *data,

(void) domain_name_info;
(void) sig_ctx;
return get_uint_from_data(data, &value) && (value == ALGO_SECP256K1);
if (!get_uint_from_data(data, &value)) {
return false;
}
return (value == ALGO_SECP256K1);
}

/**
Expand Down Expand Up @@ -338,7 +344,10 @@ static bool handle_coin_type(const s_tlv_data *data,

(void) domain_name_info;
(void) sig_ctx;
return get_uint_from_data(data, &value) && (value == SLIP_44_ETHEREUM);
if (!get_uint_from_data(data, &value)) {
return false;
}
return (value == SLIP_44_ETHEREUM);
}

/**
Expand Down

0 comments on commit a347fae

Please sign in to comment.