Merge remote-tracking branch 'origin/develop' into HEAD

This commit is contained in:
Alexandre Paillier
2022-09-14 17:27:25 +02:00
61 changed files with 505 additions and 72 deletions

View File

@@ -1,72 +0,0 @@
#include "shared_context.h"
#include "ui_callbacks.h"
// clang-format off
UX_STEP_NOCB(ux_approval_allowance_1_step,
pnn,
{
&C_icon_eye,
"Review",
"transaction",
});
UX_STEP_NOCB(
ux_approval_allowance_2_step,
bnnn_paging,
{
.title = "Allowance",
.text = " "
});
UX_STEP_NOCB(
ux_approval_allowance_3_step,
bnnn_paging,
{
.title = "Contract Name",
.text = strings.common.fullAddress,
});
UX_STEP_NOCB(
ux_approval_allowance_4_step,
bnnn_paging,
{
.title = "Amount",
.text = strings.common.fullAmount
});
UX_STEP_NOCB(
ux_approval_allowance_5_step,
bnnn_paging,
{
.title = "Max Fees",
.text = strings.common.maxFee,
});
UX_STEP_CB(
ux_approval_allowance_6_step,
pbb,
io_seproxyhal_touch_tx_ok(NULL),
{
&C_icon_validate_14,
"Accept",
"and send",
});
UX_STEP_CB(
ux_approval_allowance_7_step,
pb,
io_seproxyhal_touch_tx_cancel(NULL),
{
&C_icon_crossmark,
"Reject",
});
// clang-format on
UX_FLOW(ux_approval_allowance_flow,
&ux_approval_allowance_1_step,
&ux_approval_allowance_2_step,
&ux_approval_allowance_3_step,
&ux_approval_allowance_4_step,
&ux_approval_allowance_5_step,
&ux_approval_allowance_6_step,
&ux_approval_allowance_7_step);

View File

@@ -1,8 +1,6 @@
#include "shared_context.h"
#include "apdu_constants.h"
#include "ui_flow.h"
void handleGetAppConfiguration(uint8_t p1,
uint8_t p2,
const uint8_t *workBuffer,

View File

@@ -3,8 +3,9 @@
#include "shared_context.h"
#include "apdu_constants.h"
#include "ui_flow.h"
#include "feature_getEth2PublicKey.h"
#include "common_ui.h"
#include "os_io_seproxyhal.h"
static const uint8_t BLS12_381_FIELD_MODULUS[] = {
0x1a, 0x01, 0x11, 0xea, 0x39, 0x7f, 0xe6, 0x9a, 0x4b, 0x1b, 0xa7, 0xb6, 0x43, 0x4b, 0xac, 0xd7,
@@ -75,7 +76,7 @@ void handleGetEth2PublicKey(uint8_t p1,
}
#ifndef NO_CONSENT
else {
ux_flow_init(0, ux_display_public_eth2_flow, NULL);
ui_display_public_eth2();
*flags |= IO_ASYNCH_REPLY;
}

View File

@@ -1,51 +0,0 @@
#ifdef HAVE_ETH2
#include "shared_context.h"
#include "ui_callbacks.h"
void prepare_eth2_public_key() {
snprintf(strings.tmp.tmp, 100, "0x%.*H", 48, tmpCtx.publicKeyContext.publicKey.W);
}
// clang-format off
UX_STEP_NOCB(
ux_display_public_eth2_flow_1_step,
pnn,
{
&C_icon_eye,
"Verify ETH2",
"public key",
});
UX_STEP_NOCB_INIT(
ux_display_public_eth2_flow_2_step,
bnnn_paging,
prepare_eth2_public_key(),
{
.title = "Public Key",
.text = strings.tmp.tmp,
});
UX_STEP_CB(
ux_display_public_eth2_flow_3_step,
pb,
io_seproxyhal_touch_eth2_address_ok(NULL),
{
&C_icon_validate_14,
"Approve",
});
UX_STEP_CB(
ux_display_public_eth2_flow_4_step,
pb,
io_seproxyhal_touch_address_cancel(NULL),
{
&C_icon_crossmark,
"Reject",
});
// clang-format on
UX_FLOW(ux_display_public_eth2_flow,
&ux_display_public_eth2_flow_1_step,
&ux_display_public_eth2_flow_2_step,
&ux_display_public_eth2_flow_3_step,
&ux_display_public_eth2_flow_4_step);
#endif

View File

@@ -1,9 +1,10 @@
#include "shared_context.h"
#include "apdu_constants.h"
#include "ui_flow.h"
#include "feature_getPublicKey.h"
#include "ethUtils.h"
#include "common_ui.h"
#include "os_io_seproxyhal.h"
void handleGetPublicKey(uint8_t p1,
uint8_t p2,
@@ -64,7 +65,7 @@ void handleGetPublicKey(uint8_t p1,
"0x%.*s",
40,
tmpCtx.publicKeyContext.address);
ux_flow_init(0, ux_display_public_flow, NULL);
ui_display_public_key();
*flags |= IO_ASYNCH_REPLY;
}

View File

@@ -1,42 +0,0 @@
#include "shared_context.h"
#include "ui_callbacks.h"
// clang-format off
UX_STEP_NOCB(
ux_display_public_flow_1_step,
pnn,
{
&C_icon_eye,
"Verify",
"address",
});
UX_STEP_NOCB(
ux_display_public_flow_2_step,
bnnn_paging,
{
.title = "Address",
.text = strings.common.fullAddress,
});
UX_STEP_CB(
ux_display_public_flow_3_step,
pb,
io_seproxyhal_touch_address_ok(NULL),
{
&C_icon_validate_14,
"Approve",
});
UX_STEP_CB(
ux_display_public_flow_4_step,
pb,
io_seproxyhal_touch_address_cancel(NULL),
{
&C_icon_crossmark,
"Reject",
});
// clang-format on
UX_FLOW(ux_display_public_flow,
&ux_display_public_flow_1_step,
&ux_display_public_flow_2_step,
&ux_display_public_flow_3_step,
&ux_display_public_flow_4_step);

View File

@@ -2,8 +2,8 @@
#include "apdu_constants.h"
#include "ethUtils.h"
#include "ui_flow.h"
#include "feature_performPrivacyOperation.h"
#include "common_ui.h"
#define P2_PUBLIC_ENCRYPTION_KEY 0x00
#define P2_SHARED_SECRET 0x01
@@ -108,9 +108,9 @@ void handlePerformPrivacyOperation(uint8_t p1,
32,
privateKeyData);
if (p2 == P2_PUBLIC_ENCRYPTION_KEY) {
ux_flow_init(0, ux_display_privacy_public_key_flow, NULL);
ui_display_privacy_public_key();
} else {
ux_flow_init(0, ux_display_privacy_shared_secret_flow, NULL);
ui_display_privacy_shared_secret();
}
*flags |= IO_ASYNCH_REPLY;

View File

@@ -1,67 +0,0 @@
#include "shared_context.h"
#include "ui_callbacks.h"
// clang-format off
UX_STEP_NOCB(
ux_display_privacy_public_key_flow_1_step,
pnn,
{
&C_icon_eye,
"Provide public",
"privacy key",
});
UX_STEP_NOCB(
ux_display_privacy_public_key_flow_2_step,
bnnn_paging,
{
.title = "Address",
.text = strings.common.fullAddress,
});
UX_STEP_NOCB(
ux_display_privacy_public_key_flow_3_step,
bnnn_paging,
{
.title = "Key",
.text = strings.common.fullAmount,
});
UX_STEP_CB(
ux_display_privacy_public_key_flow_4_step,
pb,
io_seproxyhal_touch_privacy_ok(NULL),
{
&C_icon_validate_14,
"Approve",
});
UX_STEP_CB(
ux_display_privacy_public_key_flow_5_step,
pb,
io_seproxyhal_touch_privacy_cancel(NULL),
{
&C_icon_crossmark,
"Reject",
});
UX_STEP_NOCB(
ux_display_privacy_shared_secret_flow_1_step,
pnn,
{
&C_icon_eye,
"Provide privacy",
"secret key",
});
// clang-format on
UX_FLOW(ux_display_privacy_public_key_flow,
&ux_display_privacy_public_key_flow_1_step,
&ux_display_privacy_public_key_flow_2_step,
&ux_display_privacy_public_key_flow_3_step,
&ux_display_privacy_public_key_flow_4_step,
&ux_display_privacy_public_key_flow_5_step);
UX_FLOW(ux_display_privacy_shared_secret_flow,
&ux_display_privacy_shared_secret_flow_1_step,
&ux_display_privacy_public_key_flow_2_step,
&ux_display_privacy_public_key_flow_3_step,
&ux_display_privacy_public_key_flow_4_step,
&ux_display_privacy_public_key_flow_5_step);

View File

@@ -1,7 +1,8 @@
#include "shared_context.h"
#include "apdu_constants.h"
#include "ui_flow.h"
#include "tokens.h"
#include "common_ui.h"
#include "os_io_seproxyhal.h"
#ifdef HAVE_CONTRACT_NAME_IN_DESCRIPTOR

View File

@@ -2,9 +2,10 @@
#include "shared_context.h"
#include "apdu_constants.h"
#include "ui_flow.h"
#include "tokens.h"
#include "utils.h"
#include "common_ui.h"
#include "os_io_seproxyhal.h"
#define TYPE_SIZE 1
#define VERSION_SIZE 1

View File

@@ -1,9 +1,10 @@
#include "shared_context.h"
#include "apdu_constants.h"
#include "ui_flow.h"
#include "tokens.h"
#include "eth_plugin_interface.h"
#include "eth_plugin_internal.h"
#include "common_ui.h"
#include "os_io_seproxyhal.h"
void handleSetExternalPlugin(uint8_t p1,
uint8_t p2,

View File

@@ -1,10 +1,11 @@
#include "shared_context.h"
#include "apdu_constants.h"
#include "ui_flow.h"
#include "tokens.h"
#include "eth_plugin_interface.h"
#include "eth_plugin_internal.h"
#include "utils.h"
#include "common_ui.h"
#include "os_io_seproxyhal.h"
// Supported internal plugins
#define ERC721_STR "ERC721"

View File

@@ -2,7 +2,7 @@
#include "shared_context.h"
#include "apdu_constants.h"
#include "utils.h"
#include "ui_flow.h"
#include "common_ui.h"
static const char SIGN_MAGIC[] =
"\x19"
@@ -188,7 +188,7 @@ void handleSignPersonalMessage(uint8_t p1,
#ifdef NO_CONSENT
io_seproxyhal_touch_signMessage_ok(NULL);
#else // NO_CONSENT
ux_flow_init(0, ux_sign_flow, NULL);
ui_display_sign();
#endif // NO_CONSENT
*flags |= IO_ASYNCH_REPLY;

View File

@@ -1,44 +0,0 @@
#include "shared_context.h"
#include "ui_callbacks.h"
// clang-format off
UX_STEP_NOCB(
ux_sign_flow_1_step,
pnn,
{
&C_icon_certificate,
"Sign",
"message",
});
UX_STEP_NOCB(
ux_sign_flow_2_step,
bnnn_paging,
{
.title = "Message",
.text = strings.tmp.tmp,
});
UX_STEP_CB(
ux_sign_flow_3_step,
pbb,
io_seproxyhal_touch_signMessage_ok(NULL),
{
&C_icon_validate_14,
"Sign",
"message",
});
UX_STEP_CB(
ux_sign_flow_4_step,
pbb,
io_seproxyhal_touch_signMessage_cancel(NULL),
{
&C_icon_crossmark,
"Cancel",
"signature",
});
// clang-format on
UX_FLOW(ux_sign_flow,
&ux_sign_flow_1_step,
&ux_sign_flow_2_step,
&ux_sign_flow_3_step,
&ux_sign_flow_4_step);

View File

@@ -1,72 +0,0 @@
#include "shared_context.h"
#include "ui_callbacks.h"
#include "common_712.h"
#include "ethUtils.h"
void prepare_domain_hash_v0() {
snprintf(strings.tmp.tmp,
sizeof(strings.tmp.tmp),
"0x%.*H",
KECCAK256_HASH_BYTESIZE,
tmpCtx.messageSigningContext712.domainHash);
}
void prepare_message_hash_v0() {
snprintf(strings.tmp.tmp,
sizeof(strings.tmp.tmp),
"0x%.*H",
KECCAK256_HASH_BYTESIZE,
tmpCtx.messageSigningContext712.messageHash);
}
// clang-format off
UX_STEP_NOCB(
ux_sign_712_v0_flow_1_step,
pnn,
{
&C_icon_certificate,
"Sign",
"typed message",
});
UX_STEP_NOCB_INIT(
ux_sign_712_v0_flow_2_step,
bnnn_paging,
prepare_domain_hash_v0(),
{
.title = "Domain hash",
.text = strings.tmp.tmp,
});
UX_STEP_NOCB_INIT(
ux_sign_712_v0_flow_3_step,
bnnn_paging,
prepare_message_hash_v0(),
{
.title = "Message hash",
.text = strings.tmp.tmp,
});
UX_STEP_CB(
ux_sign_712_v0_flow_4_step,
pbb,
ui_712_approve_cb(NULL),
{
&C_icon_validate_14,
"Sign",
"message",
});
UX_STEP_CB(
ux_sign_712_v0_flow_5_step,
pbb,
ui_712_reject_cb(NULL),
{
&C_icon_crossmark,
"Cancel",
"signature",
});
// clang-format on
UX_FLOW(ux_sign_712_v0_flow,
&ux_sign_712_v0_flow_1_step,
&ux_sign_712_v0_flow_2_step,
&ux_sign_712_v0_flow_3_step,
&ux_sign_712_v0_flow_4_step,
&ux_sign_712_v0_flow_5_step);

View File

@@ -1,6 +1,5 @@
#include "shared_context.h"
#include "apdu_constants.h"
#include "ui_flow.h"
#include "feature_signTx.h"
#include "eth_plugin_interface.h"

View File

@@ -1,7 +1,5 @@
#include "shared_context.h"
#include "utils.h"
#include "ui_callbacks.h"
#include "ui_flow.h"
#include "feature_signTx.h"
#ifdef HAVE_STARKWARE
#include "stark_utils.h"
@@ -9,6 +7,8 @@
#include "eth_plugin_handler.h"
#include "network.h"
#include "ethUtils.h"
#include "common_ui.h"
#include "ui_callbacks.h"
#define ERR_SILENT_MODE_CHECK_FAILED 0x6001
@@ -144,7 +144,7 @@ customStatus_e customProcessor(txContext_t *context) {
dataContext.tokenContext.fieldOffset = 0;
if (fieldPos == 0) {
array_hexstr(strings.tmp.tmp, dataContext.tokenContext.data, 4);
ux_flow_init(0, ux_confirm_selector_flow, NULL);
ui_confirm_selector();
} else {
uint32_t offset = 0;
uint32_t i;
@@ -159,7 +159,7 @@ customStatus_e customProcessor(txContext_t *context) {
strings.tmp.tmp[offset++] = ':';
}
}
ux_flow_init(0, ux_confirm_parameter_flow, NULL);
ui_confirm_parameter();
}
} else {
return CUSTOM_HANDLED;

View File

@@ -1,236 +0,0 @@
#include "shared_context.h"
#include "ui_callbacks.h"
#include "chainConfig.h"
#include "utils.h"
#include "feature_signTx.h"
#include "network.h"
#include "eth_plugin_handler.h"
#include "ui_plugin.h"
// clang-format off
UX_STEP_NOCB(
ux_confirm_selector_flow_1_step,
pnn,
{
&C_icon_eye,
"Verify",
"selector",
});
UX_STEP_NOCB(
ux_confirm_selector_flow_2_step,
bn,
{
"Selector",
strings.tmp.tmp
});
UX_STEP_CB(
ux_confirm_selector_flow_3_step,
pb,
io_seproxyhal_touch_data_ok(NULL),
{
&C_icon_validate_14,
"Approve",
});
UX_STEP_CB(
ux_confirm_selector_flow_4_step,
pb,
io_seproxyhal_touch_data_cancel(NULL),
{
&C_icon_crossmark,
"Reject",
});
// clang-format on
UX_FLOW(ux_confirm_selector_flow,
&ux_confirm_selector_flow_1_step,
&ux_confirm_selector_flow_2_step,
&ux_confirm_selector_flow_3_step,
&ux_confirm_selector_flow_4_step);
//////////////////////////////////////////////////////////////////////
// clang-format off
UX_STEP_NOCB(
ux_confirm_parameter_flow_1_step,
pnn,
{
&C_icon_eye,
"Verify",
strings.tmp.tmp2
});
UX_STEP_NOCB(
ux_confirm_parameter_flow_2_step,
bnnn_paging,
{
.title = "Parameter",
.text = strings.tmp.tmp,
});
UX_STEP_CB(
ux_confirm_parameter_flow_3_step,
pb,
io_seproxyhal_touch_data_ok(NULL),
{
&C_icon_validate_14,
"Approve",
});
UX_STEP_CB(
ux_confirm_parameter_flow_4_step,
pb,
io_seproxyhal_touch_data_cancel(NULL),
{
&C_icon_crossmark,
"Reject",
});
// clang-format on
UX_FLOW(ux_confirm_parameter_flow,
&ux_confirm_parameter_flow_1_step,
&ux_confirm_parameter_flow_2_step,
&ux_confirm_parameter_flow_3_step,
&ux_confirm_parameter_flow_4_step);
//////////////////////////////////////////////////////////////////////
// clang-format off
UX_STEP_NOCB(ux_approval_review_step,
pnn,
{
&C_icon_eye,
"Review",
"transaction",
});
UX_STEP_NOCB(
ux_approval_amount_step,
bnnn_paging,
{
.title = "Amount",
.text = strings.common.fullAmount
});
UX_STEP_NOCB(
ux_approval_address_step,
bnnn_paging,
{
.title = "Address",
.text = strings.common.fullAddress,
});
UX_STEP_NOCB_INIT(
ux_plugin_approval_id_step,
bnnn_paging,
plugin_ui_get_id(),
{
.title = strings.common.fullAddress,
.text = strings.common.fullAmount
});
UX_STEP_INIT(
ux_plugin_approval_before_step,
NULL,
NULL,
{
display_next_plugin_item(true);
});
UX_FLOW_DEF_NOCB(
ux_plugin_approval_display_step,
bnnn_paging,
{
.title = strings.common.fullAddress,
.text = strings.common.fullAmount
});
UX_STEP_INIT(
ux_plugin_approval_after_step,
NULL,
NULL,
{
display_next_plugin_item(false);
});
UX_STEP_NOCB(
ux_approval_fees_step,
bnnn_paging,
{
.title = "Max Fees",
.text = strings.common.maxFee,
});
UX_STEP_NOCB(
ux_approval_network_step,
bnnn_paging,
{
.title = "Network",
.text = strings.common.network_name,
});
UX_STEP_CB(
ux_approval_accept_step,
pbb,
io_seproxyhal_touch_tx_ok(NULL),
{
&C_icon_validate_14,
"Accept",
"and send",
});
UX_STEP_CB(
ux_approval_reject_step,
pb,
io_seproxyhal_touch_tx_cancel(NULL),
{
&C_icon_crossmark,
"Reject",
});
UX_STEP_NOCB(
ux_approval_nonce_step,
bnnn_paging,
{
.title = "Nonce",
.text = strings.common.nonce,
});
UX_STEP_NOCB(ux_approval_blind_signing_warning_step,
pbb,
{
&C_icon_warning,
"Blind",
"Signing",
});
// clang-format on
const ux_flow_step_t *ux_approval_tx_flow[15];
void ux_approve_tx(bool fromPlugin) {
int step = 0;
ux_approval_tx_flow[step++] = &ux_approval_review_step;
if (!fromPlugin && tmpContent.txContent.dataPresent && !N_storage.contractDetails) {
ux_approval_tx_flow[step++] = &ux_approval_blind_signing_warning_step;
}
if (fromPlugin) {
// Add the special dynamic display logic
ux_approval_tx_flow[step++] = &ux_plugin_approval_id_step;
ux_approval_tx_flow[step++] = &ux_plugin_approval_before_step;
ux_approval_tx_flow[step++] = &ux_plugin_approval_display_step;
ux_approval_tx_flow[step++] = &ux_plugin_approval_after_step;
} else {
// We're in a regular transaction, just show the amount and the address
ux_approval_tx_flow[step++] = &ux_approval_amount_step;
ux_approval_tx_flow[step++] = &ux_approval_address_step;
}
if (N_storage.displayNonce) {
ux_approval_tx_flow[step++] = &ux_approval_nonce_step;
}
uint64_t chain_id = get_chain_id();
if (chainConfig->chainId == ETHEREUM_MAINNET_CHAINID && chain_id != chainConfig->chainId) {
ux_approval_tx_flow[step++] = &ux_approval_network_step;
}
ux_approval_tx_flow[step++] = &ux_approval_fees_step;
ux_approval_tx_flow[step++] = &ux_approval_accept_step;
ux_approval_tx_flow[step++] = &ux_approval_reject_step;
ux_approval_tx_flow[step++] = FLOW_END_STEP;
ux_flow_init(0, ux_approval_tx_flow, NULL);
}

View File

@@ -1,76 +0,0 @@
#include "feature_signTx.h"
#include "ux.h"
#include "eth_plugin_handler.h"
#include "ui_callbacks.h"
#include "ui_plugin.h"
// This function is not exported by the SDK
void ux_layout_paging_redisplay_by_addr(unsigned int stack_slot);
void plugin_ui_get_id() {
ethQueryContractID_t pluginQueryContractID;
eth_plugin_prepare_query_contract_ID(&pluginQueryContractID,
strings.common.fullAddress,
sizeof(strings.common.fullAddress),
strings.common.fullAmount,
sizeof(strings.common.fullAmount));
// Query the original contract for ID if it's not an internal alias
if (!eth_plugin_call(ETH_PLUGIN_QUERY_CONTRACT_ID, (void *) &pluginQueryContractID)) {
PRINTF("Plugin query contract ID call failed\n");
io_seproxyhal_touch_tx_cancel(NULL);
}
}
void plugin_ui_get_item() {
ethQueryContractUI_t pluginQueryContractUI;
eth_plugin_prepare_query_contract_UI(&pluginQueryContractUI,
dataContext.tokenContext.pluginUiCurrentItem,
strings.common.fullAddress,
sizeof(strings.common.fullAddress),
strings.common.fullAmount,
sizeof(strings.common.fullAmount));
if (!eth_plugin_call(ETH_PLUGIN_QUERY_CONTRACT_UI, (void *) &pluginQueryContractUI)) {
PRINTF("Plugin query contract UI call failed\n");
io_seproxyhal_touch_tx_cancel(NULL);
}
}
void display_next_plugin_item(bool entering) {
if (entering) {
if (dataContext.tokenContext.pluginUiState == PLUGIN_UI_OUTSIDE) {
dataContext.tokenContext.pluginUiState = PLUGIN_UI_INSIDE;
dataContext.tokenContext.pluginUiCurrentItem = 0;
plugin_ui_get_item();
ux_flow_next();
} else {
if (dataContext.tokenContext.pluginUiCurrentItem > 0) {
dataContext.tokenContext.pluginUiCurrentItem--;
plugin_ui_get_item();
ux_flow_next();
} else {
dataContext.tokenContext.pluginUiState = PLUGIN_UI_OUTSIDE;
dataContext.tokenContext.pluginUiCurrentItem = 0;
ux_flow_prev();
}
}
} else {
if (dataContext.tokenContext.pluginUiState == PLUGIN_UI_OUTSIDE) {
dataContext.tokenContext.pluginUiState = PLUGIN_UI_INSIDE;
plugin_ui_get_item();
ux_flow_prev();
} else {
if (dataContext.tokenContext.pluginUiCurrentItem <
dataContext.tokenContext.pluginUiMaxItems - 1) {
dataContext.tokenContext.pluginUiCurrentItem++;
plugin_ui_get_item();
ux_flow_prev();
// Reset multi page layout to the first page
G_ux.layout_paging.current = 0;
ux_layout_paging_redisplay_by_addr(G_ux.stack_count - 1);
} else {
dataContext.tokenContext.pluginUiState = PLUGIN_UI_OUTSIDE;
ux_flow_next();
}
}
}
}

View File

@@ -1,8 +0,0 @@
#ifndef _UI_PLUGIN_H_
#define _UI_PLUGIN_H_
void plugin_ui_get_id();
void plugin_ui_get_item();
void display_next_plugin_item(bool entering);
#endif // _UI_PLUGIN_H_

View File

@@ -4,7 +4,8 @@
#include "apdu_constants.h"
#include "stark_utils.h"
#include "feature_stark_getPublicKey.h"
#include "ui_flow.h"
#include "common_ui.h"
#include "os_io_seproxyhal.h"
void handleStarkwareGetPublicKey(uint8_t p1,
uint8_t p2,
@@ -55,7 +56,7 @@ void handleStarkwareGetPublicKey(uint8_t p1,
"0x%.*H",
32,
tmpCtx.publicKeyContext.publicKey.W + 1);
ux_flow_init(0, ux_display_stark_public_flow, NULL);
ui_display_stark_public();
*flags |= IO_ASYNCH_REPLY;
}

View File

@@ -1,48 +0,0 @@
#ifdef HAVE_STARKWARE
#include "shared_context.h"
#include "ui_callbacks.h"
unsigned int io_seproxyhal_touch_stark_pubkey_ok(const bagl_element_t *e);
// clang-format off
UX_STEP_NOCB(
ux_display_stark_public_flow_1_step,
pnn,
{
&C_icon_eye,
"Verify",
"Stark key",
});
UX_STEP_NOCB(
ux_display_stark_public_flow_2_step,
bnnn_paging,
{
.title = "Stark Key",
.text = strings.tmp.tmp,
});
UX_STEP_CB(
ux_display_stark_public_flow_3_step,
pb,
io_seproxyhal_touch_stark_pubkey_ok(NULL),
{
&C_icon_validate_14,
"Approve",
});
UX_STEP_CB(
ux_display_stark_public_flow_4_step,
pb,
io_seproxyhal_touch_address_cancel(NULL),
{
&C_icon_crossmark,
"Reject",
});
// clang-format on
UX_FLOW(ux_display_stark_public_flow,
&ux_display_stark_public_flow_1_step,
&ux_display_stark_public_flow_2_step,
&ux_display_stark_public_flow_3_step,
&ux_display_stark_public_flow_4_step);
#endif

View File

@@ -2,8 +2,8 @@
#include "shared_context.h"
#include "apdu_constants.h"
#include "ui_flow.h"
#include "ethUtils.h"
#include "common_ui.h"
void handleStarkwareProvideQuantum(uint8_t p1,
__attribute__((unused)) uint8_t p2,

View File

@@ -3,10 +3,10 @@
#include "shared_context.h"
#include "apdu_constants.h"
#include "stark_utils.h"
#include "ui_flow.h"
#include "poorstream.h"
#include "ui_callbacks.h"
#include "ethUtils.h"
#include "common_ui.h"
#include "os_io_seproxyhal.h"
#define U8BE(buf, off) \
(uint64_t)((((uint64_t) U4BE(buf, off)) << 32) | (((uint64_t) U4BE(buf, off + 4)) & 0xFFFFFFFF))
@@ -249,20 +249,9 @@ void handleStarkwareSignMessage(uint8_t p1,
}
}
if (order) {
ux_flow_init(0, ux_stark_limit_order_flow, NULL);
ui_stark_limit_order();
} else {
if (selfTransfer) {
ux_flow_init(
0,
(dataContext.starkContext.conditional ? ux_stark_self_transfer_conditional_flow
: ux_stark_self_transfer_flow),
NULL);
} else {
ux_flow_init(0,
(dataContext.starkContext.conditional ? ux_stark_transfer_conditional_flow
: ux_stark_transfer_flow),
NULL);
}
ui_stark_transfer(selfTransfer, dataContext.starkContext.conditional);
}
*flags |= IO_ASYNCH_REPLY;

View File

@@ -1,241 +0,0 @@
#ifdef HAVE_STARKWARE
#include "shared_context.h"
#include "ui_callbacks.h"
#include "ethUtils.h"
unsigned int io_seproxyhal_touch_stark_ok(const bagl_element_t *e);
void stark_sign_display_master_account() {
snprintf(strings.tmp.tmp,
sizeof(strings.tmp.tmp),
"0x%.*H",
32,
dataContext.starkContext.transferDestination);
}
void stark_sign_display_condition_fact() {
snprintf(strings.tmp.tmp, sizeof(strings.tmp.tmp), "0x%.*H", 32, dataContext.starkContext.fact);
}
// clang-format off
UX_STEP_NOCB(ux_stark_limit_order_1_step,
pnn,
{
&C_icon_eye,
"Review",
"transaction",
});
UX_STEP_NOCB(ux_stark_limit_order_2_step,
bnnn_paging,
{
.title = "Limit",
.text = "Order"
});
UX_STEP_NOCB(ux_stark_limit_order_3_step,
bnnn_paging,
{
.title = "Trading",
.text = "Pair"
});
UX_STEP_NOCB(ux_stark_limit_order_4_step,
bnnn_paging,
{
.title = "Sell",
.text = strings.common.fullAmount
});
UX_STEP_NOCB(ux_stark_limit_order_5_step,
bnnn_paging,
{
.title = "Buy",
.text = strings.common.maxFee
});
UX_STEP_NOCB(ux_stark_limit_order_6_step,
bnnn_paging,
{
.title = "Token Account",
.text = strings.common.fullAddress
});
UX_STEP_CB(
ux_stark_limit_order_7_step,
pbb,
io_seproxyhal_touch_stark_ok(NULL),
{
&C_icon_validate_14,
"Accept",
"and send",
});
UX_STEP_CB(
ux_stark_limit_order_8_step,
pb,
io_seproxyhal_touch_tx_cancel(NULL),
{
&C_icon_crossmark,
"Reject",
});
// clang-format on
UX_FLOW(ux_stark_limit_order_flow,
&ux_stark_limit_order_1_step,
&ux_stark_limit_order_2_step,
&ux_stark_limit_order_3_step,
&ux_stark_limit_order_4_step,
&ux_stark_limit_order_5_step,
&ux_stark_limit_order_6_step,
&ux_stark_limit_order_7_step,
&ux_stark_limit_order_8_step);
//////////////////////////////////////////////////////////////////////
// clang-format off
UX_STEP_NOCB(ux_stark_transfer_1_step,
pnn,
{
&C_icon_eye,
"Review",
"transaction",
});
UX_STEP_NOCB(ux_stark_transfer_2_step,
bnnn_paging,
{
.title = "Transfer",
.text = " "
});
UX_STEP_NOCB(ux_stark_self_transfer_2_step,
bnnn_paging,
{
.title = "Self",
.text = "Transfer"
});
UX_STEP_NOCB(ux_stark_conditional_transfer_2_step,
bnnn_paging,
{
.title = "Conditional",
.text = "Transfer"
});
UX_STEP_NOCB(ux_stark_self_conditional_transfer_2_step,
bnnn_paging,
{
.title = "Conditional",
.text = "Self Transfer"
});
UX_STEP_NOCB(ux_stark_transfer_3_step,
bnnn_paging,
{
.title = "Amount",
.text = tmpContent.tmp
});
UX_STEP_NOCB(ux_stark_transfer_4_step,
bnnn_paging,
{
.title = "Master Account",
.text = strings.tmp.tmp
});
UX_STEP_NOCB(ux_stark_transfer_5_step,
bnnn_paging,
{
.title = "Token Account",
.text = strings.tmp.tmp2
});
UX_STEP_CB(
ux_stark_transfer_6_step,
pbb,
io_seproxyhal_touch_stark_ok(NULL),
{
&C_icon_validate_14,
"Accept",
"and send",
});
UX_STEP_CB(
ux_stark_transfer_7_step,
pb,
io_seproxyhal_touch_tx_cancel(NULL),
{
&C_icon_crossmark,
"Reject",
});
UX_STEP_NOCB_INIT(
ux_stark_conditional_transfer_4_step,
bnnn_paging,
stark_sign_display_master_account(),
{
.title = "Master Account",
.text = strings.tmp.tmp
});
UX_STEP_NOCB_INIT(
ux_stark_conditional_transfer_8_step,
bnnn_paging,
getEthDisplayableAddress(dataContext.starkContext.conditionAddress,
strings.tmp.tmp,
sizeof(strings.tmp.tmp),
&global_sha3,
chainConfig->chainId),
{
.title = "Cond. Address",
.text = strings.tmp.tmp
});
UX_STEP_NOCB_INIT(
ux_stark_conditional_transfer_9_step,
bnnn_paging,
stark_sign_display_condition_fact(),
{
.title = "Cond. Fact",
.text = strings.tmp.tmp
});
// clang-format on
UX_FLOW(ux_stark_transfer_flow,
&ux_stark_transfer_1_step,
&ux_stark_transfer_2_step,
&ux_stark_transfer_3_step,
&ux_stark_transfer_4_step,
&ux_stark_transfer_5_step,
&ux_stark_transfer_6_step,
&ux_stark_transfer_7_step);
UX_FLOW(ux_stark_self_transfer_flow,
&ux_stark_transfer_1_step,
&ux_stark_self_transfer_2_step,
&ux_stark_transfer_3_step,
&ux_stark_transfer_5_step,
&ux_stark_transfer_6_step,
&ux_stark_transfer_7_step);
UX_FLOW(ux_stark_transfer_conditional_flow,
&ux_stark_transfer_1_step,
&ux_stark_conditional_transfer_2_step,
&ux_stark_transfer_3_step,
&ux_stark_conditional_transfer_4_step,
&ux_stark_transfer_5_step,
&ux_stark_conditional_transfer_8_step,
&ux_stark_conditional_transfer_9_step,
&ux_stark_transfer_6_step,
&ux_stark_transfer_7_step);
UX_FLOW(ux_stark_self_transfer_conditional_flow,
&ux_stark_transfer_1_step,
&ux_stark_self_conditional_transfer_2_step,
&ux_stark_transfer_3_step,
&ux_stark_transfer_5_step,
&ux_stark_conditional_transfer_8_step,
&ux_stark_conditional_transfer_9_step,
&ux_stark_transfer_6_step,
&ux_stark_transfer_7_step);
#endif

View File

@@ -3,8 +3,8 @@
#include "shared_context.h"
#include "apdu_constants.h"
#include "stark_utils.h"
#include "ui_flow.h"
#include "ui_callbacks.h"
#include "common_ui.h"
#include "os_io_seproxyhal.h"
void handleStarkwareUnsafeSign(uint8_t p1,
uint8_t p2,
@@ -47,7 +47,7 @@ void handleStarkwareUnsafeSign(uint8_t p1,
explicit_bzero(privateKeyData, sizeof(privateKeyData));
io_seproxyhal_io_heartbeat();
memmove(dataContext.starkContext.w1, publicKey.W + 1, 32);
ux_flow_init(0, ux_stark_unsafe_sign_flow, NULL);
ui_stark_unsafe_sign();
*flags |= IO_ASYNCH_REPLY;
}

View File

@@ -1,70 +0,0 @@
#ifdef HAVE_STARKWARE
#include "shared_context.h"
#include "ui_callbacks.h"
unsigned int io_seproxyhal_touch_stark_unsafe_sign_ok(const bagl_element_t *e);
void stark_unsafe_sign_display_account() {
snprintf(strings.tmp.tmp, sizeof(strings.tmp.tmp), "0x%.*H", 32, dataContext.starkContext.w1);
}
void stark_unsafe_sign_display_hash() {
snprintf(strings.tmp.tmp, sizeof(strings.tmp.tmp), "0x%.*H", 32, dataContext.starkContext.w2);
}
// clang-format off
UX_STEP_NOCB(ux_stark_unsafe_sign_1_step,
pnn,
{
&C_icon_warning,
"Unsafe",
"Stark Sign",
});
UX_STEP_NOCB_INIT(
ux_stark_unsafe_sign_2_step,
bnnn_paging,
stark_unsafe_sign_display_account(),
{
.title = "From Account",
.text = strings.tmp.tmp
});
UX_STEP_NOCB_INIT(
ux_stark_unsafe_sign_3_step,
bnnn_paging,
stark_unsafe_sign_display_hash(),
{
.title = "Hash",
.text = strings.tmp.tmp
});
UX_STEP_CB(
ux_stark_unsafe_sign_4_step,
pbb,
io_seproxyhal_touch_stark_unsafe_sign_ok(NULL),
{
&C_icon_validate_14,
"Accept",
"and send",
});
UX_STEP_CB(
ux_stark_unsafe_sign_5_step,
pb,
io_seproxyhal_touch_tx_cancel(NULL),
{
&C_icon_crossmark,
"Reject",
});
// clang-format on
UX_FLOW(ux_stark_unsafe_sign_flow,
&ux_stark_unsafe_sign_1_step,
&ux_stark_unsafe_sign_2_step,
&ux_stark_unsafe_sign_3_step,
&ux_stark_unsafe_sign_4_step,
&ux_stark_unsafe_sign_5_step);
#endif