Better macro naming for hash length

This commit is contained in:
Alexandre Paillier
2022-03-31 17:11:46 +02:00
parent c53a4299a3
commit 223aa10a58
2 changed files with 4 additions and 4 deletions

View File

@@ -57,7 +57,7 @@ typedef enum
#define TYPESIZE_MASK (1 << 6)
#define TYPENAME_ENUM (0xF)
#define KECCAK256_HASH_LENGTH 32
#define KECCAK256_HASH_BYTESIZE 32
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))

View File

@@ -38,7 +38,7 @@ const uint8_t *type_hash(const void *const structs_array,
mem_dealloc(mem_alloc(0) - mem_loc_bak);
// copy hash into memory
if ((hash_ptr = mem_alloc(KECCAK256_HASH_LENGTH)) == NULL)
if ((hash_ptr = mem_alloc(KECCAK256_HASH_BYTESIZE)) == NULL)
{
return NULL;
}
@@ -47,11 +47,11 @@ const uint8_t *type_hash(const void *const structs_array,
NULL,
0,
hash_ptr,
KECCAK256_HASH_LENGTH);
KECCAK256_HASH_BYTESIZE);
#ifdef DEBUG
// print computed hash
printf("-> 0x");
for (int idx = 0; idx < KECCAK256_HASH_LENGTH; ++idx)
for (int idx = 0; idx < KECCAK256_HASH_BYTESIZE; ++idx)
{
printf("%.02x", hash_ptr[idx]);
}