2
* Copyright (C) 2005-2007 Internet Systems Consortium, Inc. ("ISC")
4
* Permission to use, copy, modify, and/or distribute this software for any
5
* purpose with or without fee is hereby granted, provided that the above
6
* copyright notice and this permission notice appear in all copies.
8
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
9
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
11
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
13
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
* PERFORMANCE OF THIS SOFTWARE.
17
/* $Id: hmacsha.h,v 1.7 2007/06/19 23:47:18 tbox Exp $ */
19
/*! \file isc/hmacsha.h
20
* This is the header file for the HMAC-SHA1, HMAC-SHA224, HMAC-SHA256,
21
* HMAC-SHA334 and HMAC-SHA512 hash algorithm described in RFC 2104.
25
#define ISC_HMACSHA_H 1
30
#include <isc/types.h>
32
#define ISC_HMACSHA1_KEYLENGTH ISC_SHA1_BLOCK_LENGTH
33
#define ISC_HMACSHA224_KEYLENGTH ISC_SHA224_BLOCK_LENGTH
34
#define ISC_HMACSHA256_KEYLENGTH ISC_SHA256_BLOCK_LENGTH
35
#define ISC_HMACSHA384_KEYLENGTH ISC_SHA384_BLOCK_LENGTH
36
#define ISC_HMACSHA512_KEYLENGTH ISC_SHA512_BLOCK_LENGTH
40
unsigned char key[ISC_HMACSHA1_KEYLENGTH];
44
isc_sha224_t sha224ctx;
45
unsigned char key[ISC_HMACSHA224_KEYLENGTH];
49
isc_sha256_t sha256ctx;
50
unsigned char key[ISC_HMACSHA256_KEYLENGTH];
54
isc_sha384_t sha384ctx;
55
unsigned char key[ISC_HMACSHA384_KEYLENGTH];
59
isc_sha512_t sha512ctx;
60
unsigned char key[ISC_HMACSHA512_KEYLENGTH];
66
isc_hmacsha1_init(isc_hmacsha1_t *ctx, const unsigned char *key,
70
isc_hmacsha1_invalidate(isc_hmacsha1_t *ctx);
73
isc_hmacsha1_update(isc_hmacsha1_t *ctx, const unsigned char *buf,
77
isc_hmacsha1_sign(isc_hmacsha1_t *ctx, unsigned char *digest, size_t len);
80
isc_hmacsha1_verify(isc_hmacsha1_t *ctx, unsigned char *digest, size_t len);
84
isc_hmacsha224_init(isc_hmacsha224_t *ctx, const unsigned char *key,
88
isc_hmacsha224_invalidate(isc_hmacsha224_t *ctx);
91
isc_hmacsha224_update(isc_hmacsha224_t *ctx, const unsigned char *buf,
95
isc_hmacsha224_sign(isc_hmacsha224_t *ctx, unsigned char *digest, size_t len);
98
isc_hmacsha224_verify(isc_hmacsha224_t *ctx, unsigned char *digest, size_t len);
102
isc_hmacsha256_init(isc_hmacsha256_t *ctx, const unsigned char *key,
106
isc_hmacsha256_invalidate(isc_hmacsha256_t *ctx);
109
isc_hmacsha256_update(isc_hmacsha256_t *ctx, const unsigned char *buf,
113
isc_hmacsha256_sign(isc_hmacsha256_t *ctx, unsigned char *digest, size_t len);
116
isc_hmacsha256_verify(isc_hmacsha256_t *ctx, unsigned char *digest, size_t len);
120
isc_hmacsha384_init(isc_hmacsha384_t *ctx, const unsigned char *key,
124
isc_hmacsha384_invalidate(isc_hmacsha384_t *ctx);
127
isc_hmacsha384_update(isc_hmacsha384_t *ctx, const unsigned char *buf,
131
isc_hmacsha384_sign(isc_hmacsha384_t *ctx, unsigned char *digest, size_t len);
134
isc_hmacsha384_verify(isc_hmacsha384_t *ctx, unsigned char *digest, size_t len);
138
isc_hmacsha512_init(isc_hmacsha512_t *ctx, const unsigned char *key,
142
isc_hmacsha512_invalidate(isc_hmacsha512_t *ctx);
145
isc_hmacsha512_update(isc_hmacsha512_t *ctx, const unsigned char *buf,
149
isc_hmacsha512_sign(isc_hmacsha512_t *ctx, unsigned char *digest, size_t len);
152
isc_hmacsha512_verify(isc_hmacsha512_t *ctx, unsigned char *digest, size_t len);
156
#endif /* ISC_HMACSHA_H */