]> git.saurik.com Git - apple/ipsec.git/blame - ipsec-tools/racoon/crypto_openssl.h
ipsec-93.13.tar.gz
[apple/ipsec.git] / ipsec-tools / racoon / crypto_openssl.h
CommitLineData
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
35#include "crypto_openssl.h"
36
37#include <openssl/x509v3.h>
38#include <openssl/rsa.h>
39
40#define GENT_OTHERNAME GEN_OTHERNAME
41#define GENT_EMAIL GEN_EMAIL
42#define GENT_DNS GEN_DNS
43#define GENT_X400 GEN_X400
44#define GENT_DIRNAME GEN_DIRNAME
45#define GENT_EDIPARTY GEN_EDIPARTY
46#define GENT_URI GEN_URI
47#define GENT_IPADD GEN_IPADD
48#define GENT_RID GEN_RID
49
50extern vchar_t *eay_str2asn1dn __P((const char *, int));
51extern vchar_t *eay_hex2asn1dn __P((const char *, int));
52extern int eay_cmp_asn1dn __P((vchar_t *, vchar_t *));
53extern int eay_check_x509cert __P((vchar_t *, char *, char *, int));
54extern vchar_t *eay_get_x509asn1subjectname __P((vchar_t *));
55#ifdef __APPLE__
56extern int eay_get_x509subjectaltname __P((vchar_t *, char **, int *, int, int*));
57extern vchar_t *eay_get_x509_common_name __P((vchar_t *));
58#else
59extern int eay_get_x509subjectaltname __P((vchar_t *, char **, int *, int));
60#endif
61extern char *eay_get_x509text __P((vchar_t *));
62extern vchar_t *eay_get_x509cert __P((char *));
63extern vchar_t *eay_get_x509sign __P((vchar_t *, vchar_t *));
64extern int eay_check_x509sign __P((vchar_t *, vchar_t *, vchar_t *));
65
66extern int eay_check_rsasign __P((vchar_t *, vchar_t *, RSA *));
67extern vchar_t *eay_get_rsasign __P((vchar_t *, RSA *));
68
69/* RSA */
70extern vchar_t *eay_rsa_sign __P((vchar_t *, RSA *));
71extern int eay_rsa_verify __P((vchar_t *, vchar_t *, RSA *));
72
73/* ASN.1 */
74extern vchar_t *eay_get_pkcs1privkey __P((char *));
75extern vchar_t *eay_get_pkcs1pubkey __P((char *));
76
77/* string error */
78extern char *eay_strerror __P((void));
79
80/* OpenSSL initialization */
81extern void eay_init __P((void));
82
83/* Generic EVP */
84extern vchar_t *evp_crypt __P((vchar_t *data, vchar_t *key, vchar_t *iv,
85 const EVP_CIPHER *e, int enc));
86extern int evp_weakkey __P((vchar_t *key, const EVP_CIPHER *e));
87extern int evp_keylen __P((int len, const EVP_CIPHER *e));
88
89/* DES */
90extern vchar_t *eay_des_encrypt __P((vchar_t *, vchar_t *, vchar_t *));
91extern vchar_t *eay_des_decrypt __P((vchar_t *, vchar_t *, vchar_t *));
92extern int eay_des_weakkey __P((vchar_t *));
93extern int eay_des_keylen __P((int));
94
95/* IDEA */
96extern vchar_t *eay_idea_encrypt __P((vchar_t *, vchar_t *, vchar_t *));
97extern vchar_t *eay_idea_decrypt __P((vchar_t *, vchar_t *, vchar_t *));
98extern int eay_idea_weakkey __P((vchar_t *));
99extern int eay_idea_keylen __P((int));
100
101/* blowfish */
102extern vchar_t *eay_bf_encrypt __P((vchar_t *, vchar_t *, vchar_t *));
103extern vchar_t *eay_bf_decrypt __P((vchar_t *, vchar_t *, vchar_t *));
104extern int eay_bf_weakkey __P((vchar_t *));
105extern int eay_bf_keylen __P((int));
106
107/* RC5 */
108extern vchar_t *eay_rc5_encrypt __P((vchar_t *, vchar_t *, vchar_t *));
109extern vchar_t *eay_rc5_decrypt __P((vchar_t *, vchar_t *, vchar_t *));
110extern int eay_rc5_weakkey __P((vchar_t *));
111extern int eay_rc5_keylen __P((int));
112
113/* 3DES */
114extern vchar_t *eay_3des_encrypt __P((vchar_t *, vchar_t *, vchar_t *));
115extern vchar_t *eay_3des_decrypt __P((vchar_t *, vchar_t *, vchar_t *));
116extern int eay_3des_weakkey __P((vchar_t *));
117extern int eay_3des_keylen __P((int));
118
119/* CAST */
120extern vchar_t *eay_cast_encrypt __P((vchar_t *, vchar_t *, vchar_t *));
121extern vchar_t *eay_cast_decrypt __P((vchar_t *, vchar_t *, vchar_t *));
122extern int eay_cast_weakkey __P((vchar_t *));
123extern int eay_cast_keylen __P((int));
124
125/* AES(RIJNDAEL) */
126extern vchar_t *eay_aes_encrypt __P((vchar_t *, vchar_t *, vchar_t *));
127extern vchar_t *eay_aes_decrypt __P((vchar_t *, vchar_t *, vchar_t *));
128extern int eay_aes_weakkey __P((vchar_t *));
129extern int eay_aes_keylen __P((int));
130
131/* misc */
132extern int eay_null_keylen __P((int));
133extern int eay_null_hashlen __P((void));
134extern int eay_kpdk_hashlen __P((void));
135extern int eay_twofish_keylen __P((int));
136
137/* hash */
138#if defined(WITH_SHA2)
139/* HMAC SHA2 */
140extern vchar_t *eay_hmacsha2_512_one __P((vchar_t *, vchar_t *));
141extern caddr_t eay_hmacsha2_512_init __P((vchar_t *));
142extern void eay_hmacsha2_512_update __P((caddr_t, vchar_t *));
143extern vchar_t *eay_hmacsha2_512_final __P((caddr_t));
144extern vchar_t *eay_hmacsha2_384_one __P((vchar_t *, vchar_t *));
145extern caddr_t eay_hmacsha2_384_init __P((vchar_t *));
146extern void eay_hmacsha2_384_update __P((caddr_t, vchar_t *));
147extern vchar_t *eay_hmacsha2_384_final __P((caddr_t));
148extern vchar_t *eay_hmacsha2_256_one __P((vchar_t *, vchar_t *));
149extern caddr_t eay_hmacsha2_256_init __P((vchar_t *));
150extern void eay_hmacsha2_256_update __P((caddr_t, vchar_t *));
151extern vchar_t *eay_hmacsha2_256_final __P((caddr_t));
152#endif
153/* HMAC SHA1 */
154extern vchar_t *eay_hmacsha1_one __P((vchar_t *, vchar_t *));
155extern caddr_t eay_hmacsha1_init __P((vchar_t *));
156extern void eay_hmacsha1_update __P((caddr_t, vchar_t *));
157extern vchar_t *eay_hmacsha1_final __P((caddr_t));
158/* HMAC MD5 */
159extern vchar_t *eay_hmacmd5_one __P((vchar_t *, vchar_t *));
160extern caddr_t eay_hmacmd5_init __P((vchar_t *));
161extern void eay_hmacmd5_update __P((caddr_t, vchar_t *));
162extern vchar_t *eay_hmacmd5_final __P((caddr_t));
163
164#if defined(WITH_SHA2)
165/* SHA2 functions */
166extern caddr_t eay_sha2_512_init __P((void));
167extern void eay_sha2_512_update __P((caddr_t, vchar_t *));
168extern vchar_t *eay_sha2_512_final __P((caddr_t));
169extern vchar_t *eay_sha2_512_one __P((vchar_t *));
170#endif
171extern int eay_sha2_512_hashlen __P((void));
172
173#if defined(WITH_SHA2)
174extern caddr_t eay_sha2_384_init __P((void));
175extern void eay_sha2_384_update __P((caddr_t, vchar_t *));
176extern vchar_t *eay_sha2_384_final __P((caddr_t));
177extern vchar_t *eay_sha2_384_one __P((vchar_t *));
178#endif
179extern int eay_sha2_384_hashlen __P((void));
180
181#if defined(WITH_SHA2)
182extern caddr_t eay_sha2_256_init __P((void));
183extern void eay_sha2_256_update __P((caddr_t, vchar_t *));
184extern vchar_t *eay_sha2_256_final __P((caddr_t));
185extern vchar_t *eay_sha2_256_one __P((vchar_t *));
186#endif
187extern int eay_sha2_256_hashlen __P((void));
188
189/* SHA functions */
190extern caddr_t eay_sha1_init __P((void));
191extern void eay_sha1_update __P((caddr_t, vchar_t *));
192extern vchar_t *eay_sha1_final __P((caddr_t));
193extern vchar_t *eay_sha1_one __P((vchar_t *));
194extern int eay_sha1_hashlen __P((void));
195
196/* MD5 functions */
197extern caddr_t eay_md5_init __P((void));
198extern void eay_md5_update __P((caddr_t, vchar_t *));
199extern vchar_t *eay_md5_final __P((caddr_t));
200extern vchar_t *eay_md5_one __P((vchar_t *));
201extern int eay_md5_hashlen __P((void));
202
203/* RNG */
204extern vchar_t *eay_set_random __P((u_int32_t));
205extern u_int32_t eay_random __P((void));
206
207/* DH */
208extern int eay_dh_generate __P((vchar_t *, u_int32_t, u_int, vchar_t **, vchar_t **));
209extern int eay_dh_compute __P((vchar_t *, u_int32_t, vchar_t *, vchar_t *, vchar_t *, vchar_t **));
210
211/* Base 64 */
212vchar_t *base64_encode(char *in, long inlen);
213vchar_t *base64_decode(char *in, long inlen);
214
215RSA *base64_pubkey2rsa(char *in);
216RSA *bignum_pubkey2rsa(BIGNUM *in);
217
218/* misc */
219extern int eay_revbnl __P((vchar_t *));
220#include <openssl/bn.h>
221extern int eay_v2bn __P((BIGNUM **, vchar_t *));
222extern int eay_bn2v __P((vchar_t **, BIGNUM *));
223
224extern const char *eay_version __P((void));
225
226#define CBC_BLOCKLEN 8
227#define IPSEC_ENCRYPTKEYLEN 8
228
229#endif /* _CRYPTO_OPENSSL_H */