Remove some now useless debug outputs

This commit is contained in:
Alexandre Paillier
2022-05-02 17:32:00 +02:00
parent ad030cdb6a
commit c689b68f76
3 changed files with 15 additions and 29 deletions

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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;
}