Now initializes field hash struct in eip712 context
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "mem.h"
|
||||
#include "sol_typenames.h"
|
||||
#include "path.h"
|
||||
#include "field_hash.h"
|
||||
|
||||
uint8_t *typenames_array;
|
||||
uint8_t *structs_array;
|
||||
@@ -29,6 +30,11 @@ bool init_eip712_context(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (field_hash_init() == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// set types pointer
|
||||
if ((structs_array = mem_alloc(sizeof(uint8_t))) == NULL)
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
static s_field_hashing *fh = NULL;
|
||||
|
||||
static bool field_hash_init(void)
|
||||
bool field_hash_init(void)
|
||||
{
|
||||
if (fh == NULL)
|
||||
{
|
||||
@@ -35,7 +35,7 @@ const uint8_t *field_hash(const uint8_t *data,
|
||||
uint8_t *hash_ptr = NULL;
|
||||
|
||||
(void)data;
|
||||
if ((fh == NULL) && (field_hash_init() == false))
|
||||
if (fh == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ typedef struct
|
||||
uint8_t state; // e_field_hashing_state
|
||||
} s_field_hashing;
|
||||
|
||||
bool field_hash_init(void);
|
||||
const uint8_t *field_hash(const uint8_t *data,
|
||||
uint8_t data_length,
|
||||
bool partial);
|
||||
|
||||
Reference in New Issue
Block a user