From d333b3a43342f7ff666a787b38cc33df97806c9c Mon Sep 17 00:00:00 2001 From: Alexandre Paillier Date: Mon, 2 May 2022 18:28:02 +0200 Subject: [PATCH] Fixed compilation errors/warnings --- src_features/signMessageEIP712/eip712.h | 3 --- src_features/signMessageEIP712/entrypoint.c | 2 ++ src_features/signMessageEIP712/field_hash.c | 2 +- src_features/signMessageEIP712/path.c | 8 ++++---- src_features/signMessageEIP712/type_hash.c | 2 +- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src_features/signMessageEIP712/eip712.h b/src_features/signMessageEIP712/eip712.h index 7b17f8f..7846841 100644 --- a/src_features/signMessageEIP712/eip712.h +++ b/src_features/signMessageEIP712/eip712.h @@ -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 diff --git a/src_features/signMessageEIP712/entrypoint.c b/src_features/signMessageEIP712/entrypoint.c index 1fddbee..6cb7504 100644 --- a/src_features/signMessageEIP712/entrypoint.c +++ b/src_features/signMessageEIP712/entrypoint.c @@ -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 diff --git a/src_features/signMessageEIP712/field_hash.c b/src_features/signMessageEIP712/field_hash.c index 54f93b6..6221631 100644 --- a/src_features/signMessageEIP712/field_hash.c +++ b/src_features/signMessageEIP712/field_hash.c @@ -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; diff --git a/src_features/signMessageEIP712/path.c b/src_features/signMessageEIP712/path.c index 54641db..fd8c54e 100644 --- a/src_features/signMessageEIP712/path.c +++ b/src_features/signMessageEIP712/path.c @@ -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; diff --git a/src_features/signMessageEIP712/type_hash.c b/src_features/signMessageEIP712/type_hash.c index 37708b7..8c1b0b4 100644 --- a/src_features/signMessageEIP712/type_hash.c +++ b/src_features/signMessageEIP712/type_hash.c @@ -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)