williamr@2: /* crypto/des/des_old.h -*- mode:C; c-file-style: "eay" -*- */ williamr@2: williamr@2: /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING williamr@2: * williamr@2: * The function names in here are deprecated and are only present to williamr@2: * provide an interface compatible with openssl 0.9.6 and older as williamr@2: * well as libdes. OpenSSL now provides functions where "des_" has williamr@2: * been replaced with "DES_" in the names, to make it possible to williamr@2: * make incompatible changes that are needed for C type security and williamr@2: * other stuff. williamr@2: * williamr@2: * This include files has two compatibility modes: williamr@2: * williamr@2: * - If OPENSSL_DES_LIBDES_COMPATIBILITY is defined, you get an API williamr@2: * that is compatible with libdes and SSLeay. williamr@2: * - If OPENSSL_DES_LIBDES_COMPATIBILITY isn't defined, you get an williamr@2: * API that is compatible with OpenSSL 0.9.5x to 0.9.6x. williamr@2: * williamr@2: * Note that these modes break earlier snapshots of OpenSSL, where williamr@2: * libdes compatibility was the only available mode or (later on) the williamr@2: * prefered compatibility mode. However, after much consideration williamr@2: * (and more or less violent discussions with external parties), it williamr@2: * was concluded that OpenSSL should be compatible with earlier versions williamr@2: * of itself before anything else. Also, in all honesty, libdes is williamr@2: * an old beast that shouldn't really be used any more. williamr@2: * williamr@2: * Please consider starting to use the DES_ functions rather than the williamr@2: * des_ ones. The des_ functions will disappear completely before williamr@2: * OpenSSL 1.0! williamr@2: * williamr@2: * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING williamr@2: */ williamr@2: williamr@2: /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL williamr@2: * project 2001. williamr@2: */ williamr@2: /* ==================================================================== williamr@2: * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. williamr@2: * williamr@2: * Redistribution and use in source and binary forms, with or without williamr@2: * modification, are permitted provided that the following conditions williamr@2: * are met: williamr@2: * williamr@2: * 1. Redistributions of source code must retain the above copyright williamr@2: * notice, this list of conditions and the following disclaimer. williamr@2: * williamr@2: * 2. Redistributions in binary form must reproduce the above copyright williamr@2: * notice, this list of conditions and the following disclaimer in williamr@2: * the documentation and/or other materials provided with the williamr@2: * distribution. williamr@2: * williamr@2: * 3. All advertising materials mentioning features or use of this williamr@2: * software must display the following acknowledgment: williamr@2: * "This product includes software developed by the OpenSSL Project williamr@2: * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" williamr@2: * williamr@2: * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to williamr@2: * endorse or promote products derived from this software without williamr@2: * prior written permission. For written permission, please contact williamr@2: * openssl-core@openssl.org. williamr@2: * williamr@2: * 5. Products derived from this software may not be called "OpenSSL" williamr@2: * nor may "OpenSSL" appear in their names without prior written williamr@2: * permission of the OpenSSL Project. williamr@2: * williamr@2: * 6. Redistributions of any form whatsoever must retain the following williamr@2: * acknowledgment: williamr@2: * "This product includes software developed by the OpenSSL Project williamr@2: * for use in the OpenSSL Toolkit (http://www.openssl.org/)" williamr@2: * williamr@2: * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY williamr@2: * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE williamr@2: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR williamr@2: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR williamr@2: * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, williamr@2: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT williamr@2: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; williamr@2: * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) williamr@2: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, williamr@2: * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) williamr@2: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED williamr@2: * OF THE POSSIBILITY OF SUCH DAMAGE. williamr@2: * ==================================================================== williamr@2: * williamr@2: * This product includes cryptographic software written by Eric Young williamr@2: * (eay@cryptsoft.com). This product includes software written by Tim williamr@2: * Hudson (tjh@cryptsoft.com). williamr@2: * williamr@2: */ williamr@2: /* williamr@2: © Portions copyright (c) 2006 Nokia Corporation. All rights reserved. williamr@2: */ williamr@2: williamr@2: #ifndef HEADER_DES_H williamr@2: #define HEADER_DES_H williamr@2: williamr@2: #if (defined(__SYMBIAN32__) && !defined(SYMBIAN)) williamr@2: #define SYMBIAN williamr@2: #endif williamr@2: williamr@2: #ifdef SYMBIAN williamr@2: #include williamr@2: #endif williamr@2: #include /* OPENSSL_EXTERN, OPENSSL_NO_DES, DES_LONG */ williamr@2: williamr@2: #ifdef OPENSSL_NO_DES williamr@2: #error DES is disabled. williamr@2: #endif williamr@2: williamr@2: #ifndef HEADER_NEW_DES_H williamr@2: #error You must include des.h, not des_old.h directly. williamr@2: #endif williamr@2: williamr@2: #ifdef _KERBEROS_DES_H williamr@2: #error replaces . williamr@2: #endif williamr@2: williamr@2: #include williamr@2: williamr@2: #ifdef OPENSSL_BUILD_SHLIBCRYPTO williamr@2: # undef OPENSSL_EXTERN williamr@2: # define OPENSSL_EXTERN OPENSSL_EXPORT williamr@2: #endif williamr@2: williamr@2: #ifdef __cplusplus williamr@2: extern "C" { williamr@2: #endif williamr@2: williamr@2: #ifdef _ williamr@2: #undef _ williamr@2: #endif williamr@2: williamr@2: typedef unsigned char _ossl_old_des_cblock[8]; williamr@2: typedef struct _ossl_old_des_ks_struct williamr@2: { williamr@2: union { williamr@2: _ossl_old_des_cblock _; williamr@2: /* make sure things are correct size on machines with williamr@2: * 8 byte longs */ williamr@2: DES_LONG pad[2]; williamr@2: } ks; williamr@2: } _ossl_old_des_key_schedule[16]; williamr@2: williamr@2: #ifndef OPENSSL_DES_LIBDES_COMPATIBILITY williamr@2: #define des_cblock DES_cblock williamr@2: #define const_des_cblock const_DES_cblock williamr@2: #define des_key_schedule DES_key_schedule williamr@2: #define des_ecb3_encrypt(i,o,k1,k2,k3,e)\ williamr@2: DES_ecb3_encrypt((i),(o),&(k1),&(k2),&(k3),(e)) williamr@2: #define des_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e)\ williamr@2: DES_ede3_cbc_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(e)) williamr@2: #define des_ede3_cbcm_encrypt(i,o,l,k1,k2,k3,iv1,iv2,e)\ williamr@2: DES_ede3_cbcm_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv1),(iv2),(e)) williamr@2: #define des_ede3_cfb64_encrypt(i,o,l,k1,k2,k3,iv,n,e)\ williamr@2: DES_ede3_cfb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n),(e)) williamr@2: #define des_ede3_ofb64_encrypt(i,o,l,k1,k2,k3,iv,n)\ williamr@2: DES_ede3_ofb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n)) williamr@2: #define des_options()\ williamr@2: DES_options() williamr@2: #define des_cbc_cksum(i,o,l,k,iv)\ williamr@2: DES_cbc_cksum((i),(o),(l),&(k),(iv)) williamr@2: #define des_cbc_encrypt(i,o,l,k,iv,e)\ williamr@2: DES_cbc_encrypt((i),(o),(l),&(k),(iv),(e)) williamr@2: #define des_ncbc_encrypt(i,o,l,k,iv,e)\ williamr@2: DES_ncbc_encrypt((i),(o),(l),&(k),(iv),(e)) williamr@2: #define des_xcbc_encrypt(i,o,l,k,iv,inw,outw,e)\ williamr@2: DES_xcbc_encrypt((i),(o),(l),&(k),(iv),(inw),(outw),(e)) williamr@2: #define des_cfb_encrypt(i,o,n,l,k,iv,e)\ williamr@2: DES_cfb_encrypt((i),(o),(n),(l),&(k),(iv),(e)) williamr@2: #define des_ecb_encrypt(i,o,k,e)\ williamr@2: DES_ecb_encrypt((i),(o),&(k),(e)) williamr@2: #define des_encrypt1(d,k,e)\ williamr@2: DES_encrypt1((d),&(k),(e)) williamr@2: #define des_encrypt2(d,k,e)\ williamr@2: DES_encrypt2((d),&(k),(e)) williamr@2: #define des_encrypt3(d,k1,k2,k3)\ williamr@2: DES_encrypt3((d),&(k1),&(k2),&(k3)) williamr@2: #define des_decrypt3(d,k1,k2,k3)\ williamr@2: DES_decrypt3((d),&(k1),&(k2),&(k3)) williamr@2: #define des_xwhite_in2out(k,i,o)\ williamr@2: DES_xwhite_in2out((k),(i),(o)) williamr@2: #define des_enc_read(f,b,l,k,iv)\ williamr@2: DES_enc_read((f),(b),(l),&(k),(iv)) williamr@2: #define des_enc_write(f,b,l,k,iv)\ williamr@2: DES_enc_write((f),(b),(l),&(k),(iv)) williamr@2: #define des_fcrypt(b,s,r)\ williamr@2: DES_fcrypt((b),(s),(r)) williamr@2: #if 0 williamr@2: #define des_crypt(b,s)\ williamr@2: DES_crypt((b),(s)) williamr@2: #if !defined(PERL5) && !defined(__FreeBSD__) && !defined(NeXT) && !defined(__OpenBSD__) williamr@2: #define crypt(b,s)\ williamr@2: DES_crypt((b),(s)) williamr@2: #endif williamr@2: #endif williamr@2: #define des_ofb_encrypt(i,o,n,l,k,iv)\ williamr@2: DES_ofb_encrypt((i),(o),(n),(l),&(k),(iv)) williamr@2: #define des_pcbc_encrypt(i,o,l,k,iv,e)\ williamr@2: DES_pcbc_encrypt((i),(o),(l),&(k),(iv),(e)) williamr@2: #define des_quad_cksum(i,o,l,c,s)\ williamr@2: DES_quad_cksum((i),(o),(l),(c),(s)) williamr@2: #define des_random_seed(k)\ williamr@2: _ossl_096_des_random_seed((k)) williamr@2: #define des_random_key(r)\ williamr@2: DES_random_key((r)) williamr@2: #define des_read_password(k,p,v) \ williamr@2: DES_read_password((k),(p),(v)) williamr@2: #define des_read_2passwords(k1,k2,p,v) \ williamr@2: DES_read_2passwords((k1),(k2),(p),(v)) williamr@2: #define des_set_odd_parity(k)\ williamr@2: DES_set_odd_parity((k)) williamr@2: #define des_check_key_parity(k)\ williamr@2: DES_check_key_parity((k)) williamr@2: #define des_is_weak_key(k)\ williamr@2: DES_is_weak_key((k)) williamr@2: #define des_set_key(k,ks)\ williamr@2: DES_set_key((k),&(ks)) williamr@2: #define des_key_sched(k,ks)\ williamr@2: DES_key_sched((k),&(ks)) williamr@2: #define des_set_key_checked(k,ks)\ williamr@2: DES_set_key_checked((k),&(ks)) williamr@2: #define des_set_key_unchecked(k,ks)\ williamr@2: DES_set_key_unchecked((k),&(ks)) williamr@2: #define des_string_to_key(s,k)\ williamr@2: DES_string_to_key((s),(k)) williamr@2: #define des_string_to_2keys(s,k1,k2)\ williamr@2: DES_string_to_2keys((s),(k1),(k2)) williamr@2: #define des_cfb64_encrypt(i,o,l,ks,iv,n,e)\ williamr@2: DES_cfb64_encrypt((i),(o),(l),&(ks),(iv),(n),(e)) williamr@2: #define des_ofb64_encrypt(i,o,l,ks,iv,n)\ williamr@2: DES_ofb64_encrypt((i),(o),(l),&(ks),(iv),(n)) williamr@2: williamr@2: williamr@2: #define des_ecb2_encrypt(i,o,k1,k2,e) \ williamr@2: des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e)) williamr@2: williamr@2: #define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \ williamr@2: des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e)) williamr@2: williamr@2: #define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \ williamr@2: des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e)) williamr@2: williamr@2: #define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \ williamr@2: des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n)) williamr@2: williamr@2: #define des_check_key DES_check_key williamr@2: #define des_rw_mode DES_rw_mode williamr@2: #else /* libdes compatibility */ williamr@2: /* Map all symbol names to _ossl_old_des_* form, so we avoid all williamr@2: clashes with libdes */ williamr@2: #define des_cblock _ossl_old_des_cblock williamr@2: #define des_key_schedule _ossl_old_des_key_schedule williamr@2: #define des_ecb3_encrypt(i,o,k1,k2,k3,e)\ williamr@2: _ossl_old_des_ecb3_encrypt((i),(o),(k1),(k2),(k3),(e)) williamr@2: #define des_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e)\ williamr@2: _ossl_old_des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(e)) williamr@2: #define des_ede3_cfb64_encrypt(i,o,l,k1,k2,k3,iv,n,e)\ williamr@2: _ossl_old_des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n),(e)) williamr@2: #define des_ede3_ofb64_encrypt(i,o,l,k1,k2,k3,iv,n)\ williamr@2: _ossl_old_des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n)) williamr@2: #define des_options()\ williamr@2: _ossl_old_des_options() williamr@2: #define des_cbc_cksum(i,o,l,k,iv)\ williamr@2: _ossl_old_des_cbc_cksum((i),(o),(l),(k),(iv)) williamr@2: #define des_cbc_encrypt(i,o,l,k,iv,e)\ williamr@2: _ossl_old_des_cbc_encrypt((i),(o),(l),(k),(iv),(e)) williamr@2: #define des_ncbc_encrypt(i,o,l,k,iv,e)\ williamr@2: _ossl_old_des_ncbc_encrypt((i),(o),(l),(k),(iv),(e)) williamr@2: #define des_xcbc_encrypt(i,o,l,k,iv,inw,outw,e)\ williamr@2: _ossl_old_des_xcbc_encrypt((i),(o),(l),(k),(iv),(inw),(outw),(e)) williamr@2: #define des_cfb_encrypt(i,o,n,l,k,iv,e)\ williamr@2: _ossl_old_des_cfb_encrypt((i),(o),(n),(l),(k),(iv),(e)) williamr@2: #define des_ecb_encrypt(i,o,k,e)\ williamr@2: _ossl_old_des_ecb_encrypt((i),(o),(k),(e)) williamr@2: #define des_encrypt(d,k,e)\ williamr@2: _ossl_old_des_encrypt((d),(k),(e)) williamr@2: #define des_encrypt2(d,k,e)\ williamr@2: _ossl_old_des_encrypt2((d),(k),(e)) williamr@2: #define des_encrypt3(d,k1,k2,k3)\ williamr@2: _ossl_old_des_encrypt3((d),(k1),(k2),(k3)) williamr@2: #define des_decrypt3(d,k1,k2,k3)\ williamr@2: _ossl_old_des_decrypt3((d),(k1),(k2),(k3)) williamr@2: #define des_xwhite_in2out(k,i,o)\ williamr@2: _ossl_old_des_xwhite_in2out((k),(i),(o)) williamr@2: #define des_enc_read(f,b,l,k,iv)\ williamr@2: _ossl_old_des_enc_read((f),(b),(l),(k),(iv)) williamr@2: #define des_enc_write(f,b,l,k,iv)\ williamr@2: _ossl_old_des_enc_write((f),(b),(l),(k),(iv)) williamr@2: #define des_fcrypt(b,s,r)\ williamr@2: _ossl_old_des_fcrypt((b),(s),(r)) williamr@2: #define des_crypt(b,s)\ williamr@2: _ossl_old_des_crypt((b),(s)) williamr@2: #if 0 williamr@2: #define crypt(b,s)\ williamr@2: _ossl_old_crypt((b),(s)) williamr@2: #endif williamr@2: #define des_ofb_encrypt(i,o,n,l,k,iv)\ williamr@2: _ossl_old_des_ofb_encrypt((i),(o),(n),(l),(k),(iv)) williamr@2: #define des_pcbc_encrypt(i,o,l,k,iv,e)\ williamr@2: _ossl_old_des_pcbc_encrypt((i),(o),(l),(k),(iv),(e)) williamr@2: #define des_quad_cksum(i,o,l,c,s)\ williamr@2: _ossl_old_des_quad_cksum((i),(o),(l),(c),(s)) williamr@2: #define des_random_seed(k)\ williamr@2: _ossl_old_des_random_seed((k)) williamr@2: #define des_random_key(r)\ williamr@2: _ossl_old_des_random_key((r)) williamr@2: #define des_read_password(k,p,v) \ williamr@2: _ossl_old_des_read_password((k),(p),(v)) williamr@2: #define des_read_2passwords(k1,k2,p,v) \ williamr@2: _ossl_old_des_read_2passwords((k1),(k2),(p),(v)) williamr@2: #define des_set_odd_parity(k)\ williamr@2: _ossl_old_des_set_odd_parity((k)) williamr@2: #define des_is_weak_key(k)\ williamr@2: _ossl_old_des_is_weak_key((k)) williamr@2: #define des_set_key(k,ks)\ williamr@2: _ossl_old_des_set_key((k),(ks)) williamr@2: #define des_key_sched(k,ks)\ williamr@2: _ossl_old_des_key_sched((k),(ks)) williamr@2: #define des_string_to_key(s,k)\ williamr@2: _ossl_old_des_string_to_key((s),(k)) williamr@2: #define des_string_to_2keys(s,k1,k2)\ williamr@2: _ossl_old_des_string_to_2keys((s),(k1),(k2)) williamr@2: #define des_cfb64_encrypt(i,o,l,ks,iv,n,e)\ williamr@2: _ossl_old_des_cfb64_encrypt((i),(o),(l),(ks),(iv),(n),(e)) williamr@2: #define des_ofb64_encrypt(i,o,l,ks,iv,n)\ williamr@2: _ossl_old_des_ofb64_encrypt((i),(o),(l),(ks),(iv),(n)) williamr@2: williamr@2: williamr@2: #define des_ecb2_encrypt(i,o,k1,k2,e) \ williamr@2: des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e)) williamr@2: williamr@2: #define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \ williamr@2: des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e)) williamr@2: williamr@2: #define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \ williamr@2: des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e)) williamr@2: williamr@2: #define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \ williamr@2: des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n)) williamr@2: williamr@2: #define des_check_key DES_check_key williamr@2: #define des_rw_mode DES_rw_mode williamr@2: #endif williamr@2: williamr@2: IMPORT_C const char *_ossl_old_des_options(void); williamr@2: IMPORT_C void _ossl_old_des_ecb3_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output, williamr@2: _ossl_old_des_key_schedule ks1,_ossl_old_des_key_schedule ks2, williamr@2: _ossl_old_des_key_schedule ks3, int enc); williamr@2: IMPORT_C DES_LONG _ossl_old_des_cbc_cksum(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output, williamr@2: long length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec); williamr@2: IMPORT_C void _ossl_old_des_cbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length, williamr@2: _ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc); williamr@2: IMPORT_C void _ossl_old_des_ncbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length, williamr@2: _ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc); williamr@2: IMPORT_C void _ossl_old_des_xcbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length, williamr@2: _ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec, williamr@2: _ossl_old_des_cblock *inw,_ossl_old_des_cblock *outw,int enc); williamr@2: IMPORT_C void _ossl_old_des_cfb_encrypt(unsigned char *in,unsigned char *out,int numbits, williamr@2: long length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc); williamr@2: IMPORT_C void _ossl_old_des_ecb_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output, williamr@2: _ossl_old_des_key_schedule ks,int enc); williamr@2: IMPORT_C void _ossl_old_des_encrypt(DES_LONG *data,_ossl_old_des_key_schedule ks, int enc); williamr@2: IMPORT_C void _ossl_old_des_encrypt2(DES_LONG *data,_ossl_old_des_key_schedule ks, int enc); williamr@2: IMPORT_C void _ossl_old_des_encrypt3(DES_LONG *data, _ossl_old_des_key_schedule ks1, williamr@2: _ossl_old_des_key_schedule ks2, _ossl_old_des_key_schedule ks3); williamr@2: IMPORT_C void _ossl_old_des_decrypt3(DES_LONG *data, _ossl_old_des_key_schedule ks1, williamr@2: _ossl_old_des_key_schedule ks2, _ossl_old_des_key_schedule ks3); williamr@2: IMPORT_C void _ossl_old_des_ede3_cbc_encrypt(_ossl_old_des_cblock *input, _ossl_old_des_cblock *output, williamr@2: long length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2, williamr@2: _ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int enc); williamr@2: IMPORT_C void _ossl_old_des_ede3_cfb64_encrypt(unsigned char *in, unsigned char *out, williamr@2: long length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2, williamr@2: _ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num, int enc); williamr@2: IMPORT_C void _ossl_old_des_ede3_ofb64_encrypt(unsigned char *in, unsigned char *out, williamr@2: long length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2, williamr@2: _ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num); williamr@2: williamr@2: IMPORT_C void _ossl_old_des_xwhite_in2out(_ossl_old_des_cblock (*des_key), _ossl_old_des_cblock (*in_white), williamr@2: _ossl_old_des_cblock (*out_white)); williamr@2: williamr@2: IMPORT_C int _ossl_old_des_enc_read(int fd,char *buf,int len,_ossl_old_des_key_schedule sched, williamr@2: _ossl_old_des_cblock *iv); williamr@2: IMPORT_C int _ossl_old_des_enc_write(int fd,char *buf,int len,_ossl_old_des_key_schedule sched, williamr@2: _ossl_old_des_cblock *iv); williamr@2: IMPORT_C char *_ossl_old_des_fcrypt(const char *buf,const char *salt, char *ret); williamr@2: IMPORT_C char *_ossl_old_des_crypt(const char *buf,const char *salt); williamr@2: #if !defined(PERL5) && !defined(NeXT) williamr@2: IMPORT_C char *_ossl_old_crypt(const char *buf,const char *salt); williamr@2: #endif williamr@2: IMPORT_C void _ossl_old_des_ofb_encrypt(unsigned char *in,unsigned char *out, williamr@2: int numbits,long length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec); williamr@2: IMPORT_C void _ossl_old_des_pcbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length, williamr@2: _ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc); williamr@2: IMPORT_C DES_LONG _ossl_old_des_quad_cksum(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output, williamr@2: long length,int out_count,_ossl_old_des_cblock *seed); williamr@2: IMPORT_C void _ossl_old_des_random_seed(_ossl_old_des_cblock key); williamr@2: IMPORT_C void _ossl_old_des_random_key(_ossl_old_des_cblock ret); williamr@2: IMPORT_C int _ossl_old_des_read_password(_ossl_old_des_cblock *key,const char *prompt,int verify); williamr@2: IMPORT_C int _ossl_old_des_read_2passwords(_ossl_old_des_cblock *key1,_ossl_old_des_cblock *key2, williamr@2: const char *prompt,int verify); williamr@2: IMPORT_C void _ossl_old_des_set_odd_parity(_ossl_old_des_cblock *key); williamr@2: IMPORT_C int _ossl_old_des_is_weak_key(_ossl_old_des_cblock *key); williamr@2: IMPORT_C int _ossl_old_des_set_key(_ossl_old_des_cblock *key,_ossl_old_des_key_schedule schedule); williamr@2: IMPORT_C int _ossl_old_des_key_sched(_ossl_old_des_cblock *key,_ossl_old_des_key_schedule schedule); williamr@2: IMPORT_C void _ossl_old_des_string_to_key(char *str,_ossl_old_des_cblock *key); williamr@2: IMPORT_C void _ossl_old_des_string_to_2keys(char *str,_ossl_old_des_cblock *key1,_ossl_old_des_cblock *key2); williamr@2: IMPORT_C void _ossl_old_des_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, williamr@2: _ossl_old_des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num, int enc); williamr@2: IMPORT_C void _ossl_old_des_ofb64_encrypt(unsigned char *in, unsigned char *out, long length, williamr@2: _ossl_old_des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num); williamr@2: williamr@2: IMPORT_C void _ossl_096_des_random_seed(des_cblock *key); williamr@2: williamr@2: /* The following definitions provide compatibility with the MIT Kerberos williamr@2: * library. The _ossl_old_des_key_schedule structure is not binary compatible. */ williamr@2: williamr@2: #define _KERBEROS_DES_H williamr@2: williamr@2: #define KRBDES_ENCRYPT DES_ENCRYPT williamr@2: #define KRBDES_DECRYPT DES_DECRYPT williamr@2: williamr@2: #ifdef KERBEROS williamr@2: # define ENCRYPT DES_ENCRYPT williamr@2: # define DECRYPT DES_DECRYPT williamr@2: #endif williamr@2: williamr@2: #ifndef NCOMPAT williamr@2: # define C_Block des_cblock williamr@2: # define Key_schedule des_key_schedule williamr@2: # define KEY_SZ DES_KEY_SZ williamr@2: # define string_to_key des_string_to_key williamr@2: # define read_pw_string des_read_pw_string williamr@2: # define random_key des_random_key williamr@2: # define pcbc_encrypt des_pcbc_encrypt williamr@2: # define set_key des_set_key williamr@2: # define key_sched des_key_sched williamr@2: # define ecb_encrypt des_ecb_encrypt williamr@2: # define cbc_encrypt des_cbc_encrypt williamr@2: # define ncbc_encrypt des_ncbc_encrypt williamr@2: # define xcbc_encrypt des_xcbc_encrypt williamr@2: # define cbc_cksum des_cbc_cksum williamr@2: # define quad_cksum des_quad_cksum williamr@2: # define check_parity des_check_key_parity williamr@2: #endif williamr@2: williamr@2: #define des_fixup_key_parity DES_fixup_key_parity williamr@2: williamr@2: #ifdef __cplusplus williamr@2: } williamr@2: #endif williamr@2: williamr@2: /* for DES_read_pw_string et al */ williamr@2: #include williamr@2: williamr@2: #endif