1295016Sjkim/* crypto/des/des_old.h */ 2109998Smarkm 3280304Sjkim/*- 4280304Sjkim * 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 35280304Sjkim/* 36280304Sjkim * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project 37280304Sjkim * 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 47280304Sjkim * 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 94280304Sjkim# define HEADER_DES_H 95109998Smarkm 96280304Sjkim# include <openssl/e_os2.h> /* OPENSSL_EXTERN, OPENSSL_NO_DES, DES_LONG */ 97160814Ssimon 98280304Sjkim# ifdef OPENSSL_NO_DES 99280304Sjkim# error DES is disabled. 100280304Sjkim# endif 101109998Smarkm 102280304Sjkim# ifndef HEADER_NEW_DES_H 103280304Sjkim# error You must include des.h, not des_old.h directly. 104280304Sjkim# endif 105109998Smarkm 106280304Sjkim# ifdef _KERBEROS_DES_H 107280304Sjkim# error <openssl/des_old.h> replaces <kerberos/des.h>. 108280304Sjkim# endif 109109998Smarkm 110280304Sjkim# include <openssl/symhacks.h> 111109998Smarkm 112280304Sjkim# ifdef OPENSSL_BUILD_SHLIBCRYPTO 113280304Sjkim# undef OPENSSL_EXTERN 114280304Sjkim# define OPENSSL_EXTERN OPENSSL_EXPORT 115280304Sjkim# endif 116109998Smarkm 117109998Smarkm#ifdef __cplusplus 118109998Smarkmextern "C" { 119109998Smarkm#endif 120109998Smarkm 121280304Sjkim# ifdef _ 122280304Sjkim# undef _ 123280304Sjkim# endif 124160814Ssimon 125109998Smarkmtypedef unsigned char _ossl_old_des_cblock[8]; 126280304Sjkimtypedef struct _ossl_old_des_ks_struct { 127280304Sjkim union { 128280304Sjkim _ossl_old_des_cblock _; 129280304Sjkim /* 130280304Sjkim * make sure things are correct size on machines with 8 byte longs 131280304Sjkim */ 132280304Sjkim DES_LONG pad[2]; 133280304Sjkim } ks; 134280304Sjkim} _ossl_old_des_key_schedule[16]; 135109998Smarkm 136280304Sjkim# ifndef OPENSSL_DES_LIBDES_COMPATIBILITY 137280304Sjkim# define des_cblock DES_cblock 138280304Sjkim# define const_des_cblock const_DES_cblock 139280304Sjkim# define des_key_schedule DES_key_schedule 140280304Sjkim# define des_ecb3_encrypt(i,o,k1,k2,k3,e)\ 141280304Sjkim DES_ecb3_encrypt((i),(o),&(k1),&(k2),&(k3),(e)) 142280304Sjkim# define des_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e)\ 143280304Sjkim DES_ede3_cbc_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(e)) 144280304Sjkim# define des_ede3_cbcm_encrypt(i,o,l,k1,k2,k3,iv1,iv2,e)\ 145280304Sjkim DES_ede3_cbcm_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv1),(iv2),(e)) 146280304Sjkim# define des_ede3_cfb64_encrypt(i,o,l,k1,k2,k3,iv,n,e)\ 147280304Sjkim DES_ede3_cfb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n),(e)) 148280304Sjkim# define des_ede3_ofb64_encrypt(i,o,l,k1,k2,k3,iv,n)\ 149280304Sjkim DES_ede3_ofb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n)) 150280304Sjkim# define des_options()\ 151280304Sjkim DES_options() 152280304Sjkim# define des_cbc_cksum(i,o,l,k,iv)\ 153280304Sjkim DES_cbc_cksum((i),(o),(l),&(k),(iv)) 154280304Sjkim# define des_cbc_encrypt(i,o,l,k,iv,e)\ 155280304Sjkim DES_cbc_encrypt((i),(o),(l),&(k),(iv),(e)) 156280304Sjkim# define des_ncbc_encrypt(i,o,l,k,iv,e)\ 157280304Sjkim DES_ncbc_encrypt((i),(o),(l),&(k),(iv),(e)) 158280304Sjkim# define des_xcbc_encrypt(i,o,l,k,iv,inw,outw,e)\ 159280304Sjkim DES_xcbc_encrypt((i),(o),(l),&(k),(iv),(inw),(outw),(e)) 160280304Sjkim# define des_cfb_encrypt(i,o,n,l,k,iv,e)\ 161280304Sjkim DES_cfb_encrypt((i),(o),(n),(l),&(k),(iv),(e)) 162280304Sjkim# define des_ecb_encrypt(i,o,k,e)\ 163280304Sjkim DES_ecb_encrypt((i),(o),&(k),(e)) 164280304Sjkim# define des_encrypt1(d,k,e)\ 165280304Sjkim DES_encrypt1((d),&(k),(e)) 166280304Sjkim# define des_encrypt2(d,k,e)\ 167280304Sjkim DES_encrypt2((d),&(k),(e)) 168280304Sjkim# define des_encrypt3(d,k1,k2,k3)\ 169280304Sjkim DES_encrypt3((d),&(k1),&(k2),&(k3)) 170280304Sjkim# define des_decrypt3(d,k1,k2,k3)\ 171280304Sjkim DES_decrypt3((d),&(k1),&(k2),&(k3)) 172280304Sjkim# define des_xwhite_in2out(k,i,o)\ 173280304Sjkim DES_xwhite_in2out((k),(i),(o)) 174280304Sjkim# define des_enc_read(f,b,l,k,iv)\ 175280304Sjkim DES_enc_read((f),(b),(l),&(k),(iv)) 176280304Sjkim# define des_enc_write(f,b,l,k,iv)\ 177280304Sjkim DES_enc_write((f),(b),(l),&(k),(iv)) 178280304Sjkim# define des_fcrypt(b,s,r)\ 179280304Sjkim DES_fcrypt((b),(s),(r)) 180280304Sjkim# if 0 181280304Sjkim# define des_crypt(b,s)\ 182280304Sjkim DES_crypt((b),(s)) 183280304Sjkim# if !defined(PERL5) && !defined(__FreeBSD__) && !defined(NeXT) && !defined(__OpenBSD__) 184280304Sjkim# define crypt(b,s)\ 185280304Sjkim DES_crypt((b),(s)) 186280304Sjkim# endif 187280304Sjkim# endif 188280304Sjkim# define des_ofb_encrypt(i,o,n,l,k,iv)\ 189280304Sjkim DES_ofb_encrypt((i),(o),(n),(l),&(k),(iv)) 190280304Sjkim# define des_pcbc_encrypt(i,o,l,k,iv,e)\ 191280304Sjkim DES_pcbc_encrypt((i),(o),(l),&(k),(iv),(e)) 192280304Sjkim# define des_quad_cksum(i,o,l,c,s)\ 193280304Sjkim DES_quad_cksum((i),(o),(l),(c),(s)) 194280304Sjkim# define des_random_seed(k)\ 195280304Sjkim _ossl_096_des_random_seed((k)) 196280304Sjkim# define des_random_key(r)\ 197280304Sjkim DES_random_key((r)) 198280304Sjkim# define des_read_password(k,p,v) \ 199280304Sjkim DES_read_password((k),(p),(v)) 200280304Sjkim# define des_read_2passwords(k1,k2,p,v) \ 201280304Sjkim DES_read_2passwords((k1),(k2),(p),(v)) 202280304Sjkim# define des_set_odd_parity(k)\ 203280304Sjkim DES_set_odd_parity((k)) 204280304Sjkim# define des_check_key_parity(k)\ 205280304Sjkim DES_check_key_parity((k)) 206280304Sjkim# define des_is_weak_key(k)\ 207280304Sjkim DES_is_weak_key((k)) 208280304Sjkim# define des_set_key(k,ks)\ 209280304Sjkim DES_set_key((k),&(ks)) 210280304Sjkim# define des_key_sched(k,ks)\ 211280304Sjkim DES_key_sched((k),&(ks)) 212280304Sjkim# define des_set_key_checked(k,ks)\ 213280304Sjkim DES_set_key_checked((k),&(ks)) 214280304Sjkim# define des_set_key_unchecked(k,ks)\ 215280304Sjkim DES_set_key_unchecked((k),&(ks)) 216280304Sjkim# define des_string_to_key(s,k)\ 217280304Sjkim DES_string_to_key((s),(k)) 218280304Sjkim# define des_string_to_2keys(s,k1,k2)\ 219280304Sjkim DES_string_to_2keys((s),(k1),(k2)) 220280304Sjkim# define des_cfb64_encrypt(i,o,l,ks,iv,n,e)\ 221280304Sjkim DES_cfb64_encrypt((i),(o),(l),&(ks),(iv),(n),(e)) 222280304Sjkim# define des_ofb64_encrypt(i,o,l,ks,iv,n)\ 223280304Sjkim DES_ofb64_encrypt((i),(o),(l),&(ks),(iv),(n)) 224109998Smarkm 225280304Sjkim# define des_ecb2_encrypt(i,o,k1,k2,e) \ 226280304Sjkim des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e)) 227109998Smarkm 228280304Sjkim# define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \ 229280304Sjkim des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e)) 230109998Smarkm 231280304Sjkim# define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \ 232280304Sjkim des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e)) 233109998Smarkm 234280304Sjkim# define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \ 235280304Sjkim des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n)) 236109998Smarkm 237280304Sjkim# define des_check_key DES_check_key 238280304Sjkim# define des_rw_mode DES_rw_mode 239280304Sjkim# else /* libdes compatibility */ 240280304Sjkim/* 241280304Sjkim * Map all symbol names to _ossl_old_des_* form, so we avoid all clashes with 242280304Sjkim * libdes 243280304Sjkim */ 244280304Sjkim# define des_cblock _ossl_old_des_cblock 245280304Sjkim# define des_key_schedule _ossl_old_des_key_schedule 246280304Sjkim# define des_ecb3_encrypt(i,o,k1,k2,k3,e)\ 247280304Sjkim _ossl_old_des_ecb3_encrypt((i),(o),(k1),(k2),(k3),(e)) 248280304Sjkim# define des_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e)\ 249280304Sjkim _ossl_old_des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(e)) 250280304Sjkim# define des_ede3_cfb64_encrypt(i,o,l,k1,k2,k3,iv,n,e)\ 251280304Sjkim _ossl_old_des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n),(e)) 252280304Sjkim# define des_ede3_ofb64_encrypt(i,o,l,k1,k2,k3,iv,n)\ 253280304Sjkim _ossl_old_des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n)) 254280304Sjkim# define des_options()\ 255280304Sjkim _ossl_old_des_options() 256280304Sjkim# define des_cbc_cksum(i,o,l,k,iv)\ 257280304Sjkim _ossl_old_des_cbc_cksum((i),(o),(l),(k),(iv)) 258280304Sjkim# define des_cbc_encrypt(i,o,l,k,iv,e)\ 259280304Sjkim _ossl_old_des_cbc_encrypt((i),(o),(l),(k),(iv),(e)) 260280304Sjkim# define des_ncbc_encrypt(i,o,l,k,iv,e)\ 261280304Sjkim _ossl_old_des_ncbc_encrypt((i),(o),(l),(k),(iv),(e)) 262280304Sjkim# define des_xcbc_encrypt(i,o,l,k,iv,inw,outw,e)\ 263280304Sjkim _ossl_old_des_xcbc_encrypt((i),(o),(l),(k),(iv),(inw),(outw),(e)) 264280304Sjkim# define des_cfb_encrypt(i,o,n,l,k,iv,e)\ 265280304Sjkim _ossl_old_des_cfb_encrypt((i),(o),(n),(l),(k),(iv),(e)) 266280304Sjkim# define des_ecb_encrypt(i,o,k,e)\ 267280304Sjkim _ossl_old_des_ecb_encrypt((i),(o),(k),(e)) 268280304Sjkim# define des_encrypt(d,k,e)\ 269280304Sjkim _ossl_old_des_encrypt((d),(k),(e)) 270280304Sjkim# define des_encrypt2(d,k,e)\ 271280304Sjkim _ossl_old_des_encrypt2((d),(k),(e)) 272280304Sjkim# define des_encrypt3(d,k1,k2,k3)\ 273280304Sjkim _ossl_old_des_encrypt3((d),(k1),(k2),(k3)) 274280304Sjkim# define des_decrypt3(d,k1,k2,k3)\ 275280304Sjkim _ossl_old_des_decrypt3((d),(k1),(k2),(k3)) 276280304Sjkim# define des_xwhite_in2out(k,i,o)\ 277280304Sjkim _ossl_old_des_xwhite_in2out((k),(i),(o)) 278280304Sjkim# define des_enc_read(f,b,l,k,iv)\ 279280304Sjkim _ossl_old_des_enc_read((f),(b),(l),(k),(iv)) 280280304Sjkim# define des_enc_write(f,b,l,k,iv)\ 281280304Sjkim _ossl_old_des_enc_write((f),(b),(l),(k),(iv)) 282280304Sjkim# define des_fcrypt(b,s,r)\ 283280304Sjkim _ossl_old_des_fcrypt((b),(s),(r)) 284280304Sjkim# define des_crypt(b,s)\ 285280304Sjkim _ossl_old_des_crypt((b),(s)) 286280304Sjkim# if 0 287280304Sjkim# define crypt(b,s)\ 288280304Sjkim _ossl_old_crypt((b),(s)) 289280304Sjkim# endif 290280304Sjkim# define des_ofb_encrypt(i,o,n,l,k,iv)\ 291280304Sjkim _ossl_old_des_ofb_encrypt((i),(o),(n),(l),(k),(iv)) 292280304Sjkim# define des_pcbc_encrypt(i,o,l,k,iv,e)\ 293280304Sjkim _ossl_old_des_pcbc_encrypt((i),(o),(l),(k),(iv),(e)) 294280304Sjkim# define des_quad_cksum(i,o,l,c,s)\ 295280304Sjkim _ossl_old_des_quad_cksum((i),(o),(l),(c),(s)) 296280304Sjkim# define des_random_seed(k)\ 297280304Sjkim _ossl_old_des_random_seed((k)) 298280304Sjkim# define des_random_key(r)\ 299280304Sjkim _ossl_old_des_random_key((r)) 300280304Sjkim# define des_read_password(k,p,v) \ 301280304Sjkim _ossl_old_des_read_password((k),(p),(v)) 302280304Sjkim# define des_read_2passwords(k1,k2,p,v) \ 303280304Sjkim _ossl_old_des_read_2passwords((k1),(k2),(p),(v)) 304280304Sjkim# define des_set_odd_parity(k)\ 305280304Sjkim _ossl_old_des_set_odd_parity((k)) 306280304Sjkim# define des_is_weak_key(k)\ 307280304Sjkim _ossl_old_des_is_weak_key((k)) 308280304Sjkim# define des_set_key(k,ks)\ 309280304Sjkim _ossl_old_des_set_key((k),(ks)) 310280304Sjkim# define des_key_sched(k,ks)\ 311280304Sjkim _ossl_old_des_key_sched((k),(ks)) 312280304Sjkim# define des_string_to_key(s,k)\ 313280304Sjkim _ossl_old_des_string_to_key((s),(k)) 314280304Sjkim# define des_string_to_2keys(s,k1,k2)\ 315280304Sjkim _ossl_old_des_string_to_2keys((s),(k1),(k2)) 316280304Sjkim# define des_cfb64_encrypt(i,o,l,ks,iv,n,e)\ 317280304Sjkim _ossl_old_des_cfb64_encrypt((i),(o),(l),(ks),(iv),(n),(e)) 318280304Sjkim# define des_ofb64_encrypt(i,o,l,ks,iv,n)\ 319280304Sjkim _ossl_old_des_ofb64_encrypt((i),(o),(l),(ks),(iv),(n)) 320109998Smarkm 321280304Sjkim# define des_ecb2_encrypt(i,o,k1,k2,e) \ 322280304Sjkim des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e)) 323109998Smarkm 324280304Sjkim# define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \ 325280304Sjkim des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e)) 326109998Smarkm 327280304Sjkim# define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \ 328280304Sjkim des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e)) 329109998Smarkm 330280304Sjkim# define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \ 331280304Sjkim des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n)) 332109998Smarkm 333280304Sjkim# define des_check_key DES_check_key 334280304Sjkim# define des_rw_mode DES_rw_mode 335280304Sjkim# endif 336109998Smarkm 337109998Smarkmconst char *_ossl_old_des_options(void); 338280304Sjkimvoid _ossl_old_des_ecb3_encrypt(_ossl_old_des_cblock *input, 339280304Sjkim _ossl_old_des_cblock *output, 340280304Sjkim _ossl_old_des_key_schedule ks1, 341280304Sjkim _ossl_old_des_key_schedule ks2, 342280304Sjkim _ossl_old_des_key_schedule ks3, int enc); 343280304SjkimDES_LONG _ossl_old_des_cbc_cksum(_ossl_old_des_cblock *input, 344280304Sjkim _ossl_old_des_cblock *output, long length, 345280304Sjkim _ossl_old_des_key_schedule schedule, 346280304Sjkim _ossl_old_des_cblock *ivec); 347280304Sjkimvoid _ossl_old_des_cbc_encrypt(_ossl_old_des_cblock *input, 348280304Sjkim _ossl_old_des_cblock *output, long length, 349280304Sjkim _ossl_old_des_key_schedule schedule, 350280304Sjkim _ossl_old_des_cblock *ivec, int enc); 351280304Sjkimvoid _ossl_old_des_ncbc_encrypt(_ossl_old_des_cblock *input, 352280304Sjkim _ossl_old_des_cblock *output, long length, 353280304Sjkim _ossl_old_des_key_schedule schedule, 354280304Sjkim _ossl_old_des_cblock *ivec, int enc); 355280304Sjkimvoid _ossl_old_des_xcbc_encrypt(_ossl_old_des_cblock *input, 356280304Sjkim _ossl_old_des_cblock *output, long length, 357280304Sjkim _ossl_old_des_key_schedule schedule, 358280304Sjkim _ossl_old_des_cblock *ivec, 359280304Sjkim _ossl_old_des_cblock *inw, 360280304Sjkim _ossl_old_des_cblock *outw, int enc); 361280304Sjkimvoid _ossl_old_des_cfb_encrypt(unsigned char *in, unsigned char *out, 362280304Sjkim int numbits, long length, 363280304Sjkim _ossl_old_des_key_schedule schedule, 364280304Sjkim _ossl_old_des_cblock *ivec, int enc); 365280304Sjkimvoid _ossl_old_des_ecb_encrypt(_ossl_old_des_cblock *input, 366280304Sjkim _ossl_old_des_cblock *output, 367280304Sjkim _ossl_old_des_key_schedule ks, int enc); 368280304Sjkimvoid _ossl_old_des_encrypt(DES_LONG *data, _ossl_old_des_key_schedule ks, 369280304Sjkim int enc); 370280304Sjkimvoid _ossl_old_des_encrypt2(DES_LONG *data, _ossl_old_des_key_schedule ks, 371280304Sjkim int enc); 372109998Smarkmvoid _ossl_old_des_encrypt3(DES_LONG *data, _ossl_old_des_key_schedule ks1, 373280304Sjkim _ossl_old_des_key_schedule ks2, 374280304Sjkim _ossl_old_des_key_schedule ks3); 375109998Smarkmvoid _ossl_old_des_decrypt3(DES_LONG *data, _ossl_old_des_key_schedule ks1, 376280304Sjkim _ossl_old_des_key_schedule ks2, 377280304Sjkim _ossl_old_des_key_schedule ks3); 378280304Sjkimvoid _ossl_old_des_ede3_cbc_encrypt(_ossl_old_des_cblock *input, 379280304Sjkim _ossl_old_des_cblock *output, long length, 380280304Sjkim _ossl_old_des_key_schedule ks1, 381280304Sjkim _ossl_old_des_key_schedule ks2, 382280304Sjkim _ossl_old_des_key_schedule ks3, 383280304Sjkim _ossl_old_des_cblock *ivec, int enc); 384109998Smarkmvoid _ossl_old_des_ede3_cfb64_encrypt(unsigned char *in, unsigned char *out, 385280304Sjkim long length, 386280304Sjkim _ossl_old_des_key_schedule ks1, 387280304Sjkim _ossl_old_des_key_schedule ks2, 388280304Sjkim _ossl_old_des_key_schedule ks3, 389280304Sjkim _ossl_old_des_cblock *ivec, int *num, 390280304Sjkim int enc); 391109998Smarkmvoid _ossl_old_des_ede3_ofb64_encrypt(unsigned char *in, unsigned char *out, 392280304Sjkim long length, 393280304Sjkim _ossl_old_des_key_schedule ks1, 394280304Sjkim _ossl_old_des_key_schedule ks2, 395280304Sjkim _ossl_old_des_key_schedule ks3, 396280304Sjkim _ossl_old_des_cblock *ivec, int *num); 397280304Sjkim# if 0 398280304Sjkimvoid _ossl_old_des_xwhite_in2out(_ossl_old_des_cblock (*des_key), 399280304Sjkim _ossl_old_des_cblock (*in_white), 400280304Sjkim _ossl_old_des_cblock (*out_white)); 401280304Sjkim# endif 402109998Smarkm 403280304Sjkimint _ossl_old_des_enc_read(int fd, char *buf, int len, 404280304Sjkim _ossl_old_des_key_schedule sched, 405280304Sjkim _ossl_old_des_cblock *iv); 406280304Sjkimint _ossl_old_des_enc_write(int fd, char *buf, int len, 407280304Sjkim _ossl_old_des_key_schedule sched, 408280304Sjkim _ossl_old_des_cblock *iv); 409280304Sjkimchar *_ossl_old_des_fcrypt(const char *buf, const char *salt, char *ret); 410280304Sjkimchar *_ossl_old_des_crypt(const char *buf, const char *salt); 411280304Sjkim# if !defined(PERL5) && !defined(NeXT) 412280304Sjkimchar *_ossl_old_crypt(const char *buf, const char *salt); 413280304Sjkim# endif 414280304Sjkimvoid _ossl_old_des_ofb_encrypt(unsigned char *in, unsigned char *out, 415280304Sjkim int numbits, long length, 416280304Sjkim _ossl_old_des_key_schedule schedule, 417280304Sjkim _ossl_old_des_cblock *ivec); 418280304Sjkimvoid _ossl_old_des_pcbc_encrypt(_ossl_old_des_cblock *input, 419280304Sjkim _ossl_old_des_cblock *output, long length, 420280304Sjkim _ossl_old_des_key_schedule schedule, 421280304Sjkim _ossl_old_des_cblock *ivec, int enc); 422280304SjkimDES_LONG _ossl_old_des_quad_cksum(_ossl_old_des_cblock *input, 423280304Sjkim _ossl_old_des_cblock *output, long length, 424280304Sjkim 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); 427280304Sjkimint _ossl_old_des_read_password(_ossl_old_des_cblock *key, const char *prompt, 428280304Sjkim int verify); 429280304Sjkimint _ossl_old_des_read_2passwords(_ossl_old_des_cblock *key1, 430280304Sjkim _ossl_old_des_cblock *key2, 431280304Sjkim 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); 434280304Sjkimint _ossl_old_des_set_key(_ossl_old_des_cblock *key, 435280304Sjkim _ossl_old_des_key_schedule schedule); 436280304Sjkimint _ossl_old_des_key_sched(_ossl_old_des_cblock *key, 437280304Sjkim _ossl_old_des_key_schedule schedule); 438280304Sjkimvoid _ossl_old_des_string_to_key(char *str, _ossl_old_des_cblock *key); 439280304Sjkimvoid _ossl_old_des_string_to_2keys(char *str, _ossl_old_des_cblock *key1, 440280304Sjkim _ossl_old_des_cblock *key2); 441280304Sjkimvoid _ossl_old_des_cfb64_encrypt(unsigned char *in, unsigned char *out, 442280304Sjkim long length, 443280304Sjkim _ossl_old_des_key_schedule schedule, 444280304Sjkim _ossl_old_des_cblock *ivec, int *num, 445280304Sjkim int enc); 446280304Sjkimvoid _ossl_old_des_ofb64_encrypt(unsigned char *in, unsigned char *out, 447280304Sjkim long length, 448280304Sjkim _ossl_old_des_key_schedule schedule, 449280304Sjkim _ossl_old_des_cblock *ivec, int *num); 450109998Smarkm 451109998Smarkmvoid _ossl_096_des_random_seed(des_cblock *key); 452109998Smarkm 453280304Sjkim/* 454280304Sjkim * The following definitions provide compatibility with the MIT Kerberos 455280304Sjkim * library. The _ossl_old_des_key_schedule structure is not binary 456280304Sjkim * compatible. 457280304Sjkim */ 458109998Smarkm 459280304Sjkim# define _KERBEROS_DES_H 460109998Smarkm 461280304Sjkim# define KRBDES_ENCRYPT DES_ENCRYPT 462280304Sjkim# define KRBDES_DECRYPT DES_DECRYPT 463109998Smarkm 464280304Sjkim# ifdef KERBEROS 465109998Smarkm# define ENCRYPT DES_ENCRYPT 466109998Smarkm# define DECRYPT DES_DECRYPT 467280304Sjkim# endif 468109998Smarkm 469280304Sjkim# 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 486280304Sjkim# endif 487109998Smarkm 488280304Sjkim# 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 */ 495280304Sjkim# include <openssl/ui_compat.h> 496109998Smarkm 497109998Smarkm#endif 498