des_old.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497
  1. /* crypto/des/des_old.h */
  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 ([email protected]) for the OpenSSL project
  35. * 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. * [email protected].
  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. * ([email protected]). This product includes software written by Tim
  87. * Hudson ([email protected]).
  88. *
  89. */
  90. #ifndef HEADER_DES_H
  91. # define HEADER_DES_H
  92. # include <openssl/e_os2.h> /* OPENSSL_EXTERN, OPENSSL_NO_DES, DES_LONG */
  93. # ifdef OPENSSL_NO_DES
  94. # error DES is disabled.
  95. # endif
  96. # ifndef HEADER_NEW_DES_H
  97. # error You must include des.h, not des_old.h directly.
  98. # endif
  99. # ifdef _KERBEROS_DES_H
  100. # error <openssl/des_old.h> replaces <kerberos/des.h>.
  101. # endif
  102. # include <openssl/symhacks.h>
  103. # ifdef OPENSSL_BUILD_SHLIBCRYPTO
  104. # undef OPENSSL_EXTERN
  105. # define OPENSSL_EXTERN OPENSSL_EXPORT
  106. # endif
  107. #ifdef __cplusplus
  108. extern "C" {
  109. #endif
  110. # ifdef _
  111. # undef _
  112. # endif
  113. typedef unsigned char _ossl_old_des_cblock[8];
  114. typedef struct _ossl_old_des_ks_struct {
  115. union {
  116. _ossl_old_des_cblock _;
  117. /*
  118. * make sure things are correct size on machines with 8 byte longs
  119. */
  120. DES_LONG pad[2];
  121. } ks;
  122. } _ossl_old_des_key_schedule[16];
  123. # ifndef OPENSSL_DES_LIBDES_COMPATIBILITY
  124. # define des_cblock DES_cblock
  125. # define const_des_cblock const_DES_cblock
  126. # define des_key_schedule DES_key_schedule
  127. # define des_ecb3_encrypt(i,o,k1,k2,k3,e)\
  128. DES_ecb3_encrypt((i),(o),&(k1),&(k2),&(k3),(e))
  129. # define des_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e)\
  130. DES_ede3_cbc_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(e))
  131. # define des_ede3_cbcm_encrypt(i,o,l,k1,k2,k3,iv1,iv2,e)\
  132. DES_ede3_cbcm_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv1),(iv2),(e))
  133. # define des_ede3_cfb64_encrypt(i,o,l,k1,k2,k3,iv,n,e)\
  134. DES_ede3_cfb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n),(e))
  135. # define des_ede3_ofb64_encrypt(i,o,l,k1,k2,k3,iv,n)\
  136. DES_ede3_ofb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n))
  137. # define des_options()\
  138. DES_options()
  139. # define des_cbc_cksum(i,o,l,k,iv)\
  140. DES_cbc_cksum((i),(o),(l),&(k),(iv))
  141. # define des_cbc_encrypt(i,o,l,k,iv,e)\
  142. DES_cbc_encrypt((i),(o),(l),&(k),(iv),(e))
  143. # define des_ncbc_encrypt(i,o,l,k,iv,e)\
  144. DES_ncbc_encrypt((i),(o),(l),&(k),(iv),(e))
  145. # define des_xcbc_encrypt(i,o,l,k,iv,inw,outw,e)\
  146. DES_xcbc_encrypt((i),(o),(l),&(k),(iv),(inw),(outw),(e))
  147. # define des_cfb_encrypt(i,o,n,l,k,iv,e)\
  148. DES_cfb_encrypt((i),(o),(n),(l),&(k),(iv),(e))
  149. # define des_ecb_encrypt(i,o,k,e)\
  150. DES_ecb_encrypt((i),(o),&(k),(e))
  151. # define des_encrypt1(d,k,e)\
  152. DES_encrypt1((d),&(k),(e))
  153. # define des_encrypt2(d,k,e)\
  154. DES_encrypt2((d),&(k),(e))
  155. # define des_encrypt3(d,k1,k2,k3)\
  156. DES_encrypt3((d),&(k1),&(k2),&(k3))
  157. # define des_decrypt3(d,k1,k2,k3)\
  158. DES_decrypt3((d),&(k1),&(k2),&(k3))
  159. # define des_xwhite_in2out(k,i,o)\
  160. DES_xwhite_in2out((k),(i),(o))
  161. # define des_enc_read(f,b,l,k,iv)\
  162. DES_enc_read((f),(b),(l),&(k),(iv))
  163. # define des_enc_write(f,b,l,k,iv)\
  164. DES_enc_write((f),(b),(l),&(k),(iv))
  165. # define des_fcrypt(b,s,r)\
  166. DES_fcrypt((b),(s),(r))
  167. # if 0
  168. # define des_crypt(b,s)\
  169. DES_crypt((b),(s))
  170. # if !defined(PERL5) && !defined(__FreeBSD__) && !defined(NeXT) && !defined(__OpenBSD__)
  171. # define crypt(b,s)\
  172. DES_crypt((b),(s))
  173. # endif
  174. # endif
  175. # define des_ofb_encrypt(i,o,n,l,k,iv)\
  176. DES_ofb_encrypt((i),(o),(n),(l),&(k),(iv))
  177. # define des_pcbc_encrypt(i,o,l,k,iv,e)\
  178. DES_pcbc_encrypt((i),(o),(l),&(k),(iv),(e))
  179. # define des_quad_cksum(i,o,l,c,s)\
  180. DES_quad_cksum((i),(o),(l),(c),(s))
  181. # define des_random_seed(k)\
  182. _ossl_096_des_random_seed((k))
  183. # define des_random_key(r)\
  184. DES_random_key((r))
  185. # define des_read_password(k,p,v) \
  186. DES_read_password((k),(p),(v))
  187. # define des_read_2passwords(k1,k2,p,v) \
  188. DES_read_2passwords((k1),(k2),(p),(v))
  189. # define des_set_odd_parity(k)\
  190. DES_set_odd_parity((k))
  191. # define des_check_key_parity(k)\
  192. DES_check_key_parity((k))
  193. # define des_is_weak_key(k)\
  194. DES_is_weak_key((k))
  195. # define des_set_key(k,ks)\
  196. DES_set_key((k),&(ks))
  197. # define des_key_sched(k,ks)\
  198. DES_key_sched((k),&(ks))
  199. # define des_set_key_checked(k,ks)\
  200. DES_set_key_checked((k),&(ks))
  201. # define des_set_key_unchecked(k,ks)\
  202. DES_set_key_unchecked((k),&(ks))
  203. # define des_string_to_key(s,k)\
  204. DES_string_to_key((s),(k))
  205. # define des_string_to_2keys(s,k1,k2)\
  206. DES_string_to_2keys((s),(k1),(k2))
  207. # define des_cfb64_encrypt(i,o,l,ks,iv,n,e)\
  208. DES_cfb64_encrypt((i),(o),(l),&(ks),(iv),(n),(e))
  209. # define des_ofb64_encrypt(i,o,l,ks,iv,n)\
  210. DES_ofb64_encrypt((i),(o),(l),&(ks),(iv),(n))
  211. # define des_ecb2_encrypt(i,o,k1,k2,e) \
  212. des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))
  213. # define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \
  214. des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))
  215. # define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \
  216. des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e))
  217. # define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \
  218. des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))
  219. # define des_check_key DES_check_key
  220. # define des_rw_mode DES_rw_mode
  221. # else /* libdes compatibility */
  222. /*
  223. * Map all symbol names to _ossl_old_des_* form, so we avoid all clashes with
  224. * libdes
  225. */
  226. # define des_cblock _ossl_old_des_cblock
  227. # define des_key_schedule _ossl_old_des_key_schedule
  228. # define des_ecb3_encrypt(i,o,k1,k2,k3,e)\
  229. _ossl_old_des_ecb3_encrypt((i),(o),(k1),(k2),(k3),(e))
  230. # define des_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e)\
  231. _ossl_old_des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(e))
  232. # define des_ede3_cfb64_encrypt(i,o,l,k1,k2,k3,iv,n,e)\
  233. _ossl_old_des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n),(e))
  234. # define des_ede3_ofb64_encrypt(i,o,l,k1,k2,k3,iv,n)\
  235. _ossl_old_des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n))
  236. # define des_options()\
  237. _ossl_old_des_options()
  238. # define des_cbc_cksum(i,o,l,k,iv)\
  239. _ossl_old_des_cbc_cksum((i),(o),(l),(k),(iv))
  240. # define des_cbc_encrypt(i,o,l,k,iv,e)\
  241. _ossl_old_des_cbc_encrypt((i),(o),(l),(k),(iv),(e))
  242. # define des_ncbc_encrypt(i,o,l,k,iv,e)\
  243. _ossl_old_des_ncbc_encrypt((i),(o),(l),(k),(iv),(e))
  244. # define des_xcbc_encrypt(i,o,l,k,iv,inw,outw,e)\
  245. _ossl_old_des_xcbc_encrypt((i),(o),(l),(k),(iv),(inw),(outw),(e))
  246. # define des_cfb_encrypt(i,o,n,l,k,iv,e)\
  247. _ossl_old_des_cfb_encrypt((i),(o),(n),(l),(k),(iv),(e))
  248. # define des_ecb_encrypt(i,o,k,e)\
  249. _ossl_old_des_ecb_encrypt((i),(o),(k),(e))
  250. # define des_encrypt(d,k,e)\
  251. _ossl_old_des_encrypt((d),(k),(e))
  252. # define des_encrypt2(d,k,e)\
  253. _ossl_old_des_encrypt2((d),(k),(e))
  254. # define des_encrypt3(d,k1,k2,k3)\
  255. _ossl_old_des_encrypt3((d),(k1),(k2),(k3))
  256. # define des_decrypt3(d,k1,k2,k3)\
  257. _ossl_old_des_decrypt3((d),(k1),(k2),(k3))
  258. # define des_xwhite_in2out(k,i,o)\
  259. _ossl_old_des_xwhite_in2out((k),(i),(o))
  260. # define des_enc_read(f,b,l,k,iv)\
  261. _ossl_old_des_enc_read((f),(b),(l),(k),(iv))
  262. # define des_enc_write(f,b,l,k,iv)\
  263. _ossl_old_des_enc_write((f),(b),(l),(k),(iv))
  264. # define des_fcrypt(b,s,r)\
  265. _ossl_old_des_fcrypt((b),(s),(r))
  266. # define des_crypt(b,s)\
  267. _ossl_old_des_crypt((b),(s))
  268. # if 0
  269. # define crypt(b,s)\
  270. _ossl_old_crypt((b),(s))
  271. # endif
  272. # define des_ofb_encrypt(i,o,n,l,k,iv)\
  273. _ossl_old_des_ofb_encrypt((i),(o),(n),(l),(k),(iv))
  274. # define des_pcbc_encrypt(i,o,l,k,iv,e)\
  275. _ossl_old_des_pcbc_encrypt((i),(o),(l),(k),(iv),(e))
  276. # define des_quad_cksum(i,o,l,c,s)\
  277. _ossl_old_des_quad_cksum((i),(o),(l),(c),(s))
  278. # define des_random_seed(k)\
  279. _ossl_old_des_random_seed((k))
  280. # define des_random_key(r)\
  281. _ossl_old_des_random_key((r))
  282. # define des_read_password(k,p,v) \
  283. _ossl_old_des_read_password((k),(p),(v))
  284. # define des_read_2passwords(k1,k2,p,v) \
  285. _ossl_old_des_read_2passwords((k1),(k2),(p),(v))
  286. # define des_set_odd_parity(k)\
  287. _ossl_old_des_set_odd_parity((k))
  288. # define des_is_weak_key(k)\
  289. _ossl_old_des_is_weak_key((k))
  290. # define des_set_key(k,ks)\
  291. _ossl_old_des_set_key((k),(ks))
  292. # define des_key_sched(k,ks)\
  293. _ossl_old_des_key_sched((k),(ks))
  294. # define des_string_to_key(s,k)\
  295. _ossl_old_des_string_to_key((s),(k))
  296. # define des_string_to_2keys(s,k1,k2)\
  297. _ossl_old_des_string_to_2keys((s),(k1),(k2))
  298. # define des_cfb64_encrypt(i,o,l,ks,iv,n,e)\
  299. _ossl_old_des_cfb64_encrypt((i),(o),(l),(ks),(iv),(n),(e))
  300. # define des_ofb64_encrypt(i,o,l,ks,iv,n)\
  301. _ossl_old_des_ofb64_encrypt((i),(o),(l),(ks),(iv),(n))
  302. # define des_ecb2_encrypt(i,o,k1,k2,e) \
  303. des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))
  304. # define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \
  305. des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))
  306. # define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \
  307. des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e))
  308. # define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \
  309. des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))
  310. # define des_check_key DES_check_key
  311. # define des_rw_mode DES_rw_mode
  312. # endif
  313. const char *_ossl_old_des_options(void);
  314. void _ossl_old_des_ecb3_encrypt(_ossl_old_des_cblock *input,
  315. _ossl_old_des_cblock *output,
  316. _ossl_old_des_key_schedule ks1,
  317. _ossl_old_des_key_schedule ks2,
  318. _ossl_old_des_key_schedule ks3, int enc);
  319. DES_LONG _ossl_old_des_cbc_cksum(_ossl_old_des_cblock *input,
  320. _ossl_old_des_cblock *output, long length,
  321. _ossl_old_des_key_schedule schedule,
  322. _ossl_old_des_cblock *ivec);
  323. void _ossl_old_des_cbc_encrypt(_ossl_old_des_cblock *input,
  324. _ossl_old_des_cblock *output, long length,
  325. _ossl_old_des_key_schedule schedule,
  326. _ossl_old_des_cblock *ivec, int enc);
  327. void _ossl_old_des_ncbc_encrypt(_ossl_old_des_cblock *input,
  328. _ossl_old_des_cblock *output, long length,
  329. _ossl_old_des_key_schedule schedule,
  330. _ossl_old_des_cblock *ivec, int enc);
  331. void _ossl_old_des_xcbc_encrypt(_ossl_old_des_cblock *input,
  332. _ossl_old_des_cblock *output, long length,
  333. _ossl_old_des_key_schedule schedule,
  334. _ossl_old_des_cblock *ivec,
  335. _ossl_old_des_cblock *inw,
  336. _ossl_old_des_cblock *outw, int enc);
  337. void _ossl_old_des_cfb_encrypt(unsigned char *in, unsigned char *out,
  338. int numbits, long length,
  339. _ossl_old_des_key_schedule schedule,
  340. _ossl_old_des_cblock *ivec, int enc);
  341. void _ossl_old_des_ecb_encrypt(_ossl_old_des_cblock *input,
  342. _ossl_old_des_cblock *output,
  343. _ossl_old_des_key_schedule ks, int enc);
  344. void _ossl_old_des_encrypt(DES_LONG *data, _ossl_old_des_key_schedule ks,
  345. int enc);
  346. void _ossl_old_des_encrypt2(DES_LONG *data, _ossl_old_des_key_schedule ks,
  347. int enc);
  348. void _ossl_old_des_encrypt3(DES_LONG *data, _ossl_old_des_key_schedule ks1,
  349. _ossl_old_des_key_schedule ks2,
  350. _ossl_old_des_key_schedule ks3);
  351. void _ossl_old_des_decrypt3(DES_LONG *data, _ossl_old_des_key_schedule ks1,
  352. _ossl_old_des_key_schedule ks2,
  353. _ossl_old_des_key_schedule ks3);
  354. void _ossl_old_des_ede3_cbc_encrypt(_ossl_old_des_cblock *input,
  355. _ossl_old_des_cblock *output, long length,
  356. _ossl_old_des_key_schedule ks1,
  357. _ossl_old_des_key_schedule ks2,
  358. _ossl_old_des_key_schedule ks3,
  359. _ossl_old_des_cblock *ivec, int enc);
  360. void _ossl_old_des_ede3_cfb64_encrypt(unsigned char *in, unsigned char *out,
  361. long length,
  362. _ossl_old_des_key_schedule ks1,
  363. _ossl_old_des_key_schedule ks2,
  364. _ossl_old_des_key_schedule ks3,
  365. _ossl_old_des_cblock *ivec, int *num,
  366. int enc);
  367. void _ossl_old_des_ede3_ofb64_encrypt(unsigned char *in, unsigned char *out,
  368. long length,
  369. _ossl_old_des_key_schedule ks1,
  370. _ossl_old_des_key_schedule ks2,
  371. _ossl_old_des_key_schedule ks3,
  372. _ossl_old_des_cblock *ivec, int *num);
  373. # if 0
  374. void _ossl_old_des_xwhite_in2out(_ossl_old_des_cblock (*des_key),
  375. _ossl_old_des_cblock (*in_white),
  376. _ossl_old_des_cblock (*out_white));
  377. # endif
  378. int _ossl_old_des_enc_read(int fd, char *buf, int len,
  379. _ossl_old_des_key_schedule sched,
  380. _ossl_old_des_cblock *iv);
  381. int _ossl_old_des_enc_write(int fd, char *buf, int len,
  382. _ossl_old_des_key_schedule sched,
  383. _ossl_old_des_cblock *iv);
  384. char *_ossl_old_des_fcrypt(const char *buf, const char *salt, char *ret);
  385. char *_ossl_old_des_crypt(const char *buf, const char *salt);
  386. # if !defined(PERL5) && !defined(NeXT)
  387. char *_ossl_old_crypt(const char *buf, const char *salt);
  388. # endif
  389. void _ossl_old_des_ofb_encrypt(unsigned char *in, unsigned char *out,
  390. int numbits, long length,
  391. _ossl_old_des_key_schedule schedule,
  392. _ossl_old_des_cblock *ivec);
  393. void _ossl_old_des_pcbc_encrypt(_ossl_old_des_cblock *input,
  394. _ossl_old_des_cblock *output, long length,
  395. _ossl_old_des_key_schedule schedule,
  396. _ossl_old_des_cblock *ivec, int enc);
  397. DES_LONG _ossl_old_des_quad_cksum(_ossl_old_des_cblock *input,
  398. _ossl_old_des_cblock *output, long length,
  399. int out_count, _ossl_old_des_cblock *seed);
  400. void _ossl_old_des_random_seed(_ossl_old_des_cblock key);
  401. void _ossl_old_des_random_key(_ossl_old_des_cblock ret);
  402. int _ossl_old_des_read_password(_ossl_old_des_cblock *key, const char *prompt,
  403. int verify);
  404. int _ossl_old_des_read_2passwords(_ossl_old_des_cblock *key1,
  405. _ossl_old_des_cblock *key2,
  406. const char *prompt, int verify);
  407. void _ossl_old_des_set_odd_parity(_ossl_old_des_cblock *key);
  408. int _ossl_old_des_is_weak_key(_ossl_old_des_cblock *key);
  409. int _ossl_old_des_set_key(_ossl_old_des_cblock *key,
  410. _ossl_old_des_key_schedule schedule);
  411. int _ossl_old_des_key_sched(_ossl_old_des_cblock *key,
  412. _ossl_old_des_key_schedule schedule);
  413. void _ossl_old_des_string_to_key(char *str, _ossl_old_des_cblock *key);
  414. void _ossl_old_des_string_to_2keys(char *str, _ossl_old_des_cblock *key1,
  415. _ossl_old_des_cblock *key2);
  416. void _ossl_old_des_cfb64_encrypt(unsigned char *in, unsigned char *out,
  417. long length,
  418. _ossl_old_des_key_schedule schedule,
  419. _ossl_old_des_cblock *ivec, int *num,
  420. int enc);
  421. void _ossl_old_des_ofb64_encrypt(unsigned char *in, unsigned char *out,
  422. long length,
  423. _ossl_old_des_key_schedule schedule,
  424. _ossl_old_des_cblock *ivec, int *num);
  425. void _ossl_096_des_random_seed(des_cblock *key);
  426. /*
  427. * The following definitions provide compatibility with the MIT Kerberos
  428. * library. The _ossl_old_des_key_schedule structure is not binary
  429. * compatible.
  430. */
  431. # define _KERBEROS_DES_H
  432. # define KRBDES_ENCRYPT DES_ENCRYPT
  433. # define KRBDES_DECRYPT DES_DECRYPT
  434. # ifdef KERBEROS
  435. # define ENCRYPT DES_ENCRYPT
  436. # define DECRYPT DES_DECRYPT
  437. # endif
  438. # ifndef NCOMPAT
  439. # define C_Block des_cblock
  440. # define Key_schedule des_key_schedule
  441. # define KEY_SZ DES_KEY_SZ
  442. # define string_to_key des_string_to_key
  443. # define read_pw_string des_read_pw_string
  444. # define random_key des_random_key
  445. # define pcbc_encrypt des_pcbc_encrypt
  446. # define set_key des_set_key
  447. # define key_sched des_key_sched
  448. # define ecb_encrypt des_ecb_encrypt
  449. # define cbc_encrypt des_cbc_encrypt
  450. # define ncbc_encrypt des_ncbc_encrypt
  451. # define xcbc_encrypt des_xcbc_encrypt
  452. # define cbc_cksum des_cbc_cksum
  453. # define quad_cksum des_quad_cksum
  454. # define check_parity des_check_key_parity
  455. # endif
  456. # define des_fixup_key_parity DES_fixup_key_parity
  457. #ifdef __cplusplus
  458. }
  459. #endif
  460. /* for DES_read_pw_string et al */
  461. # include <openssl/ui_compat.h>
  462. #endif