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