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. The C-Kermit software may not be, in whole or in part, licensed or |
---|
6 | sold for profit as a software product itself, nor may it be included in or |
---|
7 | distributed with commercial products or otherwise distributed by commercial |
---|
8 | concerns to their clients or customers without written permission of the |
---|
9 | Office of Kermit Development and Distribution, Columbia University. This |
---|
10 | copyright notice must not be removed, altered, or obscured. |
---|
11 | |
---|
12 | Author: |
---|
13 | Jeffrey E Altman (jaltman@columbia.edu). |
---|
14 | */ |
---|
15 | |
---|
16 | /* |
---|
17 | This file contains wrappers so that the following functions will be imported |
---|
18 | into the k95crypt.dll/k2crypt.dll files in such a form that they can be |
---|
19 | re-exported to k95.exe/k2.exe. This subset of the DES library is needed to |
---|
20 | provide DES based Kerberos authentication. |
---|
21 | */ |
---|
22 | |
---|
23 | |
---|
24 | #ifdef LIBDES |
---|
25 | /* The following is specific to my installation, but since I'm the only one */ |
---|
26 | /* that uses this file ... */ |
---|
27 | #include "ckcdeb.h" |
---|
28 | #include "ckuath.h" |
---|
29 | #define CK_DES_C |
---|
30 | #include "ckuat2.h" |
---|
31 | #ifdef NT |
---|
32 | #ifdef _M_ALPHA |
---|
33 | #include <c:\srp\des\des.h> |
---|
34 | #else |
---|
35 | #include <c:\src\srp\des\des.h> |
---|
36 | #endif |
---|
37 | #else |
---|
38 | #include <c:\srp\des\des.h> |
---|
39 | #endif |
---|
40 | |
---|
41 | int |
---|
42 | libdes_random_key(des_cblock B) |
---|
43 | { |
---|
44 | des_random_key(B); |
---|
45 | return(0); |
---|
46 | } |
---|
47 | |
---|
48 | void |
---|
49 | libdes_random_seed(des_cblock B) |
---|
50 | { |
---|
51 | des_random_seed(B); |
---|
52 | } |
---|
53 | |
---|
54 | void |
---|
55 | libdes_key_sched(des_cblock * B, des_key_schedule S) |
---|
56 | { |
---|
57 | des_key_sched(B,S); |
---|
58 | } |
---|
59 | |
---|
60 | void |
---|
61 | libdes_ecb_encrypt(des_cblock * B1, des_cblock * B2, des_key_schedule S, int n) |
---|
62 | { |
---|
63 | des_ecb_encrypt(B1,B2,S,n); |
---|
64 | } |
---|
65 | |
---|
66 | int |
---|
67 | libdes_string_to_key(char * s, des_cblock * B) |
---|
68 | { |
---|
69 | des_string_to_key(s,B); |
---|
70 | return(0); |
---|
71 | } |
---|
72 | |
---|
73 | void |
---|
74 | libdes_fixup_key_parity(des_cblock * B) |
---|
75 | { |
---|
76 | des_set_odd_parity(B); |
---|
77 | } |
---|
78 | |
---|
79 | void |
---|
80 | libdes_pcbc_encrypt(des_cblock *input, des_cblock *output, long length, |
---|
81 | des_key_schedule schedule, des_cblock *ivec, int enc) |
---|
82 | { |
---|
83 | des_pcbc_encrypt(input,output,length,schedule,ivec,enc); |
---|
84 | } |
---|
85 | |
---|
86 | void |
---|
87 | libdes_dll_init(struct _crypt_dll_init * init) |
---|
88 | { |
---|
89 | init->p_install_funcs("libdes_random_key",libdes_random_key); |
---|
90 | init->p_install_funcs("libdes_random_seed",libdes_random_seed); |
---|
91 | init->p_install_funcs("libdes_key_sched",libdes_key_sched); |
---|
92 | init->p_install_funcs("libdes_ecb_encrypt",libdes_ecb_encrypt); |
---|
93 | init->p_install_funcs("libdes_string_to_key",libdes_string_to_key); |
---|
94 | init->p_install_funcs("libdes_fixup_key_parity",libdes_fixup_key_parity); |
---|
95 | init->p_install_funcs("libdes_pcbc_encrypt",libdes_pcbc_encrypt); |
---|
96 | |
---|
97 | } |
---|
98 | #endif /* LIBDES */ |
---|
99 | |
---|