LTKCPP-- LLRP Toolkit C Plus Plus Library
des_old.h
00001 /* crypto/des/des_old.h -*- mode:C; c-file-style: "eay" -*- */
00002 
00003 /*-
00004  * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
00005  *
00006  * The function names in here are deprecated and are only present to
00007  * provide an interface compatible with openssl 0.9.6 and older as
00008  * well as libdes.  OpenSSL now provides functions where "des_" has
00009  * been replaced with "DES_" in the names, to make it possible to
00010  * make incompatible changes that are needed for C type security and
00011  * other stuff.
00012  *
00013  * This include files has two compatibility modes:
00014  *
00015  *   - If OPENSSL_DES_LIBDES_COMPATIBILITY is defined, you get an API
00016  *     that is compatible with libdes and SSLeay.
00017  *   - If OPENSSL_DES_LIBDES_COMPATIBILITY isn't defined, you get an
00018  *     API that is compatible with OpenSSL 0.9.5x to 0.9.6x.
00019  *
00020  * Note that these modes break earlier snapshots of OpenSSL, where
00021  * libdes compatibility was the only available mode or (later on) the
00022  * prefered compatibility mode.  However, after much consideration
00023  * (and more or less violent discussions with external parties), it
00024  * was concluded that OpenSSL should be compatible with earlier versions
00025  * of itself before anything else.  Also, in all honesty, libdes is
00026  * an old beast that shouldn't really be used any more.
00027  *
00028  * Please consider starting to use the DES_ functions rather than the
00029  * des_ ones.  The des_ functions will disappear completely before
00030  * OpenSSL 1.0!
00031  *
00032  * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
00033  */
00034 
00035 /*
00036  * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project
00037  * 2001.
00038  */
00039 /* ====================================================================
00040  * Copyright (c) 1998-2002 The OpenSSL Project.  All rights reserved.
00041  *
00042  * Redistribution and use in source and binary forms, with or without
00043  * modification, are permitted provided that the following conditions
00044  * are met:
00045  *
00046  * 1. Redistributions of source code must retain the above copyright
00047  *    notice, this list of conditions and the following disclaimer.
00048  *
00049  * 2. Redistributions in binary form must reproduce the above copyright
00050  *    notice, this list of conditions and the following disclaimer in
00051  *    the documentation and/or other materials provided with the
00052  *    distribution.
00053  *
00054  * 3. All advertising materials mentioning features or use of this
00055  *    software must display the following acknowledgment:
00056  *    "This product includes software developed by the OpenSSL Project
00057  *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
00058  *
00059  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
00060  *    endorse or promote products derived from this software without
00061  *    prior written permission. For written permission, please contact
00062  *    openssl-core@openssl.org.
00063  *
00064  * 5. Products derived from this software may not be called "OpenSSL"
00065  *    nor may "OpenSSL" appear in their names without prior written
00066  *    permission of the OpenSSL Project.
00067  *
00068  * 6. Redistributions of any form whatsoever must retain the following
00069  *    acknowledgment:
00070  *    "This product includes software developed by the OpenSSL Project
00071  *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
00072  *
00073  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
00074  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00075  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00076  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
00077  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00078  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
00079  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00080  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00081  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
00082  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00083  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
00084  * OF THE POSSIBILITY OF SUCH DAMAGE.
00085  * ====================================================================
00086  *
00087  * This product includes cryptographic software written by Eric Young
00088  * (eay@cryptsoft.com).  This product includes software written by Tim
00089  * Hudson (tjh@cryptsoft.com).
00090  *
00091  */
00092 
00093 #ifndef HEADER_DES_H
00094 # define HEADER_DES_H
00095 
00096 # include <openssl/e_os2.h>     /* OPENSSL_EXTERN, OPENSSL_NO_DES, DES_LONG */
00097 
00098 # ifdef OPENSSL_NO_DES
00099 #  error DES is disabled.
00100 # endif
00101 
00102 # ifndef HEADER_NEW_DES_H
00103 #  error You must include des.h, not des_old.h directly.
00104 # endif
00105 
00106 # ifdef _KERBEROS_DES_H
00107 #  error <openssl/des_old.h> replaces <kerberos/des.h>.
00108 # endif
00109 
00110 # include <openssl/symhacks.h>
00111 
00112 # ifdef OPENSSL_BUILD_SHLIBCRYPTO
00113 #  undef OPENSSL_EXTERN
00114 #  define OPENSSL_EXTERN OPENSSL_EXPORT
00115 # endif
00116 
00117 #ifdef  __cplusplus
00118 extern "C" {
00119 #endif
00120 
00121 # ifdef _
00122 #  undef _
00123 # endif
00124 
00125 typedef unsigned char _ossl_old_des_cblock[8];
00126 typedef struct _ossl_old_des_ks_struct {
00127     union {
00128         _ossl_old_des_cblock _;
00129         /*
00130          * make sure things are correct size on machines with 8 byte longs
00131          */
00132         DES_LONG pad[2];
00133     } ks;
00134 } _ossl_old_des_key_schedule[16];
00135 
00136 # ifndef OPENSSL_DES_LIBDES_COMPATIBILITY
00137 #  define des_cblock DES_cblock
00138 #  define const_des_cblock const_DES_cblock
00139 #  define des_key_schedule DES_key_schedule
00140 #  define des_ecb3_encrypt(i,o,k1,k2,k3,e)\
00141         DES_ecb3_encrypt((i),(o),&(k1),&(k2),&(k3),(e))
00142 #  define des_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e)\
00143         DES_ede3_cbc_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(e))
00144 #  define des_ede3_cbcm_encrypt(i,o,l,k1,k2,k3,iv1,iv2,e)\
00145         DES_ede3_cbcm_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv1),(iv2),(e))
00146 #  define des_ede3_cfb64_encrypt(i,o,l,k1,k2,k3,iv,n,e)\
00147         DES_ede3_cfb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n),(e))
00148 #  define des_ede3_ofb64_encrypt(i,o,l,k1,k2,k3,iv,n)\
00149         DES_ede3_ofb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n))
00150 #  define des_options()\
00151         DES_options()
00152 #  define des_cbc_cksum(i,o,l,k,iv)\
00153         DES_cbc_cksum((i),(o),(l),&(k),(iv))
00154 #  define des_cbc_encrypt(i,o,l,k,iv,e)\
00155         DES_cbc_encrypt((i),(o),(l),&(k),(iv),(e))
00156 #  define des_ncbc_encrypt(i,o,l,k,iv,e)\
00157         DES_ncbc_encrypt((i),(o),(l),&(k),(iv),(e))
00158 #  define des_xcbc_encrypt(i,o,l,k,iv,inw,outw,e)\
00159         DES_xcbc_encrypt((i),(o),(l),&(k),(iv),(inw),(outw),(e))
00160 #  define des_cfb_encrypt(i,o,n,l,k,iv,e)\
00161         DES_cfb_encrypt((i),(o),(n),(l),&(k),(iv),(e))
00162 #  define des_ecb_encrypt(i,o,k,e)\
00163         DES_ecb_encrypt((i),(o),&(k),(e))
00164 #  define des_encrypt1(d,k,e)\
00165         DES_encrypt1((d),&(k),(e))
00166 #  define des_encrypt2(d,k,e)\
00167         DES_encrypt2((d),&(k),(e))
00168 #  define des_encrypt3(d,k1,k2,k3)\
00169         DES_encrypt3((d),&(k1),&(k2),&(k3))
00170 #  define des_decrypt3(d,k1,k2,k3)\
00171         DES_decrypt3((d),&(k1),&(k2),&(k3))
00172 #  define des_xwhite_in2out(k,i,o)\
00173         DES_xwhite_in2out((k),(i),(o))
00174 #  define des_enc_read(f,b,l,k,iv)\
00175         DES_enc_read((f),(b),(l),&(k),(iv))
00176 #  define des_enc_write(f,b,l,k,iv)\
00177         DES_enc_write((f),(b),(l),&(k),(iv))
00178 #  define des_fcrypt(b,s,r)\
00179         DES_fcrypt((b),(s),(r))
00180 #  if 0
00181 #   define des_crypt(b,s)\
00182         DES_crypt((b),(s))
00183 #   if !defined(PERL5) && !defined(__FreeBSD__) && !defined(NeXT) && !defined(__OpenBSD__)
00184 #    define crypt(b,s)\
00185         DES_crypt((b),(s))
00186 #   endif
00187 #  endif
00188 #  define des_ofb_encrypt(i,o,n,l,k,iv)\
00189         DES_ofb_encrypt((i),(o),(n),(l),&(k),(iv))
00190 #  define des_pcbc_encrypt(i,o,l,k,iv,e)\
00191         DES_pcbc_encrypt((i),(o),(l),&(k),(iv),(e))
00192 #  define des_quad_cksum(i,o,l,c,s)\
00193         DES_quad_cksum((i),(o),(l),(c),(s))
00194 #  define des_random_seed(k)\
00195         _ossl_096_des_random_seed((k))
00196 #  define des_random_key(r)\
00197         DES_random_key((r))
00198 #  define des_read_password(k,p,v) \
00199         DES_read_password((k),(p),(v))
00200 #  define des_read_2passwords(k1,k2,p,v) \
00201         DES_read_2passwords((k1),(k2),(p),(v))
00202 #  define des_set_odd_parity(k)\
00203         DES_set_odd_parity((k))
00204 #  define des_check_key_parity(k)\
00205         DES_check_key_parity((k))
00206 #  define des_is_weak_key(k)\
00207         DES_is_weak_key((k))
00208 #  define des_set_key(k,ks)\
00209         DES_set_key((k),&(ks))
00210 #  define des_key_sched(k,ks)\
00211         DES_key_sched((k),&(ks))
00212 #  define des_set_key_checked(k,ks)\
00213         DES_set_key_checked((k),&(ks))
00214 #  define des_set_key_unchecked(k,ks)\
00215         DES_set_key_unchecked((k),&(ks))
00216 #  define des_string_to_key(s,k)\
00217         DES_string_to_key((s),(k))
00218 #  define des_string_to_2keys(s,k1,k2)\
00219         DES_string_to_2keys((s),(k1),(k2))
00220 #  define des_cfb64_encrypt(i,o,l,ks,iv,n,e)\
00221         DES_cfb64_encrypt((i),(o),(l),&(ks),(iv),(n),(e))
00222 #  define des_ofb64_encrypt(i,o,l,ks,iv,n)\
00223         DES_ofb64_encrypt((i),(o),(l),&(ks),(iv),(n))
00224 
00225 #  define des_ecb2_encrypt(i,o,k1,k2,e) \
00226         des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))
00227 
00228 #  define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \
00229         des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))
00230 
00231 #  define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \
00232         des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e))
00233 
00234 #  define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \
00235         des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))
00236 
00237 #  define des_check_key DES_check_key
00238 #  define des_rw_mode DES_rw_mode
00239 # else                          /* libdes compatibility */
00240 /*
00241  * Map all symbol names to _ossl_old_des_* form, so we avoid all clashes with
00242  * libdes
00243  */
00244 #  define des_cblock _ossl_old_des_cblock
00245 #  define des_key_schedule _ossl_old_des_key_schedule
00246 #  define des_ecb3_encrypt(i,o,k1,k2,k3,e)\
00247         _ossl_old_des_ecb3_encrypt((i),(o),(k1),(k2),(k3),(e))
00248 #  define des_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e)\
00249         _ossl_old_des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(e))
00250 #  define des_ede3_cfb64_encrypt(i,o,l,k1,k2,k3,iv,n,e)\
00251         _ossl_old_des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n),(e))
00252 #  define des_ede3_ofb64_encrypt(i,o,l,k1,k2,k3,iv,n)\
00253         _ossl_old_des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n))
00254 #  define des_options()\
00255         _ossl_old_des_options()
00256 #  define des_cbc_cksum(i,o,l,k,iv)\
00257         _ossl_old_des_cbc_cksum((i),(o),(l),(k),(iv))
00258 #  define des_cbc_encrypt(i,o,l,k,iv,e)\
00259         _ossl_old_des_cbc_encrypt((i),(o),(l),(k),(iv),(e))
00260 #  define des_ncbc_encrypt(i,o,l,k,iv,e)\
00261         _ossl_old_des_ncbc_encrypt((i),(o),(l),(k),(iv),(e))
00262 #  define des_xcbc_encrypt(i,o,l,k,iv,inw,outw,e)\
00263         _ossl_old_des_xcbc_encrypt((i),(o),(l),(k),(iv),(inw),(outw),(e))
00264 #  define des_cfb_encrypt(i,o,n,l,k,iv,e)\
00265         _ossl_old_des_cfb_encrypt((i),(o),(n),(l),(k),(iv),(e))
00266 #  define des_ecb_encrypt(i,o,k,e)\
00267         _ossl_old_des_ecb_encrypt((i),(o),(k),(e))
00268 #  define des_encrypt(d,k,e)\
00269         _ossl_old_des_encrypt((d),(k),(e))
00270 #  define des_encrypt2(d,k,e)\
00271         _ossl_old_des_encrypt2((d),(k),(e))
00272 #  define des_encrypt3(d,k1,k2,k3)\
00273         _ossl_old_des_encrypt3((d),(k1),(k2),(k3))
00274 #  define des_decrypt3(d,k1,k2,k3)\
00275         _ossl_old_des_decrypt3((d),(k1),(k2),(k3))
00276 #  define des_xwhite_in2out(k,i,o)\
00277         _ossl_old_des_xwhite_in2out((k),(i),(o))
00278 #  define des_enc_read(f,b,l,k,iv)\
00279         _ossl_old_des_enc_read((f),(b),(l),(k),(iv))
00280 #  define des_enc_write(f,b,l,k,iv)\
00281         _ossl_old_des_enc_write((f),(b),(l),(k),(iv))
00282 #  define des_fcrypt(b,s,r)\
00283         _ossl_old_des_fcrypt((b),(s),(r))
00284 #  define des_crypt(b,s)\
00285         _ossl_old_des_crypt((b),(s))
00286 #  if 0
00287 #   define crypt(b,s)\
00288         _ossl_old_crypt((b),(s))
00289 #  endif
00290 #  define des_ofb_encrypt(i,o,n,l,k,iv)\
00291         _ossl_old_des_ofb_encrypt((i),(o),(n),(l),(k),(iv))
00292 #  define des_pcbc_encrypt(i,o,l,k,iv,e)\
00293         _ossl_old_des_pcbc_encrypt((i),(o),(l),(k),(iv),(e))
00294 #  define des_quad_cksum(i,o,l,c,s)\
00295         _ossl_old_des_quad_cksum((i),(o),(l),(c),(s))
00296 #  define des_random_seed(k)\
00297         _ossl_old_des_random_seed((k))
00298 #  define des_random_key(r)\
00299         _ossl_old_des_random_key((r))
00300 #  define des_read_password(k,p,v) \
00301         _ossl_old_des_read_password((k),(p),(v))
00302 #  define des_read_2passwords(k1,k2,p,v) \
00303         _ossl_old_des_read_2passwords((k1),(k2),(p),(v))
00304 #  define des_set_odd_parity(k)\
00305         _ossl_old_des_set_odd_parity((k))
00306 #  define des_is_weak_key(k)\
00307         _ossl_old_des_is_weak_key((k))
00308 #  define des_set_key(k,ks)\
00309         _ossl_old_des_set_key((k),(ks))
00310 #  define des_key_sched(k,ks)\
00311         _ossl_old_des_key_sched((k),(ks))
00312 #  define des_string_to_key(s,k)\
00313         _ossl_old_des_string_to_key((s),(k))
00314 #  define des_string_to_2keys(s,k1,k2)\
00315         _ossl_old_des_string_to_2keys((s),(k1),(k2))
00316 #  define des_cfb64_encrypt(i,o,l,ks,iv,n,e)\
00317         _ossl_old_des_cfb64_encrypt((i),(o),(l),(ks),(iv),(n),(e))
00318 #  define des_ofb64_encrypt(i,o,l,ks,iv,n)\
00319         _ossl_old_des_ofb64_encrypt((i),(o),(l),(ks),(iv),(n))
00320 
00321 #  define des_ecb2_encrypt(i,o,k1,k2,e) \
00322         des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))
00323 
00324 #  define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \
00325         des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))
00326 
00327 #  define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \
00328         des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e))
00329 
00330 #  define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \
00331         des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))
00332 
00333 #  define des_check_key DES_check_key
00334 #  define des_rw_mode DES_rw_mode
00335 # endif
00336 
00337 const char *_ossl_old_des_options(void);
00338 void _ossl_old_des_ecb3_encrypt(_ossl_old_des_cblock *input,
00339                                 _ossl_old_des_cblock *output,
00340                                 _ossl_old_des_key_schedule ks1,
00341                                 _ossl_old_des_key_schedule ks2,
00342                                 _ossl_old_des_key_schedule ks3, int enc);
00343 DES_LONG _ossl_old_des_cbc_cksum(_ossl_old_des_cblock *input,
00344                                  _ossl_old_des_cblock *output, long length,
00345                                  _ossl_old_des_key_schedule schedule,
00346                                  _ossl_old_des_cblock *ivec);
00347 void _ossl_old_des_cbc_encrypt(_ossl_old_des_cblock *input,
00348                                _ossl_old_des_cblock *output, long length,
00349                                _ossl_old_des_key_schedule schedule,
00350                                _ossl_old_des_cblock *ivec, int enc);
00351 void _ossl_old_des_ncbc_encrypt(_ossl_old_des_cblock *input,
00352                                 _ossl_old_des_cblock *output, long length,
00353                                 _ossl_old_des_key_schedule schedule,
00354                                 _ossl_old_des_cblock *ivec, int enc);
00355 void _ossl_old_des_xcbc_encrypt(_ossl_old_des_cblock *input,
00356                                 _ossl_old_des_cblock *output, long length,
00357                                 _ossl_old_des_key_schedule schedule,
00358                                 _ossl_old_des_cblock *ivec,
00359                                 _ossl_old_des_cblock *inw,
00360                                 _ossl_old_des_cblock *outw, int enc);
00361 void _ossl_old_des_cfb_encrypt(unsigned char *in, unsigned char *out,
00362                                int numbits, long length,
00363                                _ossl_old_des_key_schedule schedule,
00364                                _ossl_old_des_cblock *ivec, int enc);
00365 void _ossl_old_des_ecb_encrypt(_ossl_old_des_cblock *input,
00366                                _ossl_old_des_cblock *output,
00367                                _ossl_old_des_key_schedule ks, int enc);
00368 void _ossl_old_des_encrypt(DES_LONG *data, _ossl_old_des_key_schedule ks,
00369                            int enc);
00370 void _ossl_old_des_encrypt2(DES_LONG *data, _ossl_old_des_key_schedule ks,
00371                             int enc);
00372 void _ossl_old_des_encrypt3(DES_LONG *data, _ossl_old_des_key_schedule ks1,
00373                             _ossl_old_des_key_schedule ks2,
00374                             _ossl_old_des_key_schedule ks3);
00375 void _ossl_old_des_decrypt3(DES_LONG *data, _ossl_old_des_key_schedule ks1,
00376                             _ossl_old_des_key_schedule ks2,
00377                             _ossl_old_des_key_schedule ks3);
00378 void _ossl_old_des_ede3_cbc_encrypt(_ossl_old_des_cblock *input,
00379                                     _ossl_old_des_cblock *output, long length,
00380                                     _ossl_old_des_key_schedule ks1,
00381                                     _ossl_old_des_key_schedule ks2,
00382                                     _ossl_old_des_key_schedule ks3,
00383                                     _ossl_old_des_cblock *ivec, int enc);
00384 void _ossl_old_des_ede3_cfb64_encrypt(unsigned char *in, unsigned char *out,
00385                                       long length,
00386                                       _ossl_old_des_key_schedule ks1,
00387                                       _ossl_old_des_key_schedule ks2,
00388                                       _ossl_old_des_key_schedule ks3,
00389                                       _ossl_old_des_cblock *ivec, int *num,
00390                                       int enc);
00391 void _ossl_old_des_ede3_ofb64_encrypt(unsigned char *in, unsigned char *out,
00392                                       long length,
00393                                       _ossl_old_des_key_schedule ks1,
00394                                       _ossl_old_des_key_schedule ks2,
00395                                       _ossl_old_des_key_schedule ks3,
00396                                       _ossl_old_des_cblock *ivec, int *num);
00397 # if 0
00398 void _ossl_old_des_xwhite_in2out(_ossl_old_des_cblock (*des_key),
00399                                  _ossl_old_des_cblock (*in_white),
00400                                  _ossl_old_des_cblock (*out_white));
00401 # endif
00402 
00403 int _ossl_old_des_enc_read(int fd, char *buf, int len,
00404                            _ossl_old_des_key_schedule sched,
00405                            _ossl_old_des_cblock *iv);
00406 int _ossl_old_des_enc_write(int fd, char *buf, int len,
00407                             _ossl_old_des_key_schedule sched,
00408                             _ossl_old_des_cblock *iv);
00409 char *_ossl_old_des_fcrypt(const char *buf, const char *salt, char *ret);
00410 char *_ossl_old_des_crypt(const char *buf, const char *salt);
00411 # if !defined(PERL5) && !defined(NeXT)
00412 char *_ossl_old_crypt(const char *buf, const char *salt);
00413 # endif
00414 void _ossl_old_des_ofb_encrypt(unsigned char *in, unsigned char *out,
00415                                int numbits, long length,
00416                                _ossl_old_des_key_schedule schedule,
00417                                _ossl_old_des_cblock *ivec);
00418 void _ossl_old_des_pcbc_encrypt(_ossl_old_des_cblock *input,
00419                                 _ossl_old_des_cblock *output, long length,
00420                                 _ossl_old_des_key_schedule schedule,
00421                                 _ossl_old_des_cblock *ivec, int enc);
00422 DES_LONG _ossl_old_des_quad_cksum(_ossl_old_des_cblock *input,
00423                                   _ossl_old_des_cblock *output, long length,
00424                                   int out_count, _ossl_old_des_cblock *seed);
00425 void _ossl_old_des_random_seed(_ossl_old_des_cblock key);
00426 void _ossl_old_des_random_key(_ossl_old_des_cblock ret);
00427 int _ossl_old_des_read_password(_ossl_old_des_cblock *key, const char *prompt,
00428                                 int verify);
00429 int _ossl_old_des_read_2passwords(_ossl_old_des_cblock *key1,
00430                                   _ossl_old_des_cblock *key2,
00431                                   const char *prompt, int verify);
00432 void _ossl_old_des_set_odd_parity(_ossl_old_des_cblock *key);
00433 int _ossl_old_des_is_weak_key(_ossl_old_des_cblock *key);
00434 int _ossl_old_des_set_key(_ossl_old_des_cblock *key,
00435                           _ossl_old_des_key_schedule schedule);
00436 int _ossl_old_des_key_sched(_ossl_old_des_cblock *key,
00437                             _ossl_old_des_key_schedule schedule);
00438 void _ossl_old_des_string_to_key(char *str, _ossl_old_des_cblock *key);
00439 void _ossl_old_des_string_to_2keys(char *str, _ossl_old_des_cblock *key1,
00440                                    _ossl_old_des_cblock *key2);
00441 void _ossl_old_des_cfb64_encrypt(unsigned char *in, unsigned char *out,
00442                                  long length,
00443                                  _ossl_old_des_key_schedule schedule,
00444                                  _ossl_old_des_cblock *ivec, int *num,
00445                                  int enc);
00446 void _ossl_old_des_ofb64_encrypt(unsigned char *in, unsigned char *out,
00447                                  long length,
00448                                  _ossl_old_des_key_schedule schedule,
00449                                  _ossl_old_des_cblock *ivec, int *num);
00450 
00451 void _ossl_096_des_random_seed(des_cblock *key);
00452 
00453 /*
00454  * The following definitions provide compatibility with the MIT Kerberos
00455  * library. The _ossl_old_des_key_schedule structure is not binary
00456  * compatible.
00457  */
00458 
00459 # define _KERBEROS_DES_H
00460 
00461 # define KRBDES_ENCRYPT DES_ENCRYPT
00462 # define KRBDES_DECRYPT DES_DECRYPT
00463 
00464 # ifdef KERBEROS
00465 #  define ENCRYPT DES_ENCRYPT
00466 #  define DECRYPT DES_DECRYPT
00467 # endif
00468 
00469 # ifndef NCOMPAT
00470 #  define C_Block des_cblock
00471 #  define Key_schedule des_key_schedule
00472 #  define KEY_SZ DES_KEY_SZ
00473 #  define string_to_key des_string_to_key
00474 #  define read_pw_string des_read_pw_string
00475 #  define random_key des_random_key
00476 #  define pcbc_encrypt des_pcbc_encrypt
00477 #  define set_key des_set_key
00478 #  define key_sched des_key_sched
00479 #  define ecb_encrypt des_ecb_encrypt
00480 #  define cbc_encrypt des_cbc_encrypt
00481 #  define ncbc_encrypt des_ncbc_encrypt
00482 #  define xcbc_encrypt des_xcbc_encrypt
00483 #  define cbc_cksum des_cbc_cksum
00484 #  define quad_cksum des_quad_cksum
00485 #  define check_parity des_check_key_parity
00486 # endif
00487 
00488 # define des_fixup_key_parity DES_fixup_key_parity
00489 
00490 #ifdef  __cplusplus
00491 }
00492 #endif
00493 
00494 /* for DES_read_pw_string et al */
00495 # include <openssl/ui_compat.h>
00496 
00497 #endif