summaryrefslogtreecommitdiff
path: root/ext/Digest/SHA/src/hmac.h
blob: 639c46f5b36acb6e4eb7f802b9994c1d63d407da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
 * hmac.h: header file for HMAC-SHA-1/224/256/384/512 routines
 *
 * Ref: FIPS PUB 198 The Keyed-Hash Message Authentication Code
 *
 * Copyright (C) 2003-2005 Mark Shelor, All Rights Reserved
 *
 * Version: 5.32
 * Fri Dec  2 02:32:20 MST 2005
 *
 */

#ifndef _INCLUDE_HMAC_H_
#define _INCLUDE_HMAC_H_

#include "sha.h"

typedef struct {
	SHA *ksha;
	SHA *isha;
	SHA *osha;
	unsigned char key[SHA_MAX_BLOCK_BITS/8];
} HMAC;

#if defined(__STDC__) && __STDC__ != 0
	#define _HMAC_P(protos)	protos
#else
	#define _HMAC_P(protos)	()
#endif

#define _HMAC_STATE	HMAC *h
#define _HMAC_ALG	int alg
#define _HMAC_DATA	unsigned char *bitstr, unsigned long bitcnt
#define _HMAC_KEY	unsigned char *key, unsigned int keylen

HMAC		*hmacopen 	_HMAC_P((_HMAC_ALG, _HMAC_KEY));
unsigned long	 hmacwrite	_HMAC_P((_HMAC_DATA, _HMAC_STATE));
void		 hmacfinish	_HMAC_P((_HMAC_STATE));
unsigned char	*hmacdigest	_HMAC_P((_HMAC_STATE));
char		*hmachex	_HMAC_P((_HMAC_STATE));
char		*hmacbase64	_HMAC_P((_HMAC_STATE));
int		 hmacclose	_HMAC_P((_HMAC_STATE));

unsigned char	*hmac1digest	_HMAC_P((_HMAC_DATA, _HMAC_KEY));
char		*hmac1hex	_HMAC_P((_HMAC_DATA, _HMAC_KEY));
char		*hmac1base64	_HMAC_P((_HMAC_DATA, _HMAC_KEY));
unsigned char	*hmac224digest	_HMAC_P((_HMAC_DATA, _HMAC_KEY));
char		*hmac224hex	_HMAC_P((_HMAC_DATA, _HMAC_KEY));
char		*hmac224base64	_HMAC_P((_HMAC_DATA, _HMAC_KEY));
unsigned char	*hmac256digest	_HMAC_P((_HMAC_DATA, _HMAC_KEY));
char		*hmac256hex	_HMAC_P((_HMAC_DATA, _HMAC_KEY));
char		*hmac256base64	_HMAC_P((_HMAC_DATA, _HMAC_KEY));
unsigned char	*hmac384digest	_HMAC_P((_HMAC_DATA, _HMAC_KEY));
char		*hmac384hex	_HMAC_P((_HMAC_DATA, _HMAC_KEY));
char		*hmac384base64	_HMAC_P((_HMAC_DATA, _HMAC_KEY));
unsigned char	*hmac512digest	_HMAC_P((_HMAC_DATA, _HMAC_KEY));
char		*hmac512hex	_HMAC_P((_HMAC_DATA, _HMAC_KEY));
char		*hmac512base64	_HMAC_P((_HMAC_DATA, _HMAC_KEY));

#endif	/* _INCLUDE_HMAC_H_ */