Import bind 9.5.2 vendor sources.
[dragonfly.git] / contrib / bind-9.5.2 / lib / isc / include / isc / hmacsha.h
blob362b37f81acdf4ac938762be845a325687c66d06
1 /*
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.
24 #ifndef ISC_HMACSHA_H
25 #define ISC_HMACSHA_H 1
27 #include <isc/lang.h>
28 #include <isc/sha1.h>
29 #include <isc/sha2.h>
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
38 typedef struct {
39 isc_sha1_t sha1ctx;
40 unsigned char key[ISC_HMACSHA1_KEYLENGTH];
41 } isc_hmacsha1_t;
43 typedef struct {
44 isc_sha224_t sha224ctx;
45 unsigned char key[ISC_HMACSHA224_KEYLENGTH];
46 } isc_hmacsha224_t;
48 typedef struct {
49 isc_sha256_t sha256ctx;
50 unsigned char key[ISC_HMACSHA256_KEYLENGTH];
51 } isc_hmacsha256_t;
53 typedef struct {
54 isc_sha384_t sha384ctx;
55 unsigned char key[ISC_HMACSHA384_KEYLENGTH];
56 } isc_hmacsha384_t;
58 typedef struct {
59 isc_sha512_t sha512ctx;
60 unsigned char key[ISC_HMACSHA512_KEYLENGTH];
61 } isc_hmacsha512_t;
63 ISC_LANG_BEGINDECLS
65 void
66 isc_hmacsha1_init(isc_hmacsha1_t *ctx, const unsigned char *key,
67 unsigned int len);
69 void
70 isc_hmacsha1_invalidate(isc_hmacsha1_t *ctx);
72 void
73 isc_hmacsha1_update(isc_hmacsha1_t *ctx, const unsigned char *buf,
74 unsigned int len);
76 void
77 isc_hmacsha1_sign(isc_hmacsha1_t *ctx, unsigned char *digest, size_t len);
79 isc_boolean_t
80 isc_hmacsha1_verify(isc_hmacsha1_t *ctx, unsigned char *digest, size_t len);
83 void
84 isc_hmacsha224_init(isc_hmacsha224_t *ctx, const unsigned char *key,
85 unsigned int len);
87 void
88 isc_hmacsha224_invalidate(isc_hmacsha224_t *ctx);
90 void
91 isc_hmacsha224_update(isc_hmacsha224_t *ctx, const unsigned char *buf,
92 unsigned int len);
94 void
95 isc_hmacsha224_sign(isc_hmacsha224_t *ctx, unsigned char *digest, size_t len);
97 isc_boolean_t
98 isc_hmacsha224_verify(isc_hmacsha224_t *ctx, unsigned char *digest, size_t len);
101 void
102 isc_hmacsha256_init(isc_hmacsha256_t *ctx, const unsigned char *key,
103 unsigned int len);
105 void
106 isc_hmacsha256_invalidate(isc_hmacsha256_t *ctx);
108 void
109 isc_hmacsha256_update(isc_hmacsha256_t *ctx, const unsigned char *buf,
110 unsigned int len);
112 void
113 isc_hmacsha256_sign(isc_hmacsha256_t *ctx, unsigned char *digest, size_t len);
115 isc_boolean_t
116 isc_hmacsha256_verify(isc_hmacsha256_t *ctx, unsigned char *digest, size_t len);
119 void
120 isc_hmacsha384_init(isc_hmacsha384_t *ctx, const unsigned char *key,
121 unsigned int len);
123 void
124 isc_hmacsha384_invalidate(isc_hmacsha384_t *ctx);
126 void
127 isc_hmacsha384_update(isc_hmacsha384_t *ctx, const unsigned char *buf,
128 unsigned int len);
130 void
131 isc_hmacsha384_sign(isc_hmacsha384_t *ctx, unsigned char *digest, size_t len);
133 isc_boolean_t
134 isc_hmacsha384_verify(isc_hmacsha384_t *ctx, unsigned char *digest, size_t len);
137 void
138 isc_hmacsha512_init(isc_hmacsha512_t *ctx, const unsigned char *key,
139 unsigned int len);
141 void
142 isc_hmacsha512_invalidate(isc_hmacsha512_t *ctx);
144 void
145 isc_hmacsha512_update(isc_hmacsha512_t *ctx, const unsigned char *buf,
146 unsigned int len);
148 void
149 isc_hmacsha512_sign(isc_hmacsha512_t *ctx, unsigned char *digest, size_t len);
151 isc_boolean_t
152 isc_hmacsha512_verify(isc_hmacsha512_t *ctx, unsigned char *digest, size_t len);
154 ISC_LANG_ENDDECLS
156 #endif /* ISC_HMACSHA_H */