Refactored some type EIP712 formatting and hashing code to re-use it

This commit is contained in:
Alexandre Paillier
2022-06-29 14:08:08 +02:00
parent 1b00038859
commit 5450f0c46f
6 changed files with 188 additions and 103 deletions

View File

@@ -46,8 +46,7 @@ char *mem_alloc_and_format_uint(uint32_t value, uint8_t *const length)
// +1 for the null character
if ((mem_ptr = mem_alloc(sizeof(char) * (size + 1))))
{
// should be using %u, but not supported by toolchain
snprintf(mem_ptr, (size + 1), "%d", value);
snprintf(mem_ptr, (size + 1), "%u", value);
mem_dealloc(sizeof(char)); // to skip the null character
if (length != NULL)
{