williamr@2
|
1 |
/* crypto/des/des_old.h -*- mode:C; c-file-style: "eay" -*- */
|
williamr@2
|
2 |
|
williamr@2
|
3 |
/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
williamr@2
|
4 |
*
|
williamr@2
|
5 |
* The function names in here are deprecated and are only present to
|
williamr@2
|
6 |
* provide an interface compatible with openssl 0.9.6 and older as
|
williamr@2
|
7 |
* well as libdes. OpenSSL now provides functions where "des_" has
|
williamr@2
|
8 |
* been replaced with "DES_" in the names, to make it possible to
|
williamr@2
|
9 |
* make incompatible changes that are needed for C type security and
|
williamr@2
|
10 |
* other stuff.
|
williamr@2
|
11 |
*
|
williamr@2
|
12 |
* This include files has two compatibility modes:
|
williamr@2
|
13 |
*
|
williamr@2
|
14 |
* - If OPENSSL_DES_LIBDES_COMPATIBILITY is defined, you get an API
|
williamr@2
|
15 |
* that is compatible with libdes and SSLeay.
|
williamr@2
|
16 |
* - If OPENSSL_DES_LIBDES_COMPATIBILITY isn't defined, you get an
|
williamr@2
|
17 |
* API that is compatible with OpenSSL 0.9.5x to 0.9.6x.
|
williamr@2
|
18 |
*
|
williamr@2
|
19 |
* Note that these modes break earlier snapshots of OpenSSL, where
|
williamr@2
|
20 |
* libdes compatibility was the only available mode or (later on) the
|
williamr@2
|
21 |
* prefered compatibility mode. However, after much consideration
|
williamr@2
|
22 |
* (and more or less violent discussions with external parties), it
|
williamr@2
|
23 |
* was concluded that OpenSSL should be compatible with earlier versions
|
williamr@2
|
24 |
* of itself before anything else. Also, in all honesty, libdes is
|
williamr@2
|
25 |
* an old beast that shouldn't really be used any more.
|
williamr@2
|
26 |
*
|
williamr@2
|
27 |
* Please consider starting to use the DES_ functions rather than the
|
williamr@2
|
28 |
* des_ ones. The des_ functions will disappear completely before
|
williamr@2
|
29 |
* OpenSSL 1.0!
|
williamr@2
|
30 |
*
|
williamr@2
|
31 |
* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
williamr@2
|
32 |
*/
|
williamr@2
|
33 |
|
williamr@2
|
34 |
/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
|
williamr@2
|
35 |
* project 2001.
|
williamr@2
|
36 |
*/
|
williamr@2
|
37 |
/* ====================================================================
|
williamr@2
|
38 |
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
|
williamr@2
|
39 |
*
|
williamr@2
|
40 |
* Redistribution and use in source and binary forms, with or without
|
williamr@2
|
41 |
* modification, are permitted provided that the following conditions
|
williamr@2
|
42 |
* are met:
|
williamr@2
|
43 |
*
|
williamr@2
|
44 |
* 1. Redistributions of source code must retain the above copyright
|
williamr@2
|
45 |
* notice, this list of conditions and the following disclaimer.
|
williamr@2
|
46 |
*
|
williamr@2
|
47 |
* 2. Redistributions in binary form must reproduce the above copyright
|
williamr@2
|
48 |
* notice, this list of conditions and the following disclaimer in
|
williamr@2
|
49 |
* the documentation and/or other materials provided with the
|
williamr@2
|
50 |
* distribution.
|
williamr@2
|
51 |
*
|
williamr@2
|
52 |
* 3. All advertising materials mentioning features or use of this
|
williamr@2
|
53 |
* software must display the following acknowledgment:
|
williamr@2
|
54 |
* "This product includes software developed by the OpenSSL Project
|
williamr@2
|
55 |
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
williamr@2
|
56 |
*
|
williamr@2
|
57 |
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
williamr@2
|
58 |
* endorse or promote products derived from this software without
|
williamr@2
|
59 |
* prior written permission. For written permission, please contact
|
williamr@2
|
60 |
* openssl-core@openssl.org.
|
williamr@2
|
61 |
*
|
williamr@2
|
62 |
* 5. Products derived from this software may not be called "OpenSSL"
|
williamr@2
|
63 |
* nor may "OpenSSL" appear in their names without prior written
|
williamr@2
|
64 |
* permission of the OpenSSL Project.
|
williamr@2
|
65 |
*
|
williamr@2
|
66 |
* 6. Redistributions of any form whatsoever must retain the following
|
williamr@2
|
67 |
* acknowledgment:
|
williamr@2
|
68 |
* "This product includes software developed by the OpenSSL Project
|
williamr@2
|
69 |
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
williamr@2
|
70 |
*
|
williamr@2
|
71 |
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
williamr@2
|
72 |
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
williamr@2
|
73 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
williamr@2
|
74 |
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
williamr@2
|
75 |
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
williamr@2
|
76 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
williamr@2
|
77 |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
williamr@2
|
78 |
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
williamr@2
|
79 |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
williamr@2
|
80 |
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
williamr@2
|
81 |
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
williamr@2
|
82 |
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
williamr@2
|
83 |
* ====================================================================
|
williamr@2
|
84 |
*
|
williamr@2
|
85 |
* This product includes cryptographic software written by Eric Young
|
williamr@2
|
86 |
* (eay@cryptsoft.com). This product includes software written by Tim
|
williamr@2
|
87 |
* Hudson (tjh@cryptsoft.com).
|
williamr@2
|
88 |
*
|
williamr@2
|
89 |
*/
|
williamr@2
|
90 |
/*
|
williamr@2
|
91 |
© Portions copyright (c) 2006 Nokia Corporation. All rights reserved.
|
williamr@2
|
92 |
*/
|
williamr@2
|
93 |
|
williamr@2
|
94 |
#ifndef HEADER_DES_H
|
williamr@2
|
95 |
#define HEADER_DES_H
|
williamr@2
|
96 |
|
williamr@2
|
97 |
#if (defined(__SYMBIAN32__) && !defined(SYMBIAN))
|
williamr@2
|
98 |
#define SYMBIAN
|
williamr@2
|
99 |
#endif
|
williamr@2
|
100 |
|
williamr@2
|
101 |
#ifdef SYMBIAN
|
williamr@2
|
102 |
#include <e32def.h>
|
williamr@2
|
103 |
#endif
|
williamr@2
|
104 |
#include <openssl/e_os2.h> /* OPENSSL_EXTERN, OPENSSL_NO_DES, DES_LONG */
|
williamr@2
|
105 |
|
williamr@2
|
106 |
#ifdef OPENSSL_NO_DES
|
williamr@2
|
107 |
#error DES is disabled.
|
williamr@2
|
108 |
#endif
|
williamr@2
|
109 |
|
williamr@2
|
110 |
#ifndef HEADER_NEW_DES_H
|
williamr@2
|
111 |
#error You must include des.h, not des_old.h directly.
|
williamr@2
|
112 |
#endif
|
williamr@2
|
113 |
|
williamr@2
|
114 |
#ifdef _KERBEROS_DES_H
|
williamr@2
|
115 |
#error <openssl/des_old.h> replaces <kerberos/des.h>.
|
williamr@2
|
116 |
#endif
|
williamr@2
|
117 |
|
williamr@2
|
118 |
#include <openssl/symhacks.h>
|
williamr@2
|
119 |
|
williamr@2
|
120 |
#ifdef OPENSSL_BUILD_SHLIBCRYPTO
|
williamr@2
|
121 |
# undef OPENSSL_EXTERN
|
williamr@2
|
122 |
# define OPENSSL_EXTERN OPENSSL_EXPORT
|
williamr@2
|
123 |
#endif
|
williamr@2
|
124 |
|
williamr@2
|
125 |
#ifdef __cplusplus
|
williamr@2
|
126 |
extern "C" {
|
williamr@2
|
127 |
#endif
|
williamr@2
|
128 |
|
williamr@2
|
129 |
#ifdef _
|
williamr@2
|
130 |
#undef _
|
williamr@2
|
131 |
#endif
|
williamr@2
|
132 |
|
williamr@2
|
133 |
typedef unsigned char _ossl_old_des_cblock[8];
|
williamr@2
|
134 |
typedef struct _ossl_old_des_ks_struct
|
williamr@2
|
135 |
{
|
williamr@2
|
136 |
union {
|
williamr@2
|
137 |
_ossl_old_des_cblock _;
|
williamr@2
|
138 |
/* make sure things are correct size on machines with
|
williamr@2
|
139 |
* 8 byte longs */
|
williamr@2
|
140 |
DES_LONG pad[2];
|
williamr@2
|
141 |
} ks;
|
williamr@2
|
142 |
} _ossl_old_des_key_schedule[16];
|
williamr@2
|
143 |
|
williamr@2
|
144 |
#ifndef OPENSSL_DES_LIBDES_COMPATIBILITY
|
williamr@2
|
145 |
#define des_cblock DES_cblock
|
williamr@2
|
146 |
#define const_des_cblock const_DES_cblock
|
williamr@2
|
147 |
#define des_key_schedule DES_key_schedule
|
williamr@2
|
148 |
#define des_ecb3_encrypt(i,o,k1,k2,k3,e)\
|
williamr@2
|
149 |
DES_ecb3_encrypt((i),(o),&(k1),&(k2),&(k3),(e))
|
williamr@2
|
150 |
#define des_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e)\
|
williamr@2
|
151 |
DES_ede3_cbc_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(e))
|
williamr@2
|
152 |
#define des_ede3_cbcm_encrypt(i,o,l,k1,k2,k3,iv1,iv2,e)\
|
williamr@2
|
153 |
DES_ede3_cbcm_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv1),(iv2),(e))
|
williamr@2
|
154 |
#define des_ede3_cfb64_encrypt(i,o,l,k1,k2,k3,iv,n,e)\
|
williamr@2
|
155 |
DES_ede3_cfb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n),(e))
|
williamr@2
|
156 |
#define des_ede3_ofb64_encrypt(i,o,l,k1,k2,k3,iv,n)\
|
williamr@2
|
157 |
DES_ede3_ofb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n))
|
williamr@2
|
158 |
#define des_options()\
|
williamr@2
|
159 |
DES_options()
|
williamr@2
|
160 |
#define des_cbc_cksum(i,o,l,k,iv)\
|
williamr@2
|
161 |
DES_cbc_cksum((i),(o),(l),&(k),(iv))
|
williamr@2
|
162 |
#define des_cbc_encrypt(i,o,l,k,iv,e)\
|
williamr@2
|
163 |
DES_cbc_encrypt((i),(o),(l),&(k),(iv),(e))
|
williamr@2
|
164 |
#define des_ncbc_encrypt(i,o,l,k,iv,e)\
|
williamr@2
|
165 |
DES_ncbc_encrypt((i),(o),(l),&(k),(iv),(e))
|
williamr@2
|
166 |
#define des_xcbc_encrypt(i,o,l,k,iv,inw,outw,e)\
|
williamr@2
|
167 |
DES_xcbc_encrypt((i),(o),(l),&(k),(iv),(inw),(outw),(e))
|
williamr@2
|
168 |
#define des_cfb_encrypt(i,o,n,l,k,iv,e)\
|
williamr@2
|
169 |
DES_cfb_encrypt((i),(o),(n),(l),&(k),(iv),(e))
|
williamr@2
|
170 |
#define des_ecb_encrypt(i,o,k,e)\
|
williamr@2
|
171 |
DES_ecb_encrypt((i),(o),&(k),(e))
|
williamr@2
|
172 |
#define des_encrypt1(d,k,e)\
|
williamr@2
|
173 |
DES_encrypt1((d),&(k),(e))
|
williamr@2
|
174 |
#define des_encrypt2(d,k,e)\
|
williamr@2
|
175 |
DES_encrypt2((d),&(k),(e))
|
williamr@2
|
176 |
#define des_encrypt3(d,k1,k2,k3)\
|
williamr@2
|
177 |
DES_encrypt3((d),&(k1),&(k2),&(k3))
|
williamr@2
|
178 |
#define des_decrypt3(d,k1,k2,k3)\
|
williamr@2
|
179 |
DES_decrypt3((d),&(k1),&(k2),&(k3))
|
williamr@2
|
180 |
#define des_xwhite_in2out(k,i,o)\
|
williamr@2
|
181 |
DES_xwhite_in2out((k),(i),(o))
|
williamr@2
|
182 |
#define des_enc_read(f,b,l,k,iv)\
|
williamr@2
|
183 |
DES_enc_read((f),(b),(l),&(k),(iv))
|
williamr@2
|
184 |
#define des_enc_write(f,b,l,k,iv)\
|
williamr@2
|
185 |
DES_enc_write((f),(b),(l),&(k),(iv))
|
williamr@2
|
186 |
#define des_fcrypt(b,s,r)\
|
williamr@2
|
187 |
DES_fcrypt((b),(s),(r))
|
williamr@2
|
188 |
#if 0
|
williamr@2
|
189 |
#define des_crypt(b,s)\
|
williamr@2
|
190 |
DES_crypt((b),(s))
|
williamr@2
|
191 |
#if !defined(PERL5) && !defined(__FreeBSD__) && !defined(NeXT) && !defined(__OpenBSD__)
|
williamr@2
|
192 |
#define crypt(b,s)\
|
williamr@2
|
193 |
DES_crypt((b),(s))
|
williamr@2
|
194 |
#endif
|
williamr@2
|
195 |
#endif
|
williamr@2
|
196 |
#define des_ofb_encrypt(i,o,n,l,k,iv)\
|
williamr@2
|
197 |
DES_ofb_encrypt((i),(o),(n),(l),&(k),(iv))
|
williamr@2
|
198 |
#define des_pcbc_encrypt(i,o,l,k,iv,e)\
|
williamr@2
|
199 |
DES_pcbc_encrypt((i),(o),(l),&(k),(iv),(e))
|
williamr@2
|
200 |
#define des_quad_cksum(i,o,l,c,s)\
|
williamr@2
|
201 |
DES_quad_cksum((i),(o),(l),(c),(s))
|
williamr@2
|
202 |
#define des_random_seed(k)\
|
williamr@2
|
203 |
_ossl_096_des_random_seed((k))
|
williamr@2
|
204 |
#define des_random_key(r)\
|
williamr@2
|
205 |
DES_random_key((r))
|
williamr@2
|
206 |
#define des_read_password(k,p,v) \
|
williamr@2
|
207 |
DES_read_password((k),(p),(v))
|
williamr@2
|
208 |
#define des_read_2passwords(k1,k2,p,v) \
|
williamr@2
|
209 |
DES_read_2passwords((k1),(k2),(p),(v))
|
williamr@2
|
210 |
#define des_set_odd_parity(k)\
|
williamr@2
|
211 |
DES_set_odd_parity((k))
|
williamr@2
|
212 |
#define des_check_key_parity(k)\
|
williamr@2
|
213 |
DES_check_key_parity((k))
|
williamr@2
|
214 |
#define des_is_weak_key(k)\
|
williamr@2
|
215 |
DES_is_weak_key((k))
|
williamr@2
|
216 |
#define des_set_key(k,ks)\
|
williamr@2
|
217 |
DES_set_key((k),&(ks))
|
williamr@2
|
218 |
#define des_key_sched(k,ks)\
|
williamr@2
|
219 |
DES_key_sched((k),&(ks))
|
williamr@2
|
220 |
#define des_set_key_checked(k,ks)\
|
williamr@2
|
221 |
DES_set_key_checked((k),&(ks))
|
williamr@2
|
222 |
#define des_set_key_unchecked(k,ks)\
|
williamr@2
|
223 |
DES_set_key_unchecked((k),&(ks))
|
williamr@2
|
224 |
#define des_string_to_key(s,k)\
|
williamr@2
|
225 |
DES_string_to_key((s),(k))
|
williamr@2
|
226 |
#define des_string_to_2keys(s,k1,k2)\
|
williamr@2
|
227 |
DES_string_to_2keys((s),(k1),(k2))
|
williamr@2
|
228 |
#define des_cfb64_encrypt(i,o,l,ks,iv,n,e)\
|
williamr@2
|
229 |
DES_cfb64_encrypt((i),(o),(l),&(ks),(iv),(n),(e))
|
williamr@2
|
230 |
#define des_ofb64_encrypt(i,o,l,ks,iv,n)\
|
williamr@2
|
231 |
DES_ofb64_encrypt((i),(o),(l),&(ks),(iv),(n))
|
williamr@2
|
232 |
|
williamr@2
|
233 |
|
williamr@2
|
234 |
#define des_ecb2_encrypt(i,o,k1,k2,e) \
|
williamr@2
|
235 |
des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))
|
williamr@2
|
236 |
|
williamr@2
|
237 |
#define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \
|
williamr@2
|
238 |
des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))
|
williamr@2
|
239 |
|
williamr@2
|
240 |
#define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \
|
williamr@2
|
241 |
des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e))
|
williamr@2
|
242 |
|
williamr@2
|
243 |
#define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \
|
williamr@2
|
244 |
des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))
|
williamr@2
|
245 |
|
williamr@2
|
246 |
#define des_check_key DES_check_key
|
williamr@2
|
247 |
#define des_rw_mode DES_rw_mode
|
williamr@2
|
248 |
#else /* libdes compatibility */
|
williamr@2
|
249 |
/* Map all symbol names to _ossl_old_des_* form, so we avoid all
|
williamr@2
|
250 |
clashes with libdes */
|
williamr@2
|
251 |
#define des_cblock _ossl_old_des_cblock
|
williamr@2
|
252 |
#define des_key_schedule _ossl_old_des_key_schedule
|
williamr@2
|
253 |
#define des_ecb3_encrypt(i,o,k1,k2,k3,e)\
|
williamr@2
|
254 |
_ossl_old_des_ecb3_encrypt((i),(o),(k1),(k2),(k3),(e))
|
williamr@2
|
255 |
#define des_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e)\
|
williamr@2
|
256 |
_ossl_old_des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(e))
|
williamr@2
|
257 |
#define des_ede3_cfb64_encrypt(i,o,l,k1,k2,k3,iv,n,e)\
|
williamr@2
|
258 |
_ossl_old_des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n),(e))
|
williamr@2
|
259 |
#define des_ede3_ofb64_encrypt(i,o,l,k1,k2,k3,iv,n)\
|
williamr@2
|
260 |
_ossl_old_des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n))
|
williamr@2
|
261 |
#define des_options()\
|
williamr@2
|
262 |
_ossl_old_des_options()
|
williamr@2
|
263 |
#define des_cbc_cksum(i,o,l,k,iv)\
|
williamr@2
|
264 |
_ossl_old_des_cbc_cksum((i),(o),(l),(k),(iv))
|
williamr@2
|
265 |
#define des_cbc_encrypt(i,o,l,k,iv,e)\
|
williamr@2
|
266 |
_ossl_old_des_cbc_encrypt((i),(o),(l),(k),(iv),(e))
|
williamr@2
|
267 |
#define des_ncbc_encrypt(i,o,l,k,iv,e)\
|
williamr@2
|
268 |
_ossl_old_des_ncbc_encrypt((i),(o),(l),(k),(iv),(e))
|
williamr@2
|
269 |
#define des_xcbc_encrypt(i,o,l,k,iv,inw,outw,e)\
|
williamr@2
|
270 |
_ossl_old_des_xcbc_encrypt((i),(o),(l),(k),(iv),(inw),(outw),(e))
|
williamr@2
|
271 |
#define des_cfb_encrypt(i,o,n,l,k,iv,e)\
|
williamr@2
|
272 |
_ossl_old_des_cfb_encrypt((i),(o),(n),(l),(k),(iv),(e))
|
williamr@2
|
273 |
#define des_ecb_encrypt(i,o,k,e)\
|
williamr@2
|
274 |
_ossl_old_des_ecb_encrypt((i),(o),(k),(e))
|
williamr@2
|
275 |
#define des_encrypt(d,k,e)\
|
williamr@2
|
276 |
_ossl_old_des_encrypt((d),(k),(e))
|
williamr@2
|
277 |
#define des_encrypt2(d,k,e)\
|
williamr@2
|
278 |
_ossl_old_des_encrypt2((d),(k),(e))
|
williamr@2
|
279 |
#define des_encrypt3(d,k1,k2,k3)\
|
williamr@2
|
280 |
_ossl_old_des_encrypt3((d),(k1),(k2),(k3))
|
williamr@2
|
281 |
#define des_decrypt3(d,k1,k2,k3)\
|
williamr@2
|
282 |
_ossl_old_des_decrypt3((d),(k1),(k2),(k3))
|
williamr@2
|
283 |
#define des_xwhite_in2out(k,i,o)\
|
williamr@2
|
284 |
_ossl_old_des_xwhite_in2out((k),(i),(o))
|
williamr@2
|
285 |
#define des_enc_read(f,b,l,k,iv)\
|
williamr@2
|
286 |
_ossl_old_des_enc_read((f),(b),(l),(k),(iv))
|
williamr@2
|
287 |
#define des_enc_write(f,b,l,k,iv)\
|
williamr@2
|
288 |
_ossl_old_des_enc_write((f),(b),(l),(k),(iv))
|
williamr@2
|
289 |
#define des_fcrypt(b,s,r)\
|
williamr@2
|
290 |
_ossl_old_des_fcrypt((b),(s),(r))
|
williamr@2
|
291 |
#define des_crypt(b,s)\
|
williamr@2
|
292 |
_ossl_old_des_crypt((b),(s))
|
williamr@2
|
293 |
#if 0
|
williamr@2
|
294 |
#define crypt(b,s)\
|
williamr@2
|
295 |
_ossl_old_crypt((b),(s))
|
williamr@2
|
296 |
#endif
|
williamr@2
|
297 |
#define des_ofb_encrypt(i,o,n,l,k,iv)\
|
williamr@2
|
298 |
_ossl_old_des_ofb_encrypt((i),(o),(n),(l),(k),(iv))
|
williamr@2
|
299 |
#define des_pcbc_encrypt(i,o,l,k,iv,e)\
|
williamr@2
|
300 |
_ossl_old_des_pcbc_encrypt((i),(o),(l),(k),(iv),(e))
|
williamr@2
|
301 |
#define des_quad_cksum(i,o,l,c,s)\
|
williamr@2
|
302 |
_ossl_old_des_quad_cksum((i),(o),(l),(c),(s))
|
williamr@2
|
303 |
#define des_random_seed(k)\
|
williamr@2
|
304 |
_ossl_old_des_random_seed((k))
|
williamr@2
|
305 |
#define des_random_key(r)\
|
williamr@2
|
306 |
_ossl_old_des_random_key((r))
|
williamr@2
|
307 |
#define des_read_password(k,p,v) \
|
williamr@2
|
308 |
_ossl_old_des_read_password((k),(p),(v))
|
williamr@2
|
309 |
#define des_read_2passwords(k1,k2,p,v) \
|
williamr@2
|
310 |
_ossl_old_des_read_2passwords((k1),(k2),(p),(v))
|
williamr@2
|
311 |
#define des_set_odd_parity(k)\
|
williamr@2
|
312 |
_ossl_old_des_set_odd_parity((k))
|
williamr@2
|
313 |
#define des_is_weak_key(k)\
|
williamr@2
|
314 |
_ossl_old_des_is_weak_key((k))
|
williamr@2
|
315 |
#define des_set_key(k,ks)\
|
williamr@2
|
316 |
_ossl_old_des_set_key((k),(ks))
|
williamr@2
|
317 |
#define des_key_sched(k,ks)\
|
williamr@2
|
318 |
_ossl_old_des_key_sched((k),(ks))
|
williamr@2
|
319 |
#define des_string_to_key(s,k)\
|
williamr@2
|
320 |
_ossl_old_des_string_to_key((s),(k))
|
williamr@2
|
321 |
#define des_string_to_2keys(s,k1,k2)\
|
williamr@2
|
322 |
_ossl_old_des_string_to_2keys((s),(k1),(k2))
|
williamr@2
|
323 |
#define des_cfb64_encrypt(i,o,l,ks,iv,n,e)\
|
williamr@2
|
324 |
_ossl_old_des_cfb64_encrypt((i),(o),(l),(ks),(iv),(n),(e))
|
williamr@2
|
325 |
#define des_ofb64_encrypt(i,o,l,ks,iv,n)\
|
williamr@2
|
326 |
_ossl_old_des_ofb64_encrypt((i),(o),(l),(ks),(iv),(n))
|
williamr@2
|
327 |
|
williamr@2
|
328 |
|
williamr@2
|
329 |
#define des_ecb2_encrypt(i,o,k1,k2,e) \
|
williamr@2
|
330 |
des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))
|
williamr@2
|
331 |
|
williamr@2
|
332 |
#define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \
|
williamr@2
|
333 |
des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))
|
williamr@2
|
334 |
|
williamr@2
|
335 |
#define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \
|
williamr@2
|
336 |
des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e))
|
williamr@2
|
337 |
|
williamr@2
|
338 |
#define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \
|
williamr@2
|
339 |
des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))
|
williamr@2
|
340 |
|
williamr@2
|
341 |
#define des_check_key DES_check_key
|
williamr@2
|
342 |
#define des_rw_mode DES_rw_mode
|
williamr@2
|
343 |
#endif
|
williamr@2
|
344 |
|
williamr@2
|
345 |
IMPORT_C const char *_ossl_old_des_options(void);
|
williamr@2
|
346 |
IMPORT_C void _ossl_old_des_ecb3_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,
|
williamr@2
|
347 |
_ossl_old_des_key_schedule ks1,_ossl_old_des_key_schedule ks2,
|
williamr@2
|
348 |
_ossl_old_des_key_schedule ks3, int enc);
|
williamr@2
|
349 |
IMPORT_C DES_LONG _ossl_old_des_cbc_cksum(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,
|
williamr@2
|
350 |
long length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec);
|
williamr@2
|
351 |
IMPORT_C void _ossl_old_des_cbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length,
|
williamr@2
|
352 |
_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc);
|
williamr@2
|
353 |
IMPORT_C void _ossl_old_des_ncbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length,
|
williamr@2
|
354 |
_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc);
|
williamr@2
|
355 |
IMPORT_C void _ossl_old_des_xcbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length,
|
williamr@2
|
356 |
_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,
|
williamr@2
|
357 |
_ossl_old_des_cblock *inw,_ossl_old_des_cblock *outw,int enc);
|
williamr@2
|
358 |
IMPORT_C void _ossl_old_des_cfb_encrypt(unsigned char *in,unsigned char *out,int numbits,
|
williamr@2
|
359 |
long length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc);
|
williamr@2
|
360 |
IMPORT_C void _ossl_old_des_ecb_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,
|
williamr@2
|
361 |
_ossl_old_des_key_schedule ks,int enc);
|
williamr@2
|
362 |
IMPORT_C void _ossl_old_des_encrypt(DES_LONG *data,_ossl_old_des_key_schedule ks, int enc);
|
williamr@2
|
363 |
IMPORT_C void _ossl_old_des_encrypt2(DES_LONG *data,_ossl_old_des_key_schedule ks, int enc);
|
williamr@2
|
364 |
IMPORT_C void _ossl_old_des_encrypt3(DES_LONG *data, _ossl_old_des_key_schedule ks1,
|
williamr@2
|
365 |
_ossl_old_des_key_schedule ks2, _ossl_old_des_key_schedule ks3);
|
williamr@2
|
366 |
IMPORT_C void _ossl_old_des_decrypt3(DES_LONG *data, _ossl_old_des_key_schedule ks1,
|
williamr@2
|
367 |
_ossl_old_des_key_schedule ks2, _ossl_old_des_key_schedule ks3);
|
williamr@2
|
368 |
IMPORT_C void _ossl_old_des_ede3_cbc_encrypt(_ossl_old_des_cblock *input, _ossl_old_des_cblock *output,
|
williamr@2
|
369 |
long length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2,
|
williamr@2
|
370 |
_ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int enc);
|
williamr@2
|
371 |
IMPORT_C void _ossl_old_des_ede3_cfb64_encrypt(unsigned char *in, unsigned char *out,
|
williamr@2
|
372 |
long length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2,
|
williamr@2
|
373 |
_ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num, int enc);
|
williamr@2
|
374 |
IMPORT_C void _ossl_old_des_ede3_ofb64_encrypt(unsigned char *in, unsigned char *out,
|
williamr@2
|
375 |
long length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2,
|
williamr@2
|
376 |
_ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num);
|
williamr@2
|
377 |
|
williamr@2
|
378 |
IMPORT_C void _ossl_old_des_xwhite_in2out(_ossl_old_des_cblock (*des_key), _ossl_old_des_cblock (*in_white),
|
williamr@2
|
379 |
_ossl_old_des_cblock (*out_white));
|
williamr@2
|
380 |
|
williamr@2
|
381 |
IMPORT_C int _ossl_old_des_enc_read(int fd,char *buf,int len,_ossl_old_des_key_schedule sched,
|
williamr@2
|
382 |
_ossl_old_des_cblock *iv);
|
williamr@2
|
383 |
IMPORT_C int _ossl_old_des_enc_write(int fd,char *buf,int len,_ossl_old_des_key_schedule sched,
|
williamr@2
|
384 |
_ossl_old_des_cblock *iv);
|
williamr@2
|
385 |
IMPORT_C char *_ossl_old_des_fcrypt(const char *buf,const char *salt, char *ret);
|
williamr@2
|
386 |
IMPORT_C char *_ossl_old_des_crypt(const char *buf,const char *salt);
|
williamr@2
|
387 |
#if !defined(PERL5) && !defined(NeXT)
|
williamr@2
|
388 |
IMPORT_C char *_ossl_old_crypt(const char *buf,const char *salt);
|
williamr@2
|
389 |
#endif
|
williamr@2
|
390 |
IMPORT_C void _ossl_old_des_ofb_encrypt(unsigned char *in,unsigned char *out,
|
williamr@2
|
391 |
int numbits,long length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec);
|
williamr@2
|
392 |
IMPORT_C void _ossl_old_des_pcbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length,
|
williamr@2
|
393 |
_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc);
|
williamr@2
|
394 |
IMPORT_C DES_LONG _ossl_old_des_quad_cksum(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,
|
williamr@2
|
395 |
long length,int out_count,_ossl_old_des_cblock *seed);
|
williamr@2
|
396 |
IMPORT_C void _ossl_old_des_random_seed(_ossl_old_des_cblock key);
|
williamr@2
|
397 |
IMPORT_C void _ossl_old_des_random_key(_ossl_old_des_cblock ret);
|
williamr@2
|
398 |
IMPORT_C int _ossl_old_des_read_password(_ossl_old_des_cblock *key,const char *prompt,int verify);
|
williamr@2
|
399 |
IMPORT_C int _ossl_old_des_read_2passwords(_ossl_old_des_cblock *key1,_ossl_old_des_cblock *key2,
|
williamr@2
|
400 |
const char *prompt,int verify);
|
williamr@2
|
401 |
IMPORT_C void _ossl_old_des_set_odd_parity(_ossl_old_des_cblock *key);
|
williamr@2
|
402 |
IMPORT_C int _ossl_old_des_is_weak_key(_ossl_old_des_cblock *key);
|
williamr@2
|
403 |
IMPORT_C int _ossl_old_des_set_key(_ossl_old_des_cblock *key,_ossl_old_des_key_schedule schedule);
|
williamr@2
|
404 |
IMPORT_C int _ossl_old_des_key_sched(_ossl_old_des_cblock *key,_ossl_old_des_key_schedule schedule);
|
williamr@2
|
405 |
IMPORT_C void _ossl_old_des_string_to_key(char *str,_ossl_old_des_cblock *key);
|
williamr@2
|
406 |
IMPORT_C void _ossl_old_des_string_to_2keys(char *str,_ossl_old_des_cblock *key1,_ossl_old_des_cblock *key2);
|
williamr@2
|
407 |
IMPORT_C void _ossl_old_des_cfb64_encrypt(unsigned char *in, unsigned char *out, long length,
|
williamr@2
|
408 |
_ossl_old_des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num, int enc);
|
williamr@2
|
409 |
IMPORT_C void _ossl_old_des_ofb64_encrypt(unsigned char *in, unsigned char *out, long length,
|
williamr@2
|
410 |
_ossl_old_des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num);
|
williamr@2
|
411 |
|
williamr@2
|
412 |
IMPORT_C void _ossl_096_des_random_seed(des_cblock *key);
|
williamr@2
|
413 |
|
williamr@2
|
414 |
/* The following definitions provide compatibility with the MIT Kerberos
|
williamr@2
|
415 |
* library. The _ossl_old_des_key_schedule structure is not binary compatible. */
|
williamr@2
|
416 |
|
williamr@2
|
417 |
#define _KERBEROS_DES_H
|
williamr@2
|
418 |
|
williamr@2
|
419 |
#define KRBDES_ENCRYPT DES_ENCRYPT
|
williamr@2
|
420 |
#define KRBDES_DECRYPT DES_DECRYPT
|
williamr@2
|
421 |
|
williamr@2
|
422 |
#ifdef KERBEROS
|
williamr@2
|
423 |
# define ENCRYPT DES_ENCRYPT
|
williamr@2
|
424 |
# define DECRYPT DES_DECRYPT
|
williamr@2
|
425 |
#endif
|
williamr@2
|
426 |
|
williamr@2
|
427 |
#ifndef NCOMPAT
|
williamr@2
|
428 |
# define C_Block des_cblock
|
williamr@2
|
429 |
# define Key_schedule des_key_schedule
|
williamr@2
|
430 |
# define KEY_SZ DES_KEY_SZ
|
williamr@2
|
431 |
# define string_to_key des_string_to_key
|
williamr@2
|
432 |
# define read_pw_string des_read_pw_string
|
williamr@2
|
433 |
# define random_key des_random_key
|
williamr@2
|
434 |
# define pcbc_encrypt des_pcbc_encrypt
|
williamr@2
|
435 |
# define set_key des_set_key
|
williamr@2
|
436 |
# define key_sched des_key_sched
|
williamr@2
|
437 |
# define ecb_encrypt des_ecb_encrypt
|
williamr@2
|
438 |
# define cbc_encrypt des_cbc_encrypt
|
williamr@2
|
439 |
# define ncbc_encrypt des_ncbc_encrypt
|
williamr@2
|
440 |
# define xcbc_encrypt des_xcbc_encrypt
|
williamr@2
|
441 |
# define cbc_cksum des_cbc_cksum
|
williamr@2
|
442 |
# define quad_cksum des_quad_cksum
|
williamr@2
|
443 |
# define check_parity des_check_key_parity
|
williamr@2
|
444 |
#endif
|
williamr@2
|
445 |
|
williamr@2
|
446 |
#define des_fixup_key_parity DES_fixup_key_parity
|
williamr@2
|
447 |
|
williamr@2
|
448 |
#ifdef __cplusplus
|
williamr@2
|
449 |
}
|
williamr@2
|
450 |
#endif
|
williamr@2
|
451 |
|
williamr@2
|
452 |
/* for DES_read_pw_string et al */
|
williamr@2
|
453 |
#include <openssl/ui_compat.h>
|
williamr@2
|
454 |
|
williamr@2
|
455 |
#endif
|