Fixed compilation errors/warnings

This commit is contained in:
Alexandre Paillier
2022-05-02 18:28:02 +02:00
parent c689b68f76
commit d333b3a433
5 changed files with 8 additions and 9 deletions

View File

@@ -34,9 +34,6 @@ typedef enum
ARRAY_FIXED_SIZE
} e_array_type;
#define MIN(a,b) ((a > b) ? b : a)
#define MAX(a,b) ((a > b) ? a : b)
// APDUs INS
#define INS_STRUCT_DEF 0x18
#define INS_STRUCT_IMPL 0x1A

View File

@@ -407,6 +407,7 @@ bool handle_apdu(const uint8_t *const data)
return true;
}
#if 0
int main(void)
{
uint8_t buf[260]; // 4 bytes APDU header + 256 bytes payload
@@ -453,3 +454,4 @@ int main(void)
#endif
return EXIT_SUCCESS;
}
#endif

View File

@@ -55,7 +55,7 @@ const uint8_t *field_hash(const uint8_t *data,
fh->state = FHS_WAITING_FOR_MORE;
if (IS_DYN(field_type))
{
cx_keccak_init((cx_hash_t*)&global_sha3, 256); // init hash
cx_keccak_init(&global_sha3, 256); // init hash
}
}
fh->remaining_size -= data_length;

View File

@@ -243,7 +243,7 @@ static bool path_update(void)
{
return false;
}
cx_keccak_init((cx_hash_t*)hash_ctx, 256); // initialize it
cx_keccak_init(hash_ctx, 256); // initialize it
// get the struct typehash
if ((thash_ptr = type_hash(structs_array, typename, typename_len)) == NULL)
{
@@ -292,7 +292,7 @@ bool path_set_root(const char *const struct_name, uint8_t name_length)
{
return false;
}
cx_keccak_init((cx_hash_t*)hash_ctx, 256); // init hash
cx_keccak_init(hash_ctx, 256); // init hash
if ((thash_ptr = type_hash(structs_array, struct_name, name_length)) == NULL)
{
return false;
@@ -420,11 +420,11 @@ bool path_new_array_depth(uint8_t size)
cx_sha3_t *old_ctx = (void*)hash_ctx - sizeof(cx_sha3_t);
memcpy(hash_ctx, old_ctx, sizeof(cx_sha3_t));
cx_keccak_init((cx_hash_t*)old_ctx, 256); // init hash
cx_keccak_init(old_ctx, 256); // init hash
}
else // solidity type
{
cx_keccak_init((cx_hash_t*)hash_ctx, 256); // init hash
cx_keccak_init(hash_ctx, 256); // init hash
}
return true;

View File

@@ -276,7 +276,7 @@ const uint8_t *type_hash(const void *const structs_array,
void **deps;
uint8_t *hash_ptr;
cx_keccak_init((cx_hash_t*)&global_sha3, 256); // init hash
cx_keccak_init(&global_sha3, 256); // init hash
// get list of structs (own + dependencies), properly ordered
deps = mem_alloc(0); // get where the first elem will be
if (get_struct_dependencies(structs_array, &deps_count, deps, struct_ptr) == false)