]> git.cryptolib.org Git - avr-crypto-lib.git/blob - hashfunction_descriptor.h
updated sha1
[avr-crypto-lib.git] / hashfunction_descriptor.h
1 /* hashfunction_descriptor.h */
2
3 #ifndef HASHFUNCTION_DESCRIPTOR_H_
4 #define HASHFUNCTION_DESCRIPTOR_H_
5 #include <stdint.h>
6 #include <avr/pgmspace.h>
7
8 #ifndef VOID_FPT
9 #define VOID_FPT
10 typedef void(*void_fpt)(void);
11 #endif
12
13 typedef void(*hf_init_fpt)(void*);
14 typedef void(*hf_nextBlock_fpt)(void*, const void*);
15 typedef void(*hf_lastBlock_fpt)(void*, const void*, uint16_t);
16 typedef void(*hf_ctx2hash_fpt)(void*, void*);
17 typedef void(*hf_free_fpt)(void*);
18 typedef void(*hf_mem_fpt)(void*, const void*, uint32_t);
19
20
21 #define HFDESC_TYPE_HASHFUNCTION 0x02
22
23 typedef struct {
24         uint8_t  type; /* 2 == hashfunction */
25         uint8_t  flags;
26         PGM_P    name;
27         uint16_t ctxsize_B;
28         uint16_t blocksize_b;
29         uint16_t hashsize_b;
30         
31         hf_init_fpt init;
32         hf_nextBlock_fpt  nextBlock;
33         hf_lastBlock_fpt  lastBlock;
34         hf_ctx2hash_fpt   ctx2hash;
35         hf_free_fpt free;
36         hf_mem_fpt mem;
37 } hfdesc_t; /* blockcipher descriptor type */
38
39 typedef struct{
40         hfdesc_t* desc_ptr;
41         void*     ctx;
42 } hfgen_ctx_t;
43
44 #endif /* HASHFUNCTION_DESCRIPTOR_H_ */
45