From c689b68f76061b515fcfbdb42f0883e231e0ceae Mon Sep 17 00:00:00 2001 From: Alexandre Paillier Date: Mon, 2 May 2022 17:32:00 +0200 Subject: [PATCH] Remove some now useless debug outputs --- src_features/signMessageEIP712/field_hash.c | 11 ++++++---- src_features/signMessageEIP712/path.c | 24 +++++++-------------- src_features/signMessageEIP712/type_hash.c | 9 -------- 3 files changed, 15 insertions(+), 29 deletions(-) diff --git a/src_features/signMessageEIP712/field_hash.c b/src_features/signMessageEIP712/field_hash.c index 25e7dbf..54f93b6 100644 --- a/src_features/signMessageEIP712/field_hash.c +++ b/src_features/signMessageEIP712/field_hash.c @@ -26,12 +26,14 @@ const uint8_t *field_hash(const uint8_t *data, bool partial) { const void *field_ptr; + e_type field_type; + uint8_t *value = NULL; +#ifdef DEBUG const char *type; uint8_t typelen; const char *key; uint8_t keylen; - e_type field_type; - uint8_t *value = NULL; +#endif (void)data; @@ -73,13 +75,15 @@ const uint8_t *field_hash(const uint8_t *data, { return NULL; } - PRINTF("==> "); +#ifdef DEBUG + PRINTF("=> "); type = get_struct_field_typename(field_ptr, &typelen); fwrite(type, sizeof(char), typelen, stdout); PRINTF(" "); key = get_struct_field_keyname(field_ptr, &keylen); fwrite(key, sizeof(char), keylen, stdout); PRINTF("\n"); +#endif if (!IS_DYN(field_type)) { @@ -140,7 +144,6 @@ const uint8_t *field_hash(const uint8_t *data, 0); // deallocate it mem_dealloc(len); - PRINTF("FEED %d\n", len); path_advance(); fh->state = FHS_IDLE; diff --git a/src_features/signMessageEIP712/path.c b/src_features/signMessageEIP712/path.c index 8da2b9c..54641db 100644 --- a/src_features/signMessageEIP712/path.c +++ b/src_features/signMessageEIP712/path.c @@ -120,15 +120,6 @@ static bool path_depth_list_pop(void) &shash[0], KECCAK256_HASH_BYTESIZE); mem_dealloc(sizeof(cx_sha3_t)); // remove hash context -#ifdef DEBUG - // print computed hash - PRINTF("SHASH POP 0x"); - for (int idx = 0; idx < KECCAK256_HASH_BYTESIZE; ++idx) - { - PRINTF("%.02x", shash[idx]); - } - PRINTF("\n"); -#endif if (path_struct->depth_count > 0) { hash_ctx = mem_alloc(0) - sizeof(cx_sha3_t); // previous one @@ -140,10 +131,17 @@ static bool path_depth_list_pop(void) NULL, 0); } +#ifdef DEBUG else { - PRINTF("\n"); + PRINTF("Hash = 0x"); + for (int idx = 0; idx < KECCAK256_HASH_BYTESIZE; ++idx) + { + PRINTF("%.02x", shash[idx]); + } + PRINTF("\n\n"); } +#endif return true; } @@ -201,7 +199,6 @@ static bool array_depth_list_pop(void) KECCAK256_HASH_BYTESIZE, NULL, 0); - PRINTF("AHASH POP\n"); path_struct->array_depth_count -= 1; return true; @@ -261,7 +258,6 @@ static bool path_update(void) 0); // deallocate it mem_dealloc(KECCAK256_HASH_BYTESIZE); - PRINTF("SHASH PUSH w/o deps %p\n", hash_ctx); path_depth_list_push(); } @@ -310,7 +306,6 @@ bool path_set_root(const char *const struct_name, uint8_t name_length) 0); // deallocate it mem_dealloc(KECCAK256_HASH_BYTESIZE); - PRINTF("SHASH PUSH w/ deps %p\n", hash_ctx); // // init depth, at 0 : empty path @@ -420,20 +415,17 @@ bool path_new_array_depth(uint8_t size) { return false; } - PRINTF("AHASH PUSH %p", hash_ctx); if (struct_field_type(field_ptr) == TYPE_CUSTOM) { 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 - PRINTF(" (switched)"); } else // solidity type { cx_keccak_init((cx_hash_t*)hash_ctx, 256); // init hash } - PRINTF("\n"); return true; } diff --git a/src_features/signMessageEIP712/type_hash.c b/src_features/signMessageEIP712/type_hash.c index 2eeaf01..37708b7 100644 --- a/src_features/signMessageEIP712/type_hash.c +++ b/src_features/signMessageEIP712/type_hash.c @@ -310,14 +310,5 @@ const uint8_t *type_hash(const void *const structs_array, 0, hash_ptr, KECCAK256_HASH_BYTESIZE); -#ifdef DEBUG - // print computed hash - PRINTF("new -> 0x"); - for (int idx = 0; idx < KECCAK256_HASH_BYTESIZE; ++idx) - { - PRINTF("%.02x", hash_ptr[idx]); - } - PRINTF("\n"); -#endif return hash_ptr; }