1295009Sjkim/* crypto/des/des_old.h */ 2109998Smarkm 3280297Sjkim/*- 4280297Sjkim * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING 5109998Smarkm * 6109998Smarkm * The function names in here are deprecated and are only present to 7109998Smarkm * provide an interface compatible with openssl 0.9.6 and older as 8109998Smarkm * well as libdes. OpenSSL now provides functions where "des_" has 9109998Smarkm * been replaced with "DES_" in the names, to make it possible to 10109998Smarkm * make incompatible changes that are needed for C type security and 11109998Smarkm * other stuff. 12109998Smarkm * 13109998Smarkm * This include files has two compatibility modes: 14109998Smarkm * 15109998Smarkm * - If OPENSSL_DES_LIBDES_COMPATIBILITY is defined, you get an API 16109998Smarkm * that is compatible with libdes and SSLeay. 17109998Smarkm * - If OPENSSL_DES_LIBDES_COMPATIBILITY isn't defined, you get an 18109998Smarkm * API that is compatible with OpenSSL 0.9.5x to 0.9.6x. 19109998Smarkm * 20109998Smarkm * Note that these modes break earlier snapshots of OpenSSL, where 21109998Smarkm * libdes compatibility was the only available mode or (later on) the 22109998Smarkm * prefered compatibility mode. However, after much consideration 23109998Smarkm * (and more or less violent discussions with external parties), it 24109998Smarkm * was concluded that OpenSSL should be compatible with earlier versions 25109998Smarkm * of itself before anything else. Also, in all honesty, libdes is 26109998Smarkm * an old beast that shouldn't really be used any more. 27109998Smarkm * 28109998Smarkm * Please consider starting to use the DES_ functions rather than the 29109998Smarkm * des_ ones. The des_ functions will disappear completely before 30109998Smarkm * OpenSSL 1.0! 31109998Smarkm * 32109998Smarkm * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING 33109998Smarkm */ 34109998Smarkm 35280297Sjkim/* 36280297Sjkim * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project 37280297Sjkim * 2001. 38109998Smarkm */ 39109998Smarkm/* ==================================================================== 40109998Smarkm * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. 41109998Smarkm * 42109998Smarkm * Redistribution and use in source and binary forms, with or without 43109998Smarkm * modification, are permitted provided that the following conditions 44109998Smarkm * are met: 45109998Smarkm * 46109998Smarkm * 1. Redistributions of source code must retain the above copyright 47280297Sjkim * notice, this list of conditions and the following disclaimer. 48109998Smarkm * 49109998Smarkm * 2. Redistributions in binary form must reproduce the above copyright 50109998Smarkm * notice, this list of conditions and the following disclaimer in 51109998Smarkm * the documentation and/or other materials provided with the 52109998Smarkm * distribution. 53109998Smarkm * 54109998Smarkm * 3. All advertising materials mentioning features or use of this 55109998Smarkm * software must display the following acknowledgment: 56109998Smarkm * "This product includes software developed by the OpenSSL Project 57109998Smarkm * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 58109998Smarkm * 59109998Smarkm * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 60109998Smarkm * endorse or promote products derived from this software without 61109998Smarkm * prior written permission. For written permission, please contact 62109998Smarkm * openssl-core@openssl.org. 63109998Smarkm * 64109998Smarkm * 5. Products derived from this software may not be called "OpenSSL" 65109998Smarkm * nor may "OpenSSL" appear in their names without prior written 66109998Smarkm * permission of the OpenSSL Project. 67109998Smarkm * 68109998Smarkm * 6. Redistributions of any form whatsoever must retain the following 69109998Smarkm * acknowledgment: 70109998Smarkm * "This product includes software developed by the OpenSSL Project 71109998Smarkm * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 72109998Smarkm * 73109998Smarkm * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 74109998Smarkm * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 75109998Smarkm * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 76109998Smarkm * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 77109998Smarkm * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 78109998Smarkm * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 79109998Smarkm * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 80109998Smarkm * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 81109998Smarkm * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 82109998Smarkm * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 83109998Smarkm * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 84109998Smarkm * OF THE POSSIBILITY OF SUCH DAMAGE. 85109998Smarkm * ==================================================================== 86109998Smarkm * 87109998Smarkm * This product includes cryptographic software written by Eric Young 88109998Smarkm * (eay@cryptsoft.com). This product includes software written by Tim 89109998Smarkm * Hudson (tjh@cryptsoft.com). 90109998Smarkm * 91109998Smarkm */ 92109998Smarkm 93109998Smarkm#ifndef HEADER_DES_H 94280297Sjkim# define HEADER_DES_H 95109998Smarkm 96280297Sjkim# include <openssl/e_os2.h> /* OPENSSL_EXTERN, OPENSSL_NO_DES, DES_LONG */ 97160814Ssimon 98280297Sjkim# ifdef OPENSSL_NO_DES 99280297Sjkim# error DES is disabled. 100280297Sjkim# endif 101109998Smarkm 102280297Sjkim# ifndef HEADER_NEW_DES_H 103280297Sjkim# error You must include des.h, not des_old.h directly. 104280297Sjkim# endif 105109998Smarkm 106280297Sjkim# ifdef _KERBEROS_DES_H 107280297Sjkim# error <openssl/des_old.h> replaces <kerberos/des.h>. 108280297Sjkim# endif 109109998Smarkm 110280297Sjkim# include <openssl/symhacks.h> 111109998Smarkm 112280297Sjkim# ifdef OPENSSL_BUILD_SHLIBCRYPTO 113280297Sjkim# undef OPENSSL_EXTERN 114280297Sjkim# define OPENSSL_EXTERN OPENSSL_EXPORT 115280297Sjkim# endif 116109998Smarkm 117109998Smarkm#ifdef __cplusplus 118109998Smarkmextern "C" { 119109998Smarkm#endif 120109998Smarkm 121280297Sjkim# ifdef _ 122280297Sjkim# undef _ 123280297Sjkim# endif 124160814Ssimon 125109998Smarkmtypedef unsigned char _ossl_old_des_cblock[8]; 126280297Sjkimtypedef struct _ossl_old_des_ks_struct { 127280297Sjkim union { 128280297Sjkim _ossl_old_des_cblock _; 129280297Sjkim /* 130280297Sjkim * make sure things are correct size on machines with 8 byte longs 131280297Sjkim */ 132280297Sjkim DES_LONG pad[2]; 133280297Sjkim } ks; 134280297Sjkim} _ossl_old_des_key_schedule[16]; 135109998Smarkm 136280297Sjkim# ifndef OPENSSL_DES_LIBDES_COMPATIBILITY 137280297Sjkim# define des_cblock DES_cblock 138280297Sjkim# define const_des_cblock const_DES_cblock 139280297Sjkim# define des_key_schedule DES_key_schedule 140280297Sjkim# define des_ecb3_encrypt(i,o,k1,k2,k3,e)\ 141280297Sjkim DES_ecb3_encrypt((i),(o),&(k1),&(k2),&(k3),(e)) 142280297Sjkim# define des_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e)\ 143280297Sjkim DES_ede3_cbc_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(e)) 144280297Sjkim# define des_ede3_cbcm_encrypt(i,o,l,k1,k2,k3,iv1,iv2,e)\ 145280297Sjkim DES_ede3_cbcm_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv1),(iv2),(e)) 146280297Sjkim# define des_ede3_cfb64_encrypt(i,o,l,k1,k2,k3,iv,n,e)\ 147280297Sjkim DES_ede3_cfb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n),(e)) 148280297Sjkim# define des_ede3_ofb64_encrypt(i,o,l,k1,k2,k3,iv,n)\ 149280297Sjkim DES_ede3_ofb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n)) 150280297Sjkim# define des_options()\ 151280297Sjkim DES_options() 152280297Sjkim# define des_cbc_cksum(i,o,l,k,iv)\ 153280297Sjkim DES_cbc_cksum((i),(o),(l),&(k),(iv)) 154280297Sjkim# define des_cbc_encrypt(i,o,l,k,iv,e)\ 155280297Sjkim DES_cbc_encrypt((i),(o),(l),&(k),(iv),(e)) 156280297Sjkim# define des_ncbc_encrypt(i,o,l,k,iv,e)\ 157280297Sjkim DES_ncbc_encrypt((i),(o),(l),&(k),(iv),(e)) 158280297Sjkim# define des_xcbc_encrypt(i,o,l,k,iv,inw,outw,e)\ 159280297Sjkim DES_xcbc_encrypt((i),(o),(l),&(k),(iv),(inw),(outw),(e)) 160280297Sjkim# define des_cfb_encrypt(i,o,n,l,k,iv,e)\ 161280297Sjkim DES_cfb_encrypt((i),(o),(n),(l),&(k),(iv),(e)) 162280297Sjkim# define des_ecb_encrypt(i,o,k,e)\ 163280297Sjkim DES_ecb_encrypt((i),(o),&(k),(e)) 164280297Sjkim# define des_encrypt1(d,k,e)\ 165280297Sjkim DES_encrypt1((d),&(k),(e)) 166280297Sjkim# define des_encrypt2(d,k,e)\ 167280297Sjkim DES_encrypt2((d),&(k),(e)) 168280297Sjkim# define des_encrypt3(d,k1,k2,k3)\ 169280297Sjkim DES_encrypt3((d),&(k1),&(k2),&(k3)) 170280297Sjkim# define des_decrypt3(d,k1,k2,k3)\ 171280297Sjkim DES_decrypt3((d),&(k1),&(k2),&(k3)) 172280297Sjkim# define des_xwhite_in2out(k,i,o)\ 173280297Sjkim DES_xwhite_in2out((k),(i),(o)) 174280297Sjkim# define des_enc_read(f,b,l,k,iv)\ 175280297Sjkim DES_enc_read((f),(b),(l),&(k),(iv)) 176280297Sjkim# define des_enc_write(f,b,l,k,iv)\ 177280297Sjkim DES_enc_write((f),(b),(l),&(k),(iv)) 178280297Sjkim# define des_fcrypt(b,s,r)\ 179280297Sjkim DES_fcrypt((b),(s),(r)) 180280297Sjkim# if 0 181280297Sjkim# define des_crypt(b,s)\ 182280297Sjkim DES_crypt((b),(s)) 183280297Sjkim# if !defined(PERL5) && !defined(__FreeBSD__) && !defined(NeXT) && !defined(__OpenBSD__) 184280297Sjkim# define crypt(b,s)\ 185280297Sjkim DES_crypt((b),(s)) 186280297Sjkim# endif 187280297Sjkim# endif 188280297Sjkim# define des_ofb_encrypt(i,o,n,l,k,iv)\ 189280297Sjkim DES_ofb_encrypt((i),(o),(n),(l),&(k),(iv)) 190280297Sjkim# define des_pcbc_encrypt(i,o,l,k,iv,e)\ 191280297Sjkim DES_pcbc_encrypt((i),(o),(l),&(k),(iv),(e)) 192280297Sjkim# define des_quad_cksum(i,o,l,c,s)\ 193280297Sjkim DES_quad_cksum((i),(o),(l),(c),(s)) 194280297Sjkim# define des_random_seed(k)\ 195280297Sjkim _ossl_096_des_random_seed((k)) 196280297Sjkim# define des_random_key(r)\ 197280297Sjkim DES_random_key((r)) 198280297Sjkim# define des_read_password(k,p,v) \ 199280297Sjkim DES_read_password((k),(p),(v)) 200280297Sjkim# define des_read_2passwords(k1,k2,p,v) \ 201280297Sjkim DES_read_2passwords((k1),(k2),(p),(v)) 202280297Sjkim# define des_set_odd_parity(k)\ 203280297Sjkim DES_set_odd_parity((k)) 204280297Sjkim# define des_check_key_parity(k)\ 205280297Sjkim DES_check_key_parity((k)) 206280297Sjkim# define des_is_weak_key(k)\ 207280297Sjkim DES_is_weak_key((k)) 208280297Sjkim# define des_set_key(k,ks)\ 209280297Sjkim DES_set_key((k),&(ks)) 210280297Sjkim# define des_key_sched(k,ks)\ 211280297Sjkim DES_key_sched((k),&(ks)) 212280297Sjkim# define des_set_key_checked(k,ks)\ 213280297Sjkim DES_set_key_checked((k),&(ks)) 214280297Sjkim# define des_set_key_unchecked(k,ks)\ 215280297Sjkim DES_set_key_unchecked((k),&(ks)) 216280297Sjkim# define des_string_to_key(s,k)\ 217280297Sjkim DES_string_to_key((s),(k)) 218280297Sjkim# define des_string_to_2keys(s,k1,k2)\ 219280297Sjkim DES_string_to_2keys((s),(k1),(k2)) 220280297Sjkim# define des_cfb64_encrypt(i,o,l,ks,iv,n,e)\ 221280297Sjkim DES_cfb64_encrypt((i),(o),(l),&(ks),(iv),(n),(e)) 222280297Sjkim# define des_ofb64_encrypt(i,o,l,ks,iv,n)\ 223280297Sjkim DES_ofb64_encrypt((i),(o),(l),&(ks),(iv),(n)) 224109998Smarkm 225280297Sjkim# define des_ecb2_encrypt(i,o,k1,k2,e) \ 226280297Sjkim des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e)) 227109998Smarkm 228280297Sjkim# define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \ 229280297Sjkim des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e)) 230109998Smarkm 231280297Sjkim# define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \ 232280297Sjkim des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e)) 233109998Smarkm 234280297Sjkim# define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \ 235280297Sjkim des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n)) 236109998Smarkm 237280297Sjkim# define des_check_key DES_check_key 238280297Sjkim# define des_rw_mode DES_rw_mode 239280297Sjkim# else /* libdes compatibility */ 240280297Sjkim/* 241280297Sjkim * Map all symbol names to _ossl_old_des_* form, so we avoid all clashes with 242280297Sjkim * libdes 243280297Sjkim */ 244280297Sjkim# define des_cblock _ossl_old_des_cblock 245280297Sjkim# define des_key_schedule _ossl_old_des_key_schedule 246280297Sjkim# define des_ecb3_encrypt(i,o,k1,k2,k3,e)\ 247280297Sjkim _ossl_old_des_ecb3_encrypt((i),(o),(k1),(k2),(k3),(e)) 248280297Sjkim# define des_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e)\ 249280297Sjkim _ossl_old_des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(e)) 250280297Sjkim# define des_ede3_cfb64_encrypt(i,o,l,k1,k2,k3,iv,n,e)\ 251280297Sjkim _ossl_old_des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n),(e)) 252280297Sjkim# define des_ede3_ofb64_encrypt(i,o,l,k1,k2,k3,iv,n)\ 253280297Sjkim _ossl_old_des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n)) 254280297Sjkim# define des_options()\ 255280297Sjkim _ossl_old_des_options() 256280297Sjkim# define des_cbc_cksum(i,o,l,k,iv)\ 257280297Sjkim _ossl_old_des_cbc_cksum((i),(o),(l),(k),(iv)) 258280297Sjkim# define des_cbc_encrypt(i,o,l,k,iv,e)\ 259280297Sjkim _ossl_old_des_cbc_encrypt((i),(o),(l),(k),(iv),(e)) 260280297Sjkim# define des_ncbc_encrypt(i,o,l,k,iv,e)\ 261280297Sjkim _ossl_old_des_ncbc_encrypt((i),(o),(l),(k),(iv),(e)) 262280297Sjkim# define des_xcbc_encrypt(i,o,l,k,iv,inw,outw,e)\ 263280297Sjkim _ossl_old_des_xcbc_encrypt((i),(o),(l),(k),(iv),(inw),(outw),(e)) 264280297Sjkim# define des_cfb_encrypt(i,o,n,l,k,iv,e)\ 265280297Sjkim _ossl_old_des_cfb_encrypt((i),(o),(n),(l),(k),(iv),(e)) 266280297Sjkim# define des_ecb_encrypt(i,o,k,e)\ 267280297Sjkim _ossl_old_des_ecb_encrypt((i),(o),(k),(e)) 268280297Sjkim# define des_encrypt(d,k,e)\ 269280297Sjkim _ossl_old_des_encrypt((d),(k),(e)) 270280297Sjkim# define des_encrypt2(d,k,e)\ 271280297Sjkim _ossl_old_des_encrypt2((d),(k),(e)) 272280297Sjkim# define des_encrypt3(d,k1,k2,k3)\ 273280297Sjkim _ossl_old_des_encrypt3((d),(k1),(k2),(k3)) 274280297Sjkim# define des_decrypt3(d,k1,k2,k3)\ 275280297Sjkim _ossl_old_des_decrypt3((d),(k1),(k2),(k3)) 276280297Sjkim# define des_xwhite_in2out(k,i,o)\ 277280297Sjkim _ossl_old_des_xwhite_in2out((k),(i),(o)) 278280297Sjkim# define des_enc_read(f,b,l,k,iv)\ 279280297Sjkim _ossl_old_des_enc_read((f),(b),(l),(k),(iv)) 280280297Sjkim# define des_enc_write(f,b,l,k,iv)\ 281280297Sjkim _ossl_old_des_enc_write((f),(b),(l),(k),(iv)) 282280297Sjkim# define des_fcrypt(b,s,r)\ 283280297Sjkim _ossl_old_des_fcrypt((b),(s),(r)) 284280297Sjkim# define des_crypt(b,s)\ 285280297Sjkim _ossl_old_des_crypt((b),(s)) 286280297Sjkim# if 0 287280297Sjkim# define crypt(b,s)\ 288280297Sjkim _ossl_old_crypt((b),(s)) 289280297Sjkim# endif 290280297Sjkim# define des_ofb_encrypt(i,o,n,l,k,iv)\ 291280297Sjkim _ossl_old_des_ofb_encrypt((i),(o),(n),(l),(k),(iv)) 292280297Sjkim# define des_pcbc_encrypt(i,o,l,k,iv,e)\ 293280297Sjkim _ossl_old_des_pcbc_encrypt((i),(o),(l),(k),(iv),(e)) 294280297Sjkim# define des_quad_cksum(i,o,l,c,s)\ 295280297Sjkim _ossl_old_des_quad_cksum((i),(o),(l),(c),(s)) 296280297Sjkim# define des_random_seed(k)\ 297280297Sjkim _ossl_old_des_random_seed((k)) 298280297Sjkim# define des_random_key(r)\ 299280297Sjkim _ossl_old_des_random_key((r)) 300280297Sjkim# define des_read_password(k,p,v) \ 301280297Sjkim _ossl_old_des_read_password((k),(p),(v)) 302280297Sjkim# define des_read_2passwords(k1,k2,p,v) \ 303280297Sjkim _ossl_old_des_read_2passwords((k1),(k2),(p),(v)) 304280297Sjkim# define des_set_odd_parity(k)\ 305280297Sjkim _ossl_old_des_set_odd_parity((k)) 306280297Sjkim# define des_is_weak_key(k)\ 307280297Sjkim _ossl_old_des_is_weak_key((k)) 308280297Sjkim# define des_set_key(k,ks)\ 309280297Sjkim _ossl_old_des_set_key((k),(ks)) 310280297Sjkim# define des_key_sched(k,ks)\ 311280297Sjkim _ossl_old_des_key_sched((k),(ks)) 312280297Sjkim# define des_string_to_key(s,k)\ 313280297Sjkim _ossl_old_des_string_to_key((s),(k)) 314280297Sjkim# define des_string_to_2keys(s,k1,k2)\ 315280297Sjkim _ossl_old_des_string_to_2keys((s),(k1),(k2)) 316280297Sjkim# define des_cfb64_encrypt(i,o,l,ks,iv,n,e)\ 317280297Sjkim _ossl_old_des_cfb64_encrypt((i),(o),(l),(ks),(iv),(n),(e)) 318280297Sjkim# define des_ofb64_encrypt(i,o,l,ks,iv,n)\ 319280297Sjkim _ossl_old_des_ofb64_encrypt((i),(o),(l),(ks),(iv),(n)) 320109998Smarkm 321280297Sjkim# define des_ecb2_encrypt(i,o,k1,k2,e) \ 322280297Sjkim des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e)) 323109998Smarkm 324280297Sjkim# define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \ 325280297Sjkim des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e)) 326109998Smarkm 327280297Sjkim# define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \ 328280297Sjkim des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e)) 329109998Smarkm 330280297Sjkim# define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \ 331280297Sjkim des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n)) 332109998Smarkm 333280297Sjkim# define des_check_key DES_check_key 334280297Sjkim# define des_rw_mode DES_rw_mode 335280297Sjkim# endif 336109998Smarkm 337109998Smarkmconst char *_ossl_old_des_options(void); 338280297Sjkimvoid _ossl_old_des_ecb3_encrypt(_ossl_old_des_cblock *input, 339280297Sjkim _ossl_old_des_cblock *output, 340280297Sjkim _ossl_old_des_key_schedule ks1, 341280297Sjkim _ossl_old_des_key_schedule ks2, 342280297Sjkim _ossl_old_des_key_schedule ks3, int enc); 343280297SjkimDES_LONG _ossl_old_des_cbc_cksum(_ossl_old_des_cblock *input, 344280297Sjkim _ossl_old_des_cblock *output, long length, 345280297Sjkim _ossl_old_des_key_schedule schedule, 346280297Sjkim _ossl_old_des_cblock *ivec); 347280297Sjkimvoid _ossl_old_des_cbc_encrypt(_ossl_old_des_cblock *input, 348280297Sjkim _ossl_old_des_cblock *output, long length, 349280297Sjkim _ossl_old_des_key_schedule schedule, 350280297Sjkim _ossl_old_des_cblock *ivec, int enc); 351280297Sjkimvoid _ossl_old_des_ncbc_encrypt(_ossl_old_des_cblock *input, 352280297Sjkim _ossl_old_des_cblock *output, long length, 353280297Sjkim _ossl_old_des_key_schedule schedule, 354280297Sjkim _ossl_old_des_cblock *ivec, int enc); 355280297Sjkimvoid _ossl_old_des_xcbc_encrypt(_ossl_old_des_cblock *input, 356280297Sjkim _ossl_old_des_cblock *output, long length, 357280297Sjkim _ossl_old_des_key_schedule schedule, 358280297Sjkim _ossl_old_des_cblock *ivec, 359280297Sjkim _ossl_old_des_cblock *inw, 360280297Sjkim _ossl_old_des_cblock *outw, int enc); 361280297Sjkimvoid _ossl_old_des_cfb_encrypt(unsigned char *in, unsigned char *out, 362280297Sjkim int numbits, long length, 363280297Sjkim _ossl_old_des_key_schedule schedule, 364280297Sjkim _ossl_old_des_cblock *ivec, int enc); 365280297Sjkimvoid _ossl_old_des_ecb_encrypt(_ossl_old_des_cblock *input, 366280297Sjkim _ossl_old_des_cblock *output, 367280297Sjkim _ossl_old_des_key_schedule ks, int enc); 368280297Sjkimvoid _ossl_old_des_encrypt(DES_LONG *data, _ossl_old_des_key_schedule ks, 369280297Sjkim int enc); 370280297Sjkimvoid _ossl_old_des_encrypt2(DES_LONG *data, _ossl_old_des_key_schedule ks, 371280297Sjkim int enc); 372109998Smarkmvoid _ossl_old_des_encrypt3(DES_LONG *data, _ossl_old_des_key_schedule ks1, 373280297Sjkim _ossl_old_des_key_schedule ks2, 374280297Sjkim _ossl_old_des_key_schedule ks3); 375109998Smarkmvoid _ossl_old_des_decrypt3(DES_LONG *data, _ossl_old_des_key_schedule ks1, 376280297Sjkim _ossl_old_des_key_schedule ks2, 377280297Sjkim _ossl_old_des_key_schedule ks3); 378280297Sjkimvoid _ossl_old_des_ede3_cbc_encrypt(_ossl_old_des_cblock *input, 379280297Sjkim _ossl_old_des_cblock *output, long length, 380280297Sjkim _ossl_old_des_key_schedule ks1, 381280297Sjkim _ossl_old_des_key_schedule ks2, 382280297Sjkim _ossl_old_des_key_schedule ks3, 383280297Sjkim _ossl_old_des_cblock *ivec, int enc); 384109998Smarkmvoid _ossl_old_des_ede3_cfb64_encrypt(unsigned char *in, unsigned char *out, 385280297Sjkim long length, 386280297Sjkim _ossl_old_des_key_schedule ks1, 387280297Sjkim _ossl_old_des_key_schedule ks2, 388280297Sjkim _ossl_old_des_key_schedule ks3, 389280297Sjkim _ossl_old_des_cblock *ivec, int *num, 390280297Sjkim int enc); 391109998Smarkmvoid _ossl_old_des_ede3_ofb64_encrypt(unsigned char *in, unsigned char *out, 392280297Sjkim long length, 393280297Sjkim _ossl_old_des_key_schedule ks1, 394280297Sjkim _ossl_old_des_key_schedule ks2, 395280297Sjkim _ossl_old_des_key_schedule ks3, 396280297Sjkim _ossl_old_des_cblock *ivec, int *num); 397280297Sjkim# if 0 398280297Sjkimvoid _ossl_old_des_xwhite_in2out(_ossl_old_des_cblock (*des_key), 399280297Sjkim _ossl_old_des_cblock (*in_white), 400280297Sjkim _ossl_old_des_cblock (*out_white)); 401280297Sjkim# endif 402109998Smarkm 403280297Sjkimint _ossl_old_des_enc_read(int fd, char *buf, int len, 404280297Sjkim _ossl_old_des_key_schedule sched, 405280297Sjkim _ossl_old_des_cblock *iv); 406280297Sjkimint _ossl_old_des_enc_write(int fd, char *buf, int len, 407280297Sjkim _ossl_old_des_key_schedule sched, 408280297Sjkim _ossl_old_des_cblock *iv); 409280297Sjkimchar *_ossl_old_des_fcrypt(const char *buf, const char *salt, char *ret); 410280297Sjkimchar *_ossl_old_des_crypt(const char *buf, const char *salt); 411280297Sjkim# if !defined(PERL5) && !defined(NeXT) 412280297Sjkimchar *_ossl_old_crypt(const char *buf, const char *salt); 413280297Sjkim# endif 414280297Sjkimvoid _ossl_old_des_ofb_encrypt(unsigned char *in, unsigned char *out, 415280297Sjkim int numbits, long length, 416280297Sjkim _ossl_old_des_key_schedule schedule, 417280297Sjkim _ossl_old_des_cblock *ivec); 418280297Sjkimvoid _ossl_old_des_pcbc_encrypt(_ossl_old_des_cblock *input, 419280297Sjkim _ossl_old_des_cblock *output, long length, 420280297Sjkim _ossl_old_des_key_schedule schedule, 421280297Sjkim _ossl_old_des_cblock *ivec, int enc); 422280297SjkimDES_LONG _ossl_old_des_quad_cksum(_ossl_old_des_cblock *input, 423280297Sjkim _ossl_old_des_cblock *output, long length, 424280297Sjkim int out_count, _ossl_old_des_cblock *seed); 425109998Smarkmvoid _ossl_old_des_random_seed(_ossl_old_des_cblock key); 426109998Smarkmvoid _ossl_old_des_random_key(_ossl_old_des_cblock ret); 427280297Sjkimint _ossl_old_des_read_password(_ossl_old_des_cblock *key, const char *prompt, 428280297Sjkim int verify); 429280297Sjkimint _ossl_old_des_read_2passwords(_ossl_old_des_cblock *key1, 430280297Sjkim _ossl_old_des_cblock *key2, 431280297Sjkim const char *prompt, int verify); 432109998Smarkmvoid _ossl_old_des_set_odd_parity(_ossl_old_des_cblock *key); 433109998Smarkmint _ossl_old_des_is_weak_key(_ossl_old_des_cblock *key); 434280297Sjkimint _ossl_old_des_set_key(_ossl_old_des_cblock *key, 435280297Sjkim _ossl_old_des_key_schedule schedule); 436280297Sjkimint _ossl_old_des_key_sched(_ossl_old_des_cblock *key, 437280297Sjkim _ossl_old_des_key_schedule schedule); 438280297Sjkimvoid _ossl_old_des_string_to_key(char *str, _ossl_old_des_cblock *key); 439280297Sjkimvoid _ossl_old_des_string_to_2keys(char *str, _ossl_old_des_cblock *key1, 440280297Sjkim _ossl_old_des_cblock *key2); 441280297Sjkimvoid _ossl_old_des_cfb64_encrypt(unsigned char *in, unsigned char *out, 442280297Sjkim long length, 443280297Sjkim _ossl_old_des_key_schedule schedule, 444280297Sjkim _ossl_old_des_cblock *ivec, int *num, 445280297Sjkim int enc); 446280297Sjkimvoid _ossl_old_des_ofb64_encrypt(unsigned char *in, unsigned char *out, 447280297Sjkim long length, 448280297Sjkim _ossl_old_des_key_schedule schedule, 449280297Sjkim _ossl_old_des_cblock *ivec, int *num); 450109998Smarkm 451109998Smarkmvoid _ossl_096_des_random_seed(des_cblock *key); 452109998Smarkm 453280297Sjkim/* 454280297Sjkim * The following definitions provide compatibility with the MIT Kerberos 455280297Sjkim * library. The _ossl_old_des_key_schedule structure is not binary 456280297Sjkim * compatible. 457280297Sjkim */ 458109998Smarkm 459280297Sjkim# define _KERBEROS_DES_H 460109998Smarkm 461280297Sjkim# define KRBDES_ENCRYPT DES_ENCRYPT 462280297Sjkim# define KRBDES_DECRYPT DES_DECRYPT 463109998Smarkm 464280297Sjkim# ifdef KERBEROS 465109998Smarkm# define ENCRYPT DES_ENCRYPT 466109998Smarkm# define DECRYPT DES_DECRYPT 467280297Sjkim# endif 468109998Smarkm 469280297Sjkim# ifndef NCOMPAT 470109998Smarkm# define C_Block des_cblock 471109998Smarkm# define Key_schedule des_key_schedule 472109998Smarkm# define KEY_SZ DES_KEY_SZ 473109998Smarkm# define string_to_key des_string_to_key 474109998Smarkm# define read_pw_string des_read_pw_string 475109998Smarkm# define random_key des_random_key 476109998Smarkm# define pcbc_encrypt des_pcbc_encrypt 477109998Smarkm# define set_key des_set_key 478109998Smarkm# define key_sched des_key_sched 479109998Smarkm# define ecb_encrypt des_ecb_encrypt 480109998Smarkm# define cbc_encrypt des_cbc_encrypt 481109998Smarkm# define ncbc_encrypt des_ncbc_encrypt 482109998Smarkm# define xcbc_encrypt des_xcbc_encrypt 483109998Smarkm# define cbc_cksum des_cbc_cksum 484109998Smarkm# define quad_cksum des_quad_cksum 485109998Smarkm# define check_parity des_check_key_parity 486280297Sjkim# endif 487109998Smarkm 488280297Sjkim# define des_fixup_key_parity DES_fixup_key_parity 489109998Smarkm 490109998Smarkm#ifdef __cplusplus 491109998Smarkm} 492109998Smarkm#endif 493109998Smarkm 494109998Smarkm/* for DES_read_pw_string et al */ 495280297Sjkim# include <openssl/ui_compat.h> 496109998Smarkm 497109998Smarkm#endif 498