Remove building with NOCRYPTO option
[minix.git] / external / bsd / bind / dist / lib / dns / dst_parse.h
blobf70b54532e0b3810532f8237b0038d6cb2bb3718
1 /* $NetBSD: dst_parse.h,v 1.6 2014/12/10 04:37:58 christos Exp $ */
3 /*
4 * Portions Copyright (C) 2004-2010, 2012, 2014 Internet Systems Consortium, Inc. ("ISC")
5 * Portions Copyright (C) 2000-2002 Internet Software Consortium.
7 * Permission to use, copy, modify, and/or distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
11 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NETWORK ASSOCIATES DISCLAIMS
12 * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
13 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE
14 * FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
17 * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 * Portions Copyright (C) 1995-2000 by Network Associates, Inc.
21 * Permission to use, copy, modify, and/or distribute this software for any
22 * purpose with or without fee is hereby granted, provided that the above
23 * copyright notice and this permission notice appear in all copies.
25 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NETWORK ASSOCIATES DISCLAIMS
26 * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
27 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE
28 * FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
29 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
30 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
31 * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
34 /* Id: dst_parse.h,v 1.17 2010/12/23 23:47:08 tbox Exp */
36 /*! \file */
37 #ifndef DST_DST_PARSE_H
38 #define DST_DST_PARSE_H 1
40 #include <isc/lang.h>
42 #include <dst/dst.h>
44 #define MAXFIELDSIZE 512
47 * Maximum number of fields in a private file is 18 (12 algorithm-
48 * specific fields for RSA, plus 6 generic fields).
50 #define MAXFIELDS 12+6
52 #define TAG_SHIFT 4
53 #define TAG_ALG(tag) ((unsigned int)(tag) >> TAG_SHIFT)
54 #define TAG(alg, off) (((alg) << TAG_SHIFT) + (off))
56 /* These are used by both RSA-MD5 and RSA-SHA1 */
57 #define RSA_NTAGS 11
58 #define TAG_RSA_MODULUS ((DST_ALG_RSAMD5 << TAG_SHIFT) + 0)
59 #define TAG_RSA_PUBLICEXPONENT ((DST_ALG_RSAMD5 << TAG_SHIFT) + 1)
60 #define TAG_RSA_PRIVATEEXPONENT ((DST_ALG_RSAMD5 << TAG_SHIFT) + 2)
61 #define TAG_RSA_PRIME1 ((DST_ALG_RSAMD5 << TAG_SHIFT) + 3)
62 #define TAG_RSA_PRIME2 ((DST_ALG_RSAMD5 << TAG_SHIFT) + 4)
63 #define TAG_RSA_EXPONENT1 ((DST_ALG_RSAMD5 << TAG_SHIFT) + 5)
64 #define TAG_RSA_EXPONENT2 ((DST_ALG_RSAMD5 << TAG_SHIFT) + 6)
65 #define TAG_RSA_COEFFICIENT ((DST_ALG_RSAMD5 << TAG_SHIFT) + 7)
66 #define TAG_RSA_ENGINE ((DST_ALG_RSAMD5 << TAG_SHIFT) + 8)
67 #define TAG_RSA_LABEL ((DST_ALG_RSAMD5 << TAG_SHIFT) + 9)
69 #define DH_NTAGS 4
70 #define TAG_DH_PRIME ((DST_ALG_DH << TAG_SHIFT) + 0)
71 #define TAG_DH_GENERATOR ((DST_ALG_DH << TAG_SHIFT) + 1)
72 #define TAG_DH_PRIVATE ((DST_ALG_DH << TAG_SHIFT) + 2)
73 #define TAG_DH_PUBLIC ((DST_ALG_DH << TAG_SHIFT) + 3)
75 #define DSA_NTAGS 5
76 #define TAG_DSA_PRIME ((DST_ALG_DSA << TAG_SHIFT) + 0)
77 #define TAG_DSA_SUBPRIME ((DST_ALG_DSA << TAG_SHIFT) + 1)
78 #define TAG_DSA_BASE ((DST_ALG_DSA << TAG_SHIFT) + 2)
79 #define TAG_DSA_PRIVATE ((DST_ALG_DSA << TAG_SHIFT) + 3)
80 #define TAG_DSA_PUBLIC ((DST_ALG_DSA << TAG_SHIFT) + 4)
82 #define GOST_NTAGS 1
83 #define TAG_GOST_PRIVASN1 ((DST_ALG_ECCGOST << TAG_SHIFT) + 0)
84 #define TAG_GOST_PRIVRAW ((DST_ALG_ECCGOST << TAG_SHIFT) + 1)
86 #define ECDSA_NTAGS 4
87 #define TAG_ECDSA_PRIVATEKEY ((DST_ALG_ECDSA256 << TAG_SHIFT) + 0)
88 #define TAG_ECDSA_ENGINE ((DST_ALG_ECDSA256 << TAG_SHIFT) + 1)
89 #define TAG_ECDSA_LABEL ((DST_ALG_ECDSA256 << TAG_SHIFT) + 2)
91 #define OLD_HMACMD5_NTAGS 1
92 #define HMACMD5_NTAGS 2
93 #define TAG_HMACMD5_KEY ((DST_ALG_HMACMD5 << TAG_SHIFT) + 0)
94 #define TAG_HMACMD5_BITS ((DST_ALG_HMACMD5 << TAG_SHIFT) + 1)
96 #define HMACSHA1_NTAGS 2
97 #define TAG_HMACSHA1_KEY ((DST_ALG_HMACSHA1 << TAG_SHIFT) + 0)
98 #define TAG_HMACSHA1_BITS ((DST_ALG_HMACSHA1 << TAG_SHIFT) + 1)
100 #define HMACSHA224_NTAGS 2
101 #define TAG_HMACSHA224_KEY ((DST_ALG_HMACSHA224 << TAG_SHIFT) + 0)
102 #define TAG_HMACSHA224_BITS ((DST_ALG_HMACSHA224 << TAG_SHIFT) + 1)
104 #define HMACSHA256_NTAGS 2
105 #define TAG_HMACSHA256_KEY ((DST_ALG_HMACSHA256 << TAG_SHIFT) + 0)
106 #define TAG_HMACSHA256_BITS ((DST_ALG_HMACSHA256 << TAG_SHIFT) + 1)
108 #define HMACSHA384_NTAGS 2
109 #define TAG_HMACSHA384_KEY ((DST_ALG_HMACSHA384 << TAG_SHIFT) + 0)
110 #define TAG_HMACSHA384_BITS ((DST_ALG_HMACSHA384 << TAG_SHIFT) + 1)
112 #define HMACSHA512_NTAGS 2
113 #define TAG_HMACSHA512_KEY ((DST_ALG_HMACSHA512 << TAG_SHIFT) + 0)
114 #define TAG_HMACSHA512_BITS ((DST_ALG_HMACSHA512 << TAG_SHIFT) + 1)
116 struct dst_private_element {
117 unsigned short tag;
118 unsigned short length;
119 unsigned char *data;
122 typedef struct dst_private_element dst_private_element_t;
124 struct dst_private {
125 unsigned short nelements;
126 dst_private_element_t elements[MAXFIELDS];
129 typedef struct dst_private dst_private_t;
131 ISC_LANG_BEGINDECLS
133 void
134 dst__privstruct_free(dst_private_t *priv, isc_mem_t *mctx);
136 isc_result_t
137 dst__privstruct_parse(dst_key_t *key, unsigned int alg, isc_lex_t *lex,
138 isc_mem_t *mctx, dst_private_t *priv);
140 isc_result_t
141 dst__privstruct_writefile(const dst_key_t *key, const dst_private_t *priv,
142 const char *directory);
144 ISC_LANG_ENDDECLS
146 #endif /* DST_DST_PARSE_H */