des_old.h 18 KB

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