Commit | Line | Data |
05128928 |
1 | /* |
2 | * hmac.h: header file for HMAC-SHA-1/224/256/384/512 routines |
3 | * |
4 | * Ref: FIPS PUB 198 The Keyed-Hash Message Authentication Code |
5 | * |
4eb6bdb8 |
6 | * Copyright (C) 2003-2008 Mark Shelor, All Rights Reserved |
05128928 |
7 | * |
4eb6bdb8 |
8 | * Version: 5.47 |
9 | * Wed Apr 30 04:00:54 MST 2008 |
05128928 |
10 | * |
11 | */ |
12 | |
13 | #ifndef _INCLUDE_HMAC_H_ |
14 | #define _INCLUDE_HMAC_H_ |
15 | |
16 | #include "sha.h" |
17 | |
18 | typedef struct { |
19 | SHA *ksha; |
20 | SHA *isha; |
21 | SHA *osha; |
22 | unsigned char key[SHA_MAX_BLOCK_BITS/8]; |
23 | } HMAC; |
24 | |
05128928 |
25 | #define _HMAC_STATE HMAC *h |
26 | #define _HMAC_ALG int alg |
27 | #define _HMAC_DATA unsigned char *bitstr, unsigned long bitcnt |
28 | #define _HMAC_KEY unsigned char *key, unsigned int keylen |
29 | |
44e8b72c |
30 | HMAC *hmacopen (_HMAC_ALG, _HMAC_KEY); |
31 | unsigned long hmacwrite (_HMAC_DATA, _HMAC_STATE); |
32 | void hmacfinish (_HMAC_STATE); |
33 | unsigned char *hmacdigest (_HMAC_STATE); |
34 | char *hmachex (_HMAC_STATE); |
35 | char *hmacbase64 (_HMAC_STATE); |
36 | int hmacclose (_HMAC_STATE); |
37 | |
38 | #ifndef SHA_PERL_MODULE |
39 | |
40 | unsigned char *hmac1digest (_HMAC_DATA, _HMAC_KEY); |
41 | char *hmac1hex (_HMAC_DATA, _HMAC_KEY); |
42 | char *hmac1base64 (_HMAC_DATA, _HMAC_KEY); |
43 | unsigned char *hmac224digest (_HMAC_DATA, _HMAC_KEY); |
44 | char *hmac224hex (_HMAC_DATA, _HMAC_KEY); |
45 | char *hmac224base64 (_HMAC_DATA, _HMAC_KEY); |
46 | unsigned char *hmac256digest (_HMAC_DATA, _HMAC_KEY); |
47 | char *hmac256hex (_HMAC_DATA, _HMAC_KEY); |
48 | char *hmac256base64 (_HMAC_DATA, _HMAC_KEY); |
49 | unsigned char *hmac384digest (_HMAC_DATA, _HMAC_KEY); |
50 | char *hmac384hex (_HMAC_DATA, _HMAC_KEY); |
51 | char *hmac384base64 (_HMAC_DATA, _HMAC_KEY); |
52 | unsigned char *hmac512digest (_HMAC_DATA, _HMAC_KEY); |
53 | char *hmac512hex (_HMAC_DATA, _HMAC_KEY); |
54 | char *hmac512base64 (_HMAC_DATA, _HMAC_KEY); |
55 | |
56 | #endif |
05128928 |
57 | |
58 | #endif /* _INCLUDE_HMAC_H_ */ |