Remove some now useless debug outputs
This commit is contained in:
@@ -26,12 +26,14 @@ const uint8_t *field_hash(const uint8_t *data,
|
|||||||
bool partial)
|
bool partial)
|
||||||
{
|
{
|
||||||
const void *field_ptr;
|
const void *field_ptr;
|
||||||
|
e_type field_type;
|
||||||
|
uint8_t *value = NULL;
|
||||||
|
#ifdef DEBUG
|
||||||
const char *type;
|
const char *type;
|
||||||
uint8_t typelen;
|
uint8_t typelen;
|
||||||
const char *key;
|
const char *key;
|
||||||
uint8_t keylen;
|
uint8_t keylen;
|
||||||
e_type field_type;
|
#endif
|
||||||
uint8_t *value = NULL;
|
|
||||||
|
|
||||||
|
|
||||||
(void)data;
|
(void)data;
|
||||||
@@ -73,13 +75,15 @@ const uint8_t *field_hash(const uint8_t *data,
|
|||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
PRINTF("==> ");
|
#ifdef DEBUG
|
||||||
|
PRINTF("=> ");
|
||||||
type = get_struct_field_typename(field_ptr, &typelen);
|
type = get_struct_field_typename(field_ptr, &typelen);
|
||||||
fwrite(type, sizeof(char), typelen, stdout);
|
fwrite(type, sizeof(char), typelen, stdout);
|
||||||
PRINTF(" ");
|
PRINTF(" ");
|
||||||
key = get_struct_field_keyname(field_ptr, &keylen);
|
key = get_struct_field_keyname(field_ptr, &keylen);
|
||||||
fwrite(key, sizeof(char), keylen, stdout);
|
fwrite(key, sizeof(char), keylen, stdout);
|
||||||
PRINTF("\n");
|
PRINTF("\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!IS_DYN(field_type))
|
if (!IS_DYN(field_type))
|
||||||
{
|
{
|
||||||
@@ -140,7 +144,6 @@ const uint8_t *field_hash(const uint8_t *data,
|
|||||||
0);
|
0);
|
||||||
// deallocate it
|
// deallocate it
|
||||||
mem_dealloc(len);
|
mem_dealloc(len);
|
||||||
PRINTF("FEED %d\n", len);
|
|
||||||
|
|
||||||
path_advance();
|
path_advance();
|
||||||
fh->state = FHS_IDLE;
|
fh->state = FHS_IDLE;
|
||||||
|
|||||||
@@ -120,15 +120,6 @@ static bool path_depth_list_pop(void)
|
|||||||
&shash[0],
|
&shash[0],
|
||||||
KECCAK256_HASH_BYTESIZE);
|
KECCAK256_HASH_BYTESIZE);
|
||||||
mem_dealloc(sizeof(cx_sha3_t)); // remove hash context
|
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)
|
if (path_struct->depth_count > 0)
|
||||||
{
|
{
|
||||||
hash_ctx = mem_alloc(0) - sizeof(cx_sha3_t); // previous one
|
hash_ctx = mem_alloc(0) - sizeof(cx_sha3_t); // previous one
|
||||||
@@ -140,10 +131,17 @@ static bool path_depth_list_pop(void)
|
|||||||
NULL,
|
NULL,
|
||||||
0);
|
0);
|
||||||
}
|
}
|
||||||
|
#ifdef DEBUG
|
||||||
else
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -201,7 +199,6 @@ static bool array_depth_list_pop(void)
|
|||||||
KECCAK256_HASH_BYTESIZE,
|
KECCAK256_HASH_BYTESIZE,
|
||||||
NULL,
|
NULL,
|
||||||
0);
|
0);
|
||||||
PRINTF("AHASH POP\n");
|
|
||||||
|
|
||||||
path_struct->array_depth_count -= 1;
|
path_struct->array_depth_count -= 1;
|
||||||
return true;
|
return true;
|
||||||
@@ -261,7 +258,6 @@ static bool path_update(void)
|
|||||||
0);
|
0);
|
||||||
// deallocate it
|
// deallocate it
|
||||||
mem_dealloc(KECCAK256_HASH_BYTESIZE);
|
mem_dealloc(KECCAK256_HASH_BYTESIZE);
|
||||||
PRINTF("SHASH PUSH w/o deps %p\n", hash_ctx);
|
|
||||||
|
|
||||||
path_depth_list_push();
|
path_depth_list_push();
|
||||||
}
|
}
|
||||||
@@ -310,7 +306,6 @@ bool path_set_root(const char *const struct_name, uint8_t name_length)
|
|||||||
0);
|
0);
|
||||||
// deallocate it
|
// deallocate it
|
||||||
mem_dealloc(KECCAK256_HASH_BYTESIZE);
|
mem_dealloc(KECCAK256_HASH_BYTESIZE);
|
||||||
PRINTF("SHASH PUSH w/ deps %p\n", hash_ctx);
|
|
||||||
//
|
//
|
||||||
|
|
||||||
// init depth, at 0 : empty path
|
// init depth, at 0 : empty path
|
||||||
@@ -420,20 +415,17 @@ bool path_new_array_depth(uint8_t size)
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PRINTF("AHASH PUSH %p", hash_ctx);
|
|
||||||
if (struct_field_type(field_ptr) == TYPE_CUSTOM)
|
if (struct_field_type(field_ptr) == TYPE_CUSTOM)
|
||||||
{
|
{
|
||||||
cx_sha3_t *old_ctx = (void*)hash_ctx - sizeof(cx_sha3_t);
|
cx_sha3_t *old_ctx = (void*)hash_ctx - sizeof(cx_sha3_t);
|
||||||
|
|
||||||
memcpy(hash_ctx, old_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((cx_hash_t*)old_ctx, 256); // init hash
|
||||||
PRINTF(" (switched)");
|
|
||||||
}
|
}
|
||||||
else // solidity type
|
else // solidity type
|
||||||
{
|
{
|
||||||
cx_keccak_init((cx_hash_t*)hash_ctx, 256); // init hash
|
cx_keccak_init((cx_hash_t*)hash_ctx, 256); // init hash
|
||||||
}
|
}
|
||||||
PRINTF("\n");
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -310,14 +310,5 @@ const uint8_t *type_hash(const void *const structs_array,
|
|||||||
0,
|
0,
|
||||||
hash_ptr,
|
hash_ptr,
|
||||||
KECCAK256_HASH_BYTESIZE);
|
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;
|
return hash_ptr;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user