]>
Commit | Line | Data |
---|---|---|
52b7d2ce A |
1 | /* $Id: crypto_openssl.h,v 1.11 2004/11/13 11:28:01 manubsd Exp $ */ |
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 | */ | |
31 | ||
32 | #ifndef _CRYPTO_OPENSSL_H | |
33 | #define _CRYPTO_OPENSSL_H | |
34 | ||
e8d9021d | 35 | #include "vmbuf.h" |
52b7d2ce | 36 | #include "crypto_openssl.h" |
e8d9021d | 37 | #ifdef HAVE_OPENSSL |
52b7d2ce A |
38 | #include <openssl/x509v3.h> |
39 | #include <openssl/rsa.h> | |
40 | ||
41 | #define GENT_OTHERNAME GEN_OTHERNAME | |
42 | #define GENT_EMAIL GEN_EMAIL | |
43 | #define GENT_DNS GEN_DNS | |
52b7d2ce | 44 | #define GENT_IPADD GEN_IPADD |
65c25746 A |
45 | |
46 | extern int eay_cmp_asn1dn (vchar_t *, vchar_t *); | |
47 | extern int eay_get_x509subjectaltname (vchar_t *, char **, int *, int, int*); | |
48 | extern vchar_t *eay_get_x509_common_name (vchar_t *); | |
52b7d2ce A |
49 | |
50 | /* string error */ | |
65c25746 | 51 | extern char *eay_strerror (void); |
52b7d2ce A |
52 | |
53 | /* OpenSSL initialization */ | |
65c25746 | 54 | extern void eay_init (void); |
e8d9021d | 55 | #endif /* HAVE_OPENSSL */ |
52b7d2ce A |
56 | |
57 | /* DES */ | |
65c25746 A |
58 | extern vchar_t *eay_des_encrypt (vchar_t *, vchar_t *, vchar_t *); |
59 | extern vchar_t *eay_des_decrypt (vchar_t *, vchar_t *, vchar_t *); | |
60 | extern int eay_des_weakkey (vchar_t *); | |
61 | extern int eay_des_keylen (int); | |
52b7d2ce | 62 | |
52b7d2ce | 63 | /* 3DES */ |
65c25746 A |
64 | extern vchar_t *eay_3des_encrypt (vchar_t *, vchar_t *, vchar_t *); |
65 | extern vchar_t *eay_3des_decrypt (vchar_t *, vchar_t *, vchar_t *); | |
66 | extern int eay_3des_weakkey (vchar_t *); | |
67 | extern int eay_3des_keylen (int); | |
52b7d2ce | 68 | |
52b7d2ce | 69 | /* AES(RIJNDAEL) */ |
65c25746 A |
70 | extern vchar_t *eay_aes_encrypt (vchar_t *, vchar_t *, vchar_t *); |
71 | extern vchar_t *eay_aes_decrypt (vchar_t *, vchar_t *, vchar_t *); | |
72 | extern int eay_aes_weakkey (vchar_t *); | |
73 | extern int eay_aes_keylen (int); | |
52b7d2ce A |
74 | |
75 | /* misc */ | |
65c25746 A |
76 | extern int eay_null_keylen (int); |
77 | extern int eay_null_hashlen (void); | |
52b7d2ce A |
78 | |
79 | /* hash */ | |
80 | #if defined(WITH_SHA2) | |
81 | /* HMAC SHA2 */ | |
65c25746 A |
82 | extern vchar_t *eay_hmacsha2_512_one (vchar_t *, vchar_t *); |
83 | extern caddr_t eay_hmacsha2_512_init (vchar_t *); | |
84 | extern void eay_hmacsha2_512_update (caddr_t, vchar_t *); | |
85 | extern vchar_t *eay_hmacsha2_512_final (caddr_t); | |
86 | extern vchar_t *eay_hmacsha2_384_one (vchar_t *, vchar_t *); | |
87 | extern caddr_t eay_hmacsha2_384_init (vchar_t *); | |
88 | extern void eay_hmacsha2_384_update (caddr_t, vchar_t *); | |
89 | extern vchar_t *eay_hmacsha2_384_final (caddr_t); | |
90 | extern vchar_t *eay_hmacsha2_256_one (vchar_t *, vchar_t *); | |
91 | extern caddr_t eay_hmacsha2_256_init (vchar_t *); | |
92 | extern void eay_hmacsha2_256_update (caddr_t, vchar_t *); | |
93 | extern vchar_t *eay_hmacsha2_256_final (caddr_t); | |
52b7d2ce A |
94 | #endif |
95 | /* HMAC SHA1 */ | |
65c25746 A |
96 | extern vchar_t *eay_hmacsha1_one (vchar_t *, vchar_t *); |
97 | extern caddr_t eay_hmacsha1_init (vchar_t *); | |
98 | extern void eay_hmacsha1_update (caddr_t, vchar_t *); | |
99 | extern vchar_t *eay_hmacsha1_final (caddr_t); | |
52b7d2ce | 100 | /* HMAC MD5 */ |
65c25746 A |
101 | extern vchar_t *eay_hmacmd5_one (vchar_t *, vchar_t *); |
102 | extern caddr_t eay_hmacmd5_init (vchar_t *); | |
103 | extern void eay_hmacmd5_update (caddr_t, vchar_t *); | |
104 | extern vchar_t *eay_hmacmd5_final (caddr_t); | |
105 | ||
52b7d2ce A |
106 | |
107 | #if defined(WITH_SHA2) | |
108 | /* SHA2 functions */ | |
65c25746 A |
109 | extern caddr_t eay_sha2_512_init (void); |
110 | extern void eay_sha2_512_update (caddr_t, vchar_t *); | |
111 | extern vchar_t *eay_sha2_512_final (caddr_t); | |
112 | extern vchar_t *eay_sha2_512_one (vchar_t *); | |
52b7d2ce | 113 | #endif |
65c25746 | 114 | extern int eay_sha2_512_hashlen (void); |
52b7d2ce A |
115 | |
116 | #if defined(WITH_SHA2) | |
65c25746 A |
117 | extern caddr_t eay_sha2_384_init (void); |
118 | extern void eay_sha2_384_update (caddr_t, vchar_t *); | |
119 | extern vchar_t *eay_sha2_384_final (caddr_t); | |
120 | extern vchar_t *eay_sha2_384_one (vchar_t *); | |
52b7d2ce | 121 | #endif |
65c25746 | 122 | extern int eay_sha2_384_hashlen (void); |
52b7d2ce A |
123 | |
124 | #if defined(WITH_SHA2) | |
65c25746 A |
125 | extern caddr_t eay_sha2_256_init (void); |
126 | extern void eay_sha2_256_update (caddr_t, vchar_t *); | |
127 | extern vchar_t *eay_sha2_256_final (caddr_t); | |
128 | extern vchar_t *eay_sha2_256_one (vchar_t *); | |
52b7d2ce | 129 | #endif |
65c25746 | 130 | extern int eay_sha2_256_hashlen (void); |
52b7d2ce A |
131 | |
132 | /* SHA functions */ | |
65c25746 A |
133 | extern caddr_t eay_sha1_init (void); |
134 | extern void eay_sha1_update (caddr_t, vchar_t *); | |
135 | extern vchar_t *eay_sha1_final (caddr_t); | |
136 | extern vchar_t *eay_sha1_one (vchar_t *); | |
137 | extern int eay_sha1_hashlen (void); | |
52b7d2ce A |
138 | |
139 | /* MD5 functions */ | |
65c25746 A |
140 | extern caddr_t eay_md5_init (void); |
141 | extern void eay_md5_update (caddr_t, vchar_t *); | |
142 | extern vchar_t *eay_md5_final (caddr_t); | |
143 | extern vchar_t *eay_md5_one (vchar_t *); | |
144 | extern int eay_md5_hashlen (void); | |
52b7d2ce A |
145 | |
146 | /* RNG */ | |
65c25746 A |
147 | extern vchar_t *eay_set_random (u_int32_t); |
148 | extern u_int32_t eay_random (void); | |
52b7d2ce A |
149 | |
150 | /* DH */ | |
65c25746 A |
151 | extern int eay_dh_generate (vchar_t *, u_int32_t, u_int, vchar_t **, vchar_t **); |
152 | extern int eay_dh_compute (vchar_t *, u_int32_t, vchar_t *, vchar_t *, vchar_t *, vchar_t **); | |
52b7d2ce A |
153 | |
154 | /* misc */ | |
e8d9021d | 155 | #ifdef HAVE_OPENSSL |
52b7d2ce | 156 | #include <openssl/bn.h> |
65c25746 A |
157 | extern int eay_v2bn (BIGNUM **, vchar_t *); |
158 | extern int eay_bn2v (vchar_t **, BIGNUM *); | |
52b7d2ce | 159 | |
65c25746 | 160 | extern const char *eay_version (void); |
e8d9021d | 161 | #endif |
52b7d2ce A |
162 | |
163 | #define CBC_BLOCKLEN 8 | |
164 | #define IPSEC_ENCRYPTKEYLEN 8 | |
165 | ||
166 | #endif /* _CRYPTO_OPENSSL_H */ |