X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=hashfunction_descriptor.h;fp=hashfunction_descriptor.h;h=3440cd0dcec468ed924ec27f09404fa1607a7797;hb=e5a49deb52521f019e37779d6e9d81ec4f02aba4;hp=0000000000000000000000000000000000000000;hpb=e9d58dce0a1eca2c78aec260406e1605ae29fff7;p=avr-crypto-lib.git diff --git a/hashfunction_descriptor.h b/hashfunction_descriptor.h new file mode 100644 index 0000000..3440cd0 --- /dev/null +++ b/hashfunction_descriptor.h @@ -0,0 +1,45 @@ +/* hashfunction_descriptor.h */ + +#ifndef HASHFUNCTION_DESCRIPTOR_H_ +#define HASHFUNCTION_DESCRIPTOR_H_ +#include +#include + +#ifndef VOID_FPT +#define VOID_FPT +typedef void(*void_fpt)(void); +#endif + +typedef void(*hf_init_fpt)(void*); +typedef void(*hf_nextBlock_fpt)(void*, const void*); +typedef void(*hf_lastBlock_fpt)(void*, const void*, uint16_t); +typedef void(*hf_ctx2hash_fpt)(void*, void*); +typedef void(*hf_free_fpt)(void*); +typedef void(*hf_mem_fpt)(void*, void*, uint32_t); + + +#define HFDESC_TYPE_HASHFUNCTION 0x02 + +typedef struct { + uint8_t type; /* 2 == hashfunction */ + uint8_t flags; + PGM_P name; + uint16_t ctxsize_B; + uint16_t blocksize_b; + uint16_t hashsize_b; + + hf_init_fpt init; + hf_nextBlock_fpt nextBlock; + hf_lastBlock_fpt lastBlock; + hf_ctx2hash_fpt ctx2hash; + hf_free_fpt free; + hf_mem_fpt mem; +} hfdesc_t; /* blockcipher descriptor type */ + +typedef struct{ + hfdesc_t* desc_ptr; + void* ctx; +} hfgen_ctx_t; + +#endif /* HASHFUNCTION_DESCRIPTOR_H_ */ +