]>
Commit | Line | Data |
---|---|---|
ac2f15b3 | 1 | /* $KAME: crypto_openssl.h,v 1.25 2002/04/25 09:48:32 sakane Exp $ */ |
7ba0088d A |
2 | |
3 | /* | |
4 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | |
5 | * All rights reserved. | |
6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | |
15 | * 3. Neither the name of the project nor the names of its contributors | |
16 | * may be used to endorse or promote products derived from this software | |
17 | * without specific prior written permission. | |
18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND | |
20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE | |
23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
29 | * SUCH DAMAGE. | |
30 | */ | |
2b484d24 A |
31 | |
32 | #ifndef __CRYPTO_OPENSSL_H__ | |
33 | #define __CRYPTO_OPENSSL_H__ | |
7ba0088d | 34 | |
7902cf7e A |
35 | #ifdef HAVE_OPENSSL_EVP_H |
36 | #include <openssl/evp.h> | |
37 | #endif | |
38 | ||
7ba0088d A |
39 | #ifdef HAVE_SIGNING_C |
40 | /* X509 Certificate */ | |
2b484d24 A |
41 | #include <openssl/x509v3.h> |
42 | ||
43 | #define GENT_OTHERNAME GEN_OTHERNAME | |
44 | #define GENT_EMAIL GEN_EMAIL | |
45 | #define GENT_DNS GEN_DNS | |
46 | #define GENT_X400 GEN_X400 | |
47 | #define GENT_DIRNAME GEN_DIRNAME | |
48 | #define GENT_EDIPARTY GEN_EDIPARTY | |
49 | #define GENT_URI GEN_URI | |
50 | #define GENT_IPADD GEN_IPADD | |
51 | #define GENT_RID GEN_RID | |
52 | ||
7ba0088d A |
53 | |
54 | extern vchar_t *eay_str2asn1dn __P((char *, int)); | |
55 | extern int eay_cmp_asn1dn __P((vchar_t *, vchar_t *)); | |
2b484d24 | 56 | extern int eay_check_x509cert __P((vchar_t *, char *, int)); |
7ba0088d | 57 | extern vchar_t *eay_get_x509asn1subjectname __P((vchar_t *)); |
2b484d24 A |
58 | extern vchar_t *eay_get_x509_common_name __P((vchar_t *)); |
59 | extern int eay_get_x509subjectaltname __P((vchar_t *, char **, int *, int, int *)); | |
7ba0088d A |
60 | extern char *eay_get_x509text __P((vchar_t *)); |
61 | extern vchar_t *eay_get_x509cert __P((char *)); | |
62 | extern vchar_t *eay_get_x509sign __P((vchar_t *, vchar_t *, vchar_t *)); | |
63 | extern int eay_check_x509sign __P((vchar_t *, vchar_t *, vchar_t *)); | |
64 | extern int eay_check_pkcs7sign __P((vchar_t *, vchar_t *, vchar_t *)); | |
65 | ||
66 | /* RSA */ | |
67 | extern vchar_t *eay_rsa_sign __P((vchar_t *, vchar_t *)); | |
7902cf7e | 68 | extern int eay_rsa_verify __P((vchar_t *, vchar_t *, EVP_PKEY *)); |
7ba0088d A |
69 | |
70 | /* ASN.1 */ | |
71 | extern vchar_t *eay_get_pkcs1privkey __P((char *)); | |
72 | extern vchar_t *eay_get_pkcs1pubkey __P((char *)); | |
73 | #endif | |
74 | ||
75 | /* string error */ | |
76 | extern char *eay_strerror __P((void)); | |
77 | extern void eay_init_error __P((void)); | |
78 | ||
79 | /* DES */ | |
80 | extern vchar_t *eay_des_encrypt __P((vchar_t *, vchar_t *, vchar_t *)); | |
81 | extern vchar_t *eay_des_decrypt __P((vchar_t *, vchar_t *, vchar_t *)); | |
82 | extern int eay_des_weakkey __P((vchar_t *)); | |
83 | extern int eay_des_keylen __P((int)); | |
84 | ||
85 | /* IDEA */ | |
86 | extern vchar_t *eay_idea_encrypt __P((vchar_t *, vchar_t *, vchar_t *)); | |
87 | extern vchar_t *eay_idea_decrypt __P((vchar_t *, vchar_t *, vchar_t *)); | |
88 | extern int eay_idea_weakkey __P((vchar_t *)); | |
89 | extern int eay_idea_keylen __P((int)); | |
90 | ||
91 | /* blowfish */ | |
92 | extern vchar_t *eay_bf_encrypt __P((vchar_t *, vchar_t *, vchar_t *)); | |
93 | extern vchar_t *eay_bf_decrypt __P((vchar_t *, vchar_t *, vchar_t *)); | |
94 | extern int eay_bf_weakkey __P((vchar_t *)); | |
95 | extern int eay_bf_keylen __P((int)); | |
96 | ||
97 | /* RC5 */ | |
98 | extern vchar_t *eay_rc5_encrypt __P((vchar_t *, vchar_t *, vchar_t *)); | |
99 | extern vchar_t *eay_rc5_decrypt __P((vchar_t *, vchar_t *, vchar_t *)); | |
100 | extern int eay_rc5_weakkey __P((vchar_t *)); | |
101 | extern int eay_rc5_keylen __P((int)); | |
102 | ||
103 | /* 3DES */ | |
104 | extern vchar_t *eay_3des_encrypt __P((vchar_t *, vchar_t *, vchar_t *)); | |
105 | extern vchar_t *eay_3des_decrypt __P((vchar_t *, vchar_t *, vchar_t *)); | |
106 | extern int eay_3des_weakkey __P((vchar_t *)); | |
107 | extern int eay_3des_keylen __P((int)); | |
108 | ||
109 | /* CAST */ | |
110 | extern vchar_t *eay_cast_encrypt __P((vchar_t *, vchar_t *, vchar_t *)); | |
111 | extern vchar_t *eay_cast_decrypt __P((vchar_t *, vchar_t *, vchar_t *)); | |
112 | extern int eay_cast_weakkey __P((vchar_t *)); | |
113 | extern int eay_cast_keylen __P((int)); | |
114 | ||
115 | /* AES(RIJNDAEL) */ | |
116 | extern vchar_t *eay_aes_encrypt __P((vchar_t *, vchar_t *, vchar_t *)); | |
117 | extern vchar_t *eay_aes_decrypt __P((vchar_t *, vchar_t *, vchar_t *)); | |
118 | extern int eay_aes_weakkey __P((vchar_t *)); | |
119 | extern int eay_aes_keylen __P((int)); | |
120 | ||
121 | /* misc */ | |
ac2f15b3 | 122 | extern int eay_null_keylen __P((int)); |
7ba0088d A |
123 | extern int eay_null_hashlen __P((void)); |
124 | extern int eay_kpdk_hashlen __P((void)); | |
125 | extern int eay_twofish_keylen __P((int)); | |
126 | ||
127 | /* hash */ | |
128 | /* HMAC SHA2 */ | |
129 | extern vchar_t *eay_hmacsha2_512_one __P((vchar_t *, vchar_t *)); | |
130 | extern caddr_t eay_hmacsha2_512_init __P((vchar_t *)); | |
131 | extern void eay_hmacsha2_512_update __P((caddr_t, vchar_t *)); | |
132 | extern vchar_t *eay_hmacsha2_512_final __P((caddr_t)); | |
133 | extern vchar_t *eay_hmacsha2_384_one __P((vchar_t *, vchar_t *)); | |
134 | extern caddr_t eay_hmacsha2_384_init __P((vchar_t *)); | |
135 | extern void eay_hmacsha2_384_update __P((caddr_t, vchar_t *)); | |
136 | extern vchar_t *eay_hmacsha2_384_final __P((caddr_t)); | |
137 | extern vchar_t *eay_hmacsha2_256_one __P((vchar_t *, vchar_t *)); | |
138 | extern caddr_t eay_hmacsha2_256_init __P((vchar_t *)); | |
139 | extern void eay_hmacsha2_256_update __P((caddr_t, vchar_t *)); | |
140 | extern vchar_t *eay_hmacsha2_256_final __P((caddr_t)); | |
141 | /* HMAC SHA1 */ | |
142 | extern vchar_t *eay_hmacsha1_one __P((vchar_t *, vchar_t *)); | |
143 | extern caddr_t eay_hmacsha1_init __P((vchar_t *)); | |
144 | extern void eay_hmacsha1_update __P((caddr_t, vchar_t *)); | |
145 | extern vchar_t *eay_hmacsha1_final __P((caddr_t)); | |
146 | /* HMAC MD5 */ | |
147 | extern vchar_t *eay_hmacmd5_one __P((vchar_t *, vchar_t *)); | |
148 | extern caddr_t eay_hmacmd5_init __P((vchar_t *)); | |
149 | extern void eay_hmacmd5_update __P((caddr_t, vchar_t *)); | |
150 | extern vchar_t *eay_hmacmd5_final __P((caddr_t)); | |
151 | ||
152 | /* SHA2 functions */ | |
153 | extern caddr_t eay_sha2_512_init __P((void)); | |
154 | extern void eay_sha2_512_update __P((caddr_t, vchar_t *)); | |
155 | extern vchar_t *eay_sha2_512_final __P((caddr_t)); | |
156 | extern vchar_t *eay_sha2_512_one __P((vchar_t *)); | |
157 | extern int eay_sha2_512_hashlen __P((void)); | |
158 | ||
159 | extern caddr_t eay_sha2_384_init __P((void)); | |
160 | extern void eay_sha2_384_update __P((caddr_t, vchar_t *)); | |
161 | extern vchar_t *eay_sha2_384_final __P((caddr_t)); | |
162 | extern vchar_t *eay_sha2_384_one __P((vchar_t *)); | |
163 | extern int eay_sha2_384_hashlen __P((void)); | |
164 | ||
165 | extern caddr_t eay_sha2_256_init __P((void)); | |
166 | extern void eay_sha2_256_update __P((caddr_t, vchar_t *)); | |
167 | extern vchar_t *eay_sha2_256_final __P((caddr_t)); | |
168 | extern vchar_t *eay_sha2_256_one __P((vchar_t *)); | |
169 | extern int eay_sha2_256_hashlen __P((void)); | |
170 | ||
171 | /* SHA functions */ | |
172 | extern caddr_t eay_sha1_init __P((void)); | |
173 | extern void eay_sha1_update __P((caddr_t, vchar_t *)); | |
174 | extern vchar_t *eay_sha1_final __P((caddr_t)); | |
175 | extern vchar_t *eay_sha1_one __P((vchar_t *)); | |
176 | extern int eay_sha1_hashlen __P((void)); | |
177 | ||
178 | /* MD5 functions */ | |
179 | extern caddr_t eay_md5_init __P((void)); | |
180 | extern void eay_md5_update __P((caddr_t, vchar_t *)); | |
181 | extern vchar_t *eay_md5_final __P((caddr_t)); | |
182 | extern vchar_t *eay_md5_one __P((vchar_t *)); | |
183 | extern int eay_md5_hashlen __P((void)); | |
184 | ||
185 | /* eay_set_random */ | |
186 | extern vchar_t *eay_set_random __P((u_int32_t)); | |
187 | ||
188 | /* DH */ | |
189 | extern int eay_dh_generate __P((vchar_t *, u_int32_t, u_int, vchar_t **, vchar_t **)); | |
190 | extern int eay_dh_compute __P((vchar_t *, u_int32_t, vchar_t *, vchar_t *, vchar_t *, vchar_t **)); | |
191 | ||
192 | /* misc */ | |
193 | extern int eay_revbnl __P((vchar_t *)); | |
194 | #include <openssl/bn.h> | |
195 | extern int eay_v2bn __P((BIGNUM **, vchar_t *)); | |
196 | extern int eay_bn2v __P((vchar_t **, BIGNUM *)); | |
197 | ||
198 | extern const char *eay_version __P((void)); | |
199 | ||
200 | #define CBC_BLOCKLEN 8 | |
201 | #define IPSEC_ENCRYPTKEYLEN 8 | |
2b484d24 A |
202 | |
203 | ||
204 | #endif /* __CRYPTO_OPENSSL_H__ */ | |
205 |