home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / k95source / ck_des.c < prev    next >
C/C++ Source or Header  |  2020-01-01  |  2KB  |  93 lines

  1. /*
  2.   C K _ D E S . C  -  libDES interface for Kermit 95"
  3.  
  4.   Copyright (C) 1998, 2001, Trustees of Columbia University in the City of New
  5.   York.
  6.  
  7.   Author:
  8.   Jeffrey E Altman (jaltman@secure-endpoints.com)
  9. */
  10.  
  11. /*
  12.    This file contains wrappers so that the following functions will be imported
  13.    into the k95crypt.dll/k2crypt.dll files in such a form that they can be
  14.    re-exported to k95.exe/k2.exe.  This subset of the DES library is needed to
  15.    provide DES based Kerberos authentication.
  16. */
  17.  
  18. #ifdef LIBDES
  19. /* The following is specific to my installation, but since I'm the only one */
  20. /* that uses this file ...                                                  */
  21. #include "ckcdeb.h"
  22. #include "ckuath.h"
  23. #define CK_DES_C
  24. #include "ckuat2.h"
  25. #ifdef NT
  26. #ifdef _M_ALPHA
  27. #include <c:\srp\des\des.h>
  28. #else
  29. #include <c:\src\srp\des\des.h>
  30. #endif
  31. #else
  32. #include <c:\srp\des\des.h>
  33. #endif
  34.  
  35. int
  36. libdes_random_key(des_cblock B)
  37. {
  38.     des_random_key(B);
  39.     return(0);
  40. }
  41.  
  42. void
  43. libdes_random_seed(des_cblock B)
  44. {
  45.     des_random_seed(B);
  46. }
  47.  
  48. void
  49. libdes_key_sched(des_cblock * B, des_key_schedule S)
  50. {
  51.     des_key_sched(B,S);
  52. }
  53.  
  54. void
  55. libdes_ecb_encrypt(des_cblock * B1, des_cblock * B2, des_key_schedule S, int n)
  56. {
  57.     des_ecb_encrypt(B1,B2,S,n);
  58. }
  59.  
  60. int
  61. libdes_string_to_key(char * s, des_cblock * B)
  62. {
  63.     des_string_to_key(s,B);
  64.     return(0);
  65. }
  66.  
  67. void
  68. libdes_fixup_key_parity(des_cblock * B)
  69. {
  70.     des_set_odd_parity(B);
  71. }
  72.  
  73. void
  74. libdes_pcbc_encrypt(des_cblock *input, des_cblock *output, long length,
  75.                      des_key_schedule schedule, des_cblock *ivec, int enc)
  76. {
  77.     des_pcbc_encrypt(input,output,length,schedule,ivec,enc);
  78. }
  79.  
  80. void
  81. libdes_dll_init(struct _crypt_dll_init * init)
  82. {
  83.     init->p_install_funcs("libdes_random_key",libdes_random_key);
  84.     init->p_install_funcs("libdes_random_seed",libdes_random_seed);
  85.     init->p_install_funcs("libdes_key_sched",libdes_key_sched);
  86.     init->p_install_funcs("libdes_ecb_encrypt",libdes_ecb_encrypt);
  87.     init->p_install_funcs("libdes_string_to_key",libdes_string_to_key);
  88.     init->p_install_funcs("libdes_fixup_key_parity",libdes_fixup_key_parity);
  89.     init->p_install_funcs("libdes_pcbc_encrypt",libdes_pcbc_encrypt);
  90.  
  91. }
  92. #endif /* LIBDES */
  93.