Apply clang-format

This commit is contained in:
pscott
2021-03-25 10:43:59 +01:00
parent 9a798e3662
commit 013538e9fe
5 changed files with 29 additions and 14 deletions

View File

@@ -64,13 +64,13 @@ int eth_plugin_perform_init(uint8_t *contractAddress, ethPluginInitContract_t *i
PRINTF("Selector %.*H\n", 4, init->selector);
for (i = 0;; i++) {
uint8_t j;
selectors = (const uint8_t **)PIC(INTERNAL_ETH_PLUGINS[i].selectors);
selectors = (const uint8_t **) PIC(INTERNAL_ETH_PLUGINS[i].selectors);
if (selectors == NULL) {
break;
}
for (j = 0; ((j < INTERNAL_ETH_PLUGINS[i].num_selectors) && (contractAddress != NULL));
j++) {
if (memcmp(init->selector, (const void *)PIC(selectors[j]), SELECTOR_SIZE) == 0) {
if (memcmp(init->selector, (const void *) PIC(selectors[j]), SELECTOR_SIZE) == 0) {
if ((INTERNAL_ETH_PLUGINS[i].availableCheck == NULL) ||
((PluginAvailableCheck) PIC(INTERNAL_ETH_PLUGINS[i].availableCheck))()) {
strcpy(dataContext.tokenContext.pluginName, INTERNAL_ETH_PLUGINS[i].alias);

View File

@@ -92,28 +92,32 @@ const uint8_t* const STARKWARE_SELECTORS[NUM_STARKWARE_SELECTORS] = {
const internalEthPlugin_t const INTERNAL_ETH_PLUGINS[] = {
{erc20_plugin_available_check,
(const uint8_t **)ERC20_SELECTORS,
(const uint8_t**) ERC20_SELECTORS,
NUM_ERC20_SELECTORS,
"-erc20",
erc20_plugin_call},
{erc721_plugin_available_check,
(const uint8_t **)ERC721_SELECTORS,
(const uint8_t**) ERC721_SELECTORS,
NUM_ERC721_SELECTORS,
"-er721",
erc721_plugin_call},
{NULL, (const uint8_t **)COMPOUND_SELECTORS, NUM_COMPOUND_SELECTORS, "-cmpd", compound_plugin_call},
{NULL,
(const uint8_t**) COMPOUND_SELECTORS,
NUM_COMPOUND_SELECTORS,
"-cmpd",
compound_plugin_call},
#ifdef HAVE_ETH2
{NULL, (const uint8_t **)ETH2_SELECTORS, NUM_ETH2_SELECTORS, "-eth2", eth2_plugin_call},
{NULL, (const uint8_t**) ETH2_SELECTORS, NUM_ETH2_SELECTORS, "-eth2", eth2_plugin_call},
#endif
#ifdef HAVE_STARKWARE
{NULL, (const uint8_t **)STARKWARE_SELECTORS, 10, "-strk", starkware_plugin_call},
{NULL, (const uint8_t**) STARKWARE_SELECTORS, 10, "-strk", starkware_plugin_call},
#endif

View File

@@ -56,8 +56,8 @@ bool quantumSet;
#endif
#ifdef HAVE_ETH2
uint32_t eth2WithdrawalIndex;
#include "withdrawal_index.h"
uint32_t eth2WithdrawalIndex;
#include "withdrawal_index.h"
#endif
#include "ux.h"

View File

@@ -23,8 +23,11 @@ void getEth2PublicKey(uint32_t *bip32Path, uint8_t bip32PathLength, uint8_t *out
io_seproxyhal_io_heartbeat();
memset(tmp, 0, 48);
memmove(tmp + 16, privateKeyData, 32);
cx_ecfp_init_private_key(CX_CURVE_BLS12_381_G1, tmp, 48, (cx_ecfp_private_key_t *)&privateKey);
cx_ecfp_generate_pair(CX_CURVE_BLS12_381_G1, (cx_ecfp_public_key_t *)&publicKey, (cx_ecfp_private_key_t *)&privateKey, 1);
cx_ecfp_init_private_key(CX_CURVE_BLS12_381_G1, tmp, 48, (cx_ecfp_private_key_t *) &privateKey);
cx_ecfp_generate_pair(CX_CURVE_BLS12_381_G1,
(cx_ecfp_public_key_t *) &publicKey,
(cx_ecfp_private_key_t *) &privateKey,
1);
explicit_bzero(tmp, 96);
explicit_bzero((void *) &privateKey, sizeof(cx_ecfp_256_extended_private_key_t));
tmp[47] = 2;

View File

@@ -232,7 +232,10 @@ void starkware_print_stark_key(uint8_t *starkKey, char *destination) {
void starkware_print_eth_address(uint8_t *address, char *destination) {
destination[0] = '0';
destination[1] = 'x';
getEthAddressStringFromBinary(address, (uint8_t *)(destination + 2), &global_sha3, chainConfig);
getEthAddressStringFromBinary(address,
(uint8_t *) (destination + 2),
&global_sha3,
chainConfig);
destination[42] = '\0';
}
@@ -314,7 +317,10 @@ void starkware_get_source_address(char *destination) {
io_seproxyhal_io_heartbeat();
destination[0] = '0';
destination[1] = 'x';
getEthAddressStringFromKey(&publicKey, (uint8_t *)(destination + 2), &global_sha3, chainConfig);
getEthAddressStringFromKey(&publicKey,
(uint8_t *) (destination + 2),
&global_sha3,
chainConfig);
destination[42] = '\0';
}
@@ -326,7 +332,9 @@ void starkware_plugin_call(int message, void *parameters) {
starkware_parameters_t *context = (starkware_parameters_t *) msg->pluginContext;
PRINTF("starkware plugin init\n");
for (i = 0; i < NUM_STARKWARE_SELECTORS; i++) {
if (memcmp((const void *)PIC(STARKWARE_SELECTORS[i]), msg->selector, SELECTOR_SIZE) == 0) {
if (memcmp((const void *) PIC(STARKWARE_SELECTORS[i]),
msg->selector,
SELECTOR_SIZE) == 0) {
context->selectorIndex = i;
break;
}