Remove trailing whitespaces
This commit is contained in:
@@ -33,7 +33,7 @@ void handle_check_address(check_address_parameters_t* params, chain_config_t* ch
|
||||
uint8_t privateKeyData[32];
|
||||
cx_ecfp_public_key_t publicKey;
|
||||
} locals_union2;
|
||||
|
||||
|
||||
|
||||
if ((bip32PathLength < 0x01) ||
|
||||
(bip32PathLength > MAX_BIP32_PATH) ||
|
||||
@@ -61,7 +61,6 @@ void handle_check_address(check_address_parameters_t* params, chain_config_t* ch
|
||||
|
||||
if ((strlen(locals_union1.address) != strlen(params->address_to_check + offset_0x)) ||
|
||||
os_memcmp(locals_union1.address, params->address_to_check + offset_0x, strlen(locals_union1.address)) != 0) {
|
||||
os_memcpy(params->address_to_check, locals_union1.address, 45);
|
||||
PRINTF("Addresses doesn't match\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ void copy_transaction_parameters(create_transaction_parameters_t* sign_transacti
|
||||
txStringProperties_t stack_data;
|
||||
memset(&stack_data, 0, sizeof(stack_data));
|
||||
strncpy(stack_data.fullAddress, sign_transaction_params->destination_address, sizeof(stack_data.fullAddress));
|
||||
if ((stack_data.fullAddress[sizeof(stack_data.fullAddress) - 1] != '\0') ||
|
||||
if ((stack_data.fullAddress[sizeof(stack_data.fullAddress) - 1] != '\0') ||
|
||||
(sign_transaction_params->amount_length > 32) ||
|
||||
(sign_transaction_params->fee_amount_length > 8)) {
|
||||
os_lib_end();
|
||||
|
||||
@@ -16,7 +16,7 @@ void poorstream_flush(poorstream_t *stream) {
|
||||
*(stream->pointer + 4) = (stream->accumulator >> 24);
|
||||
*(stream->pointer + 5) = (stream->accumulator >> 16);
|
||||
*(stream->pointer + 6) = (stream->accumulator >> 8);
|
||||
*(stream->pointer + 7) = (stream->accumulator >> 0);
|
||||
*(stream->pointer + 7) = (stream->accumulator >> 0);
|
||||
}
|
||||
|
||||
void poorstream_write_bits(poorstream_t *stream, uint64_t bits, uint32_t num_bits) {
|
||||
|
||||
@@ -30,11 +30,11 @@ typedef struct internalStorage_t {
|
||||
} internalStorage_t;
|
||||
|
||||
typedef struct tokenContext_t {
|
||||
#ifdef HAVE_STARKWARE
|
||||
#ifdef HAVE_STARKWARE
|
||||
uint8_t data[4 + 32 + 32 + 32 + 32];
|
||||
#else
|
||||
#else
|
||||
uint8_t data[4 + 32 + 32];
|
||||
#endif
|
||||
#endif
|
||||
uint32_t dataFieldPos;
|
||||
#ifdef HAVE_STARKWARE
|
||||
uint8_t quantum[32];
|
||||
|
||||
@@ -9,21 +9,21 @@ static unsigned char const C_cx_Stark256_n[] = {
|
||||
//n: 0x0800000000000010ffffffffffffffffb781126dcae7b2321e66a241adc64d2f
|
||||
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xb7, 0x81, 0x12, 0x6d, 0xca, 0xe7, 0xb2, 0x32, 0x1e, 0x66, 0xa2, 0x41, 0xad, 0xc6, 0x4d, 0x2f};
|
||||
|
||||
|
||||
// C_cx_secp256k1_n - (C_cx_secp256k1_n % C_cx_Stark256_n)
|
||||
static unsigned char const STARK_DERIVE_BIAS[] = {
|
||||
0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7,
|
||||
0x38, 0xa1, 0x3b, 0x4b, 0x92, 0x0e, 0x94, 0x11, 0xae, 0x6d, 0xa5, 0xf4, 0x0b, 0x03, 0x58, 0xb1
|
||||
};
|
||||
};
|
||||
|
||||
void starkDerivePrivateKey(uint32_t *bip32Path, uint32_t bip32PathLength, uint8_t *privateKeyData) {
|
||||
#if 0
|
||||
// Sanity check
|
||||
void starkDerivePrivateKey(uint32_t *bip32Path, uint32_t bip32PathLength, uint8_t *privateKeyData) {
|
||||
#if 0
|
||||
// Sanity check
|
||||
if (bip32Path[0] != STARK_BIP32_PATH_0) {
|
||||
PRINTF("Invalid Stark derivation path %d\n", bip32Path[0]);
|
||||
THROW(0x6a80);
|
||||
}
|
||||
os_perso_derive_node_bip32(CX_CURVE_256K1, bip32Path, bip32PathLength, privateKeyData, NULL);
|
||||
os_perso_derive_node_bip32(CX_CURVE_256K1, bip32Path, bip32PathLength, privateKeyData, NULL);
|
||||
PRINTF("Private key before processing %.*H\n", 32, privateKeyData);
|
||||
// TODO - support additional schemes
|
||||
cx_math_modm(privateKeyData, 32, C_cx_Stark256_n, 32);
|
||||
@@ -31,12 +31,12 @@ void starkDerivePrivateKey(uint32_t *bip32Path, uint32_t bip32PathLength, uint8_
|
||||
#else
|
||||
uint8_t tmp[33];
|
||||
uint8_t index = 0;
|
||||
// Sanity check
|
||||
// Sanity check
|
||||
if ((bip32PathLength < 2) || (bip32Path[0] != STARK_BIP32_PATH_0) || (bip32Path[1] != STARK_BIP32_PATH_1)) {
|
||||
PRINTF("Invalid Stark derivation path %d %d\n", bip32Path[0], bip32Path[1]);
|
||||
THROW(0x6a80);
|
||||
}
|
||||
os_perso_derive_node_bip32(CX_CURVE_256K1, bip32Path, bip32PathLength, tmp, NULL);
|
||||
os_perso_derive_node_bip32(CX_CURVE_256K1, bip32Path, bip32PathLength, tmp, NULL);
|
||||
PRINTF("Private key before processing %.*H\n", 32, tmp);
|
||||
for(;;) {
|
||||
tmp[32] = index;
|
||||
@@ -48,13 +48,13 @@ void starkDerivePrivateKey(uint32_t *bip32Path, uint32_t bip32PathLength, uint8_
|
||||
index++;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void stark_get_amount_string(uint8_t *contractAddress, uint8_t *quantum256, uint8_t *amount64, char *tmp100, char *target100) {
|
||||
uint256_t amountPre, quantum, amount;
|
||||
uint8_t decimals;
|
||||
char *ticker = (char*)PIC(chainConfig->coinName);
|
||||
uint8_t decimals;
|
||||
char *ticker = (char*)PIC(chainConfig->coinName);
|
||||
|
||||
PRINTF("stark_get_amount_string %.*H\n", 20, contractAddress);
|
||||
|
||||
|
||||
@@ -22,4 +22,4 @@ int stark_sign(uint8_t *signautre, /* out */
|
||||
uint8_t *privateKeyData, FieldElement token1,
|
||||
FieldElement token2, FieldElement msg);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -81,7 +81,7 @@ void pedersen(FieldElement res, /* out */
|
||||
ECPoint hash;
|
||||
|
||||
memcpy(hash, PEDERSEN_SHIFT, sizeof(hash));
|
||||
|
||||
|
||||
accum_ec_mul(&hash, a, 1, 1);
|
||||
accum_ec_mul(&hash, a+1, FIELD_ELEMENT_SIZE-1, 0);
|
||||
accum_ec_mul(&hash, b, 1, 3);
|
||||
@@ -114,7 +114,7 @@ int stark_sign(uint8_t *signature, /* out */
|
||||
}
|
||||
|
||||
// ERC20Token(address)
|
||||
static const uint8_t ERC20_SELECTOR[] = { 0xf4, 0x72, 0x61, 0xb0 };
|
||||
static const uint8_t ERC20_SELECTOR[] = { 0xf4, 0x72, 0x61, 0xb0 };
|
||||
// ETH()
|
||||
static const uint8_t ETH_SELECTOR[] = { 0x83, 0x22, 0xff, 0xf2 };
|
||||
|
||||
@@ -126,11 +126,11 @@ void compute_token_id(cx_sha3_t *sha3, uint8_t *contractAddress, uint8_t *quantu
|
||||
os_memset(tmp, 0, sizeof(tmp));
|
||||
os_memmove(tmp, ERC20_SELECTOR, 4);
|
||||
os_memmove(tmp + 16, contractAddress, 20);
|
||||
cx_hash((cx_hash_t*)sha3, 0, tmp, sizeof(tmp), NULL, 0);
|
||||
cx_hash((cx_hash_t*)sha3, 0, tmp, sizeof(tmp), NULL, 0);
|
||||
}
|
||||
else {
|
||||
PRINTF("compute_token_id for ETH\n");
|
||||
cx_hash((cx_hash_t*)sha3, 0, ETH_SELECTOR, sizeof(ETH_SELECTOR), NULL, 0);
|
||||
cx_hash((cx_hash_t*)sha3, 0, ETH_SELECTOR, sizeof(ETH_SELECTOR), NULL, 0);
|
||||
}
|
||||
PRINTF("compute_token_id quantum %.*H\n", 32, quantum);
|
||||
cx_hash((cx_hash_t*)sha3, CX_LAST, quantum, 32, output, 32);
|
||||
|
||||
@@ -16,9 +16,9 @@ typedef struct check_address_parameters_s {
|
||||
// IN
|
||||
unsigned char* coin_configuration;
|
||||
unsigned char coin_configuration_length;
|
||||
// serialized path, segwit, version prefix, hash used, dictionary etc.
|
||||
// serialized path, segwit, version prefix, hash used, dictionary etc.
|
||||
// fields and serialization format depends on spesific coin app
|
||||
unsigned char* address_parameters;
|
||||
unsigned char* address_parameters;
|
||||
unsigned char address_parameters_length;
|
||||
char *address_to_check;
|
||||
char *extra_id_to_check;
|
||||
@@ -31,7 +31,7 @@ typedef struct get_printable_amount_parameters_s {
|
||||
// IN
|
||||
unsigned char* coin_configuration;
|
||||
unsigned char coin_configuration_length;
|
||||
unsigned char* amount;
|
||||
unsigned char* amount;
|
||||
unsigned char amount_length;
|
||||
bool is_fee;
|
||||
// OUT
|
||||
@@ -41,9 +41,9 @@ typedef struct get_printable_amount_parameters_s {
|
||||
typedef struct create_transaction_parameters_s {
|
||||
unsigned char* coin_configuration;
|
||||
unsigned char coin_configuration_length;
|
||||
unsigned char* amount;
|
||||
unsigned char* amount;
|
||||
unsigned char amount_length;
|
||||
unsigned char* fee_amount;
|
||||
unsigned char* fee_amount;
|
||||
unsigned char fee_amount_length;
|
||||
char *destination_address;
|
||||
char *destination_address_extra_id;
|
||||
|
||||
@@ -23,11 +23,11 @@
|
||||
#define MAX_TICKER_LEN 12 // 10 characters + ' ' + '\0'
|
||||
|
||||
typedef struct tokenDefinition_t {
|
||||
#ifdef HAVE_CONTRACT_NAME_IN_DESCRIPTOR
|
||||
#ifdef HAVE_CONTRACT_NAME_IN_DESCRIPTOR
|
||||
uint8_t contractName[20];
|
||||
#endif
|
||||
#endif
|
||||
uint8_t address[20];
|
||||
uint8_t ticker[MAX_TICKER_LEN];
|
||||
uint8_t ticker[MAX_TICKER_LEN];
|
||||
uint8_t decimals;
|
||||
} tokenDefinition_t;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "shared_context.h"
|
||||
|
||||
|
||||
#include "os_io_seproxyhal.h"
|
||||
|
||||
extern const ux_flow_step_t * const ux_idle_flow [];
|
||||
|
||||
Reference in New Issue
Block a user