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