bglibs: hmac.h Source File

bglibs

hmac.h
1 #ifndef CRYPTO__HMAC__H__
2 #define CRYPTO__HMAC__H__
3
4 typedef void (*hmac_init_fn)(void*);
5 typedef void (*hmac_update_fn)(void*, const unsigned char*, unsigned long);
6 typedef void (*hmac_finalize_fn)(void*, unsigned char*);
7 typedef void (*hmac_extract_fn)(const void*, void*);
8 typedef void (*hmac_inject_fn)(void*, const void*);
9
10 struct hmac_control_block
11 {
12 unsigned state_size;
13 unsigned block_size;
14 unsigned digest_size;
15 unsigned midstate_size;
16 hmac_init_fn init;
17 hmac_update_fn update;
18 hmac_finalize_fn finalize;
19 hmac_extract_fn extract;
20 hmac_inject_fn inject;
21 };
22
23 extern const struct hmac_control_block hmac_md5;
24 extern const struct hmac_control_block hmac_sha1;
25 extern const struct hmac_control_block hmac_sha256;
26 extern const struct hmac_control_block hmac_sha384;
27 extern const struct hmac_control_block hmac_sha512;
28
29 struct str;
30 extern void hmac_prepare(const struct hmac_control_block* hcb,
31 void* midstate,
32 const struct str* secret);
33 extern void hmac_finish(const struct hmac_control_block* hcb,
34 const void* midstate,
35 const struct str* nonce,
36 void* outout);
37 extern void hmac(const struct hmac_control_block* hcb,
38 const struct str* secret,
39 const struct str* nonce,
40 void* output);
41
42 #endif
hmac_control_block
Definition: hmac.h:10
str
Definition: str.h:30