home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pthrd004.zip / emx / include / crypt.h next >
Text File  |  1998-10-24  |  2KB  |  79 lines

  1. #ifndef CRYPT_H
  2. #define CRYPT_H
  3.  
  4. #ifdef  __cplusplus
  5. extern "C" {
  6. #endif
  7.  
  8. #include <stdio.h>
  9.  
  10. /* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
  11.  * %20 speed up (longs are 8 bytes, int's are 4). */
  12. #ifndef DES_LONG
  13. #define DES_LONG unsigned long
  14. #endif
  15.  
  16. typedef unsigned char des_cblock[8];
  17. typedef struct des_ks_struct
  18.         {
  19.         union   {
  20.                 des_cblock _;
  21.                 /* make sure things are correct size on machines with
  22.                  * 8 byte longs */
  23.                 DES_LONG pad[2];
  24.                 } ks;
  25. #undef _
  26. #define _       ks._
  27.         } des_key_schedule[16];
  28.  
  29. #define DES_KEY_SZ      (sizeof(des_cblock))
  30. #define DES_SCHEDULE_SZ (sizeof(des_key_schedule))
  31.  
  32. #define DES_ENCRYPT     1
  33. #define DES_DECRYPT     0
  34.  
  35. #define DES_CBC_MODE    0
  36. #define DES_PCBC_MODE   1
  37.  
  38. #define C_Block des_cblock
  39. #define Key_schedule des_key_schedule
  40. #ifdef KERBEROS
  41. #define ENCRYPT DES_ENCRYPT
  42. #define DECRYPT DES_DECRYPT
  43. #endif
  44. #define KEY_SZ DES_KEY_SZ
  45. #define set_key des_set_key
  46. #define key_sched des_key_sched
  47.  
  48. /* For compatibility with the MIT lib - eay 20/05/92 */
  49. typedef des_key_schedule bit_64;
  50. #define des_fixup_key_parity des_set_odd_parity
  51. #define des_check_key_parity check_parity
  52.  
  53. extern int des_check_key;       /* defaults to false */ //
  54.  
  55. char *des_fcrypt(const char *buf,const char *salt, char *ret);
  56. #ifdef PERL5
  57. char *des_crypt(const char *buf,const char *salt);
  58. #else
  59. /* some stupid compilers complain because I have declared char instead
  60.  * of const char */
  61. #ifdef HEADER_DES_LOCL_H
  62. char *crypt(const char *buf,const char *salt);
  63. #else
  64. char *crypt();
  65. #endif
  66. #endif
  67.  
  68. void des_set_odd_parity(des_cblock *key); 
  69. int des_is_weak_key(des_cblock *key); 
  70. int des_set_key(des_cblock *key,des_key_schedule schedule);
  71. int des_key_sched(des_cblock *key,des_key_schedule schedule); 
  72.  
  73.  
  74. #ifdef  __cplusplus
  75. }
  76. #endif
  77.  
  78. #endif
  79.