rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | #ifndef HMAC_H |
| 2 | #define HMAC_H |
| 3 | |
| 4 | typedef struct Hash_param { |
| 5 | void *hash_state; |
| 6 | int (*init)(void *hash_state); |
| 7 | int (*process)(void *hash_state, const unsigned char *in, unsigned int inlen); |
| 8 | int (*done)(void *hash_state, unsigned char *out); |
| 9 | unsigned int hashsize; |
| 10 | unsigned int blocksize; |
| 11 | } hash_param; |
| 12 | |
| 13 | typedef struct Hmac_state { |
| 14 | hash_param *hash; |
| 15 | unsigned char *key; |
| 16 | } hmac_state; |
| 17 | |
| 18 | int hmac_init(hmac_state *hmac, hash_param *hash, const unsigned char *key, |
| 19 | unsigned long keylen); |
| 20 | int hmac_process(hmac_state *hmac, const unsigned char *in, |
| 21 | unsigned long inlen); |
| 22 | int hmac_done(hmac_state *hmac, unsigned char *out, unsigned long *outlen); |
| 23 | |
| 24 | #endif /* HMAC_H */ |