2022-05-02 15:30:14 +02:00
|
|
|
#ifndef FIELD_HASH_H_
|
|
|
|
|
#define FIELD_HASH_H_
|
|
|
|
|
|
2022-05-16 10:59:20 +02:00
|
|
|
#ifdef HAVE_EIP712_FULL_SUPPORT
|
|
|
|
|
|
2022-05-02 15:30:14 +02:00
|
|
|
#include <stdint.h>
|
2022-04-14 18:22:35 +02:00
|
|
|
#include <stdbool.h>
|
2022-05-02 15:30:14 +02:00
|
|
|
|
2022-07-19 11:49:18 +02:00
|
|
|
#define IS_DYN(type) (((type) == TYPE_SOL_STRING) || ((type) == TYPE_SOL_BYTES_DYN))
|
2022-04-14 18:22:35 +02:00
|
|
|
|
2022-07-19 11:49:18 +02:00
|
|
|
typedef enum { FHS_IDLE, FHS_WAITING_FOR_MORE } e_field_hashing_state;
|
2022-04-14 18:22:35 +02:00
|
|
|
|
2022-07-19 11:49:18 +02:00
|
|
|
typedef struct {
|
|
|
|
|
uint16_t remaining_size;
|
|
|
|
|
uint8_t state; // e_field_hashing_state
|
|
|
|
|
} s_field_hashing;
|
2022-04-14 18:22:35 +02:00
|
|
|
|
2022-04-28 16:47:48 +02:00
|
|
|
bool field_hash_init(void);
|
2022-05-12 17:30:26 +02:00
|
|
|
void field_hash_deinit(void);
|
2022-07-19 11:49:18 +02:00
|
|
|
bool field_hash(const uint8_t *data, uint8_t data_length, bool partial);
|
2022-05-16 10:59:20 +02:00
|
|
|
|
2022-07-19 11:49:18 +02:00
|
|
|
#endif // HAVE_EIP712_FULL_SUPPORT
|
2022-05-16 10:59:20 +02:00
|
|
|
|
2022-07-19 11:49:18 +02:00
|
|
|
#endif // FIELD_HASH_H_
|