1 | /* |
---|
2 | C K U A T 2 . H -- Kerberos headers for C-Kermit |
---|
3 | |
---|
4 | Copyright (C) 1985, 2002, |
---|
5 | Trustees of Columbia University in the City of New York. |
---|
6 | All rights reserved. See the C-Kermit COPYING.TXT file or the |
---|
7 | copyright text in the ckcmai.c module for disclaimer and permissions. |
---|
8 | |
---|
9 | Author: |
---|
10 | Jeffrey E Altman (jaltman@columbia.edu) -- Kerberos IV and V intergration. |
---|
11 | */ |
---|
12 | /* |
---|
13 | * Based on a concatenation of all necessary include files distributed with |
---|
14 | * the Kerberos 5 NT Alpha 2 Telnet package from MIT. |
---|
15 | */ |
---|
16 | |
---|
17 | #ifndef KRB5_TELNET_H |
---|
18 | #define KRB5_TELNET_H |
---|
19 | /*- |
---|
20 | * Copyright (c) 1991, 1993 |
---|
21 | * The Regents of the University of California. All rights reserved. |
---|
22 | * |
---|
23 | * Redistribution and use in source and binary forms, with or without |
---|
24 | * modification, are permitted provided that the following conditions |
---|
25 | * are met: |
---|
26 | * 1. Redistributions of source code must retain the above copyright |
---|
27 | * notice, this list of conditions and the following disclaimer. |
---|
28 | * 2. Redistributions in binary form must reproduce the above copyright |
---|
29 | * notice, this list of conditions and the following disclaimer in the |
---|
30 | * documentation and/or other materials provided with the distribution. |
---|
31 | * 3. All advertising materials mentioning features or use of this software |
---|
32 | * must display the following acknowledgement: |
---|
33 | * This product includes software developed by the University of |
---|
34 | * California, Berkeley and its contributors. |
---|
35 | * 4. Neither the name of the University nor the names of its contributors |
---|
36 | * may be used to endorse or promote products derived from this software |
---|
37 | * without specific prior written permission. |
---|
38 | * |
---|
39 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
---|
40 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
42 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
---|
43 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
---|
44 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
---|
45 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
---|
46 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
---|
47 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
---|
48 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
---|
49 | * SUCH DAMAGE. |
---|
50 | * |
---|
51 | * @(#)encrypt.h 8.1 (Berkeley) 6/4/93 |
---|
52 | */ |
---|
53 | |
---|
54 | /* |
---|
55 | * Copyright (C) 1990 by the Massachusetts Institute of Technology |
---|
56 | * |
---|
57 | * Export of this software from the United States of America may |
---|
58 | * require a specific license from the United States Government. |
---|
59 | * It is the responsibility of any person or organization contemplating |
---|
60 | * export to obtain such a license before exporting. |
---|
61 | * |
---|
62 | * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and |
---|
63 | * distribute this software and its documentation for any purpose and |
---|
64 | * without fee is hereby granted, provided that the above copyright |
---|
65 | * notice appear in all copies and that both that copyright notice and |
---|
66 | * this permission notice appear in supporting documentation, and that |
---|
67 | * the name of M.I.T. not be used in advertising or publicity pertaining |
---|
68 | * to distribution of the software without specific, written prior |
---|
69 | * permission. M.I.T. makes no representations about the suitability of |
---|
70 | * this software for any purpose. It is provided "as is" without express |
---|
71 | * or implied warranty. |
---|
72 | */ |
---|
73 | |
---|
74 | #ifdef CK_ENCRYPTION |
---|
75 | |
---|
76 | #ifndef __ENCRYPTION__ |
---|
77 | #define __ENCRYPTION__ |
---|
78 | |
---|
79 | #define DIR_DECRYPT 1 |
---|
80 | #define DIR_ENCRYPT 2 |
---|
81 | |
---|
82 | #ifndef CK_DES_C |
---|
83 | #ifndef NOBLOCKDEF |
---|
84 | typedef unsigned char Block[8]; |
---|
85 | #endif /* NOBLOCKDEF */ |
---|
86 | typedef unsigned char *BlockT; |
---|
87 | #ifndef KRB4 /* already defined in kerberosiv/des.h */ |
---|
88 | typedef struct des_ks_struct { Block _; } Schedule[16]; |
---|
89 | #else /* KRB4 */ |
---|
90 | #ifndef OS2 |
---|
91 | #ifndef NOBLOCKDEF /* already defined in kerberosiv/des.h */ |
---|
92 | typedef struct des_ks_struct { Block _; } Schedule[16]; |
---|
93 | #endif /* NOBLOCKDEF */ |
---|
94 | #endif /* OS2 */ |
---|
95 | #endif /* KRB4 */ |
---|
96 | |
---|
97 | #define VALIDKEY(key) (key[0]|key[1]|key[2]|key[3]|key[4]|key[5]|key[6]|key[7]) |
---|
98 | |
---|
99 | #define SAMEKEY(k1, k2) (!memcmp((void *)k1, (void *)k2, sizeof(Block))) |
---|
100 | #endif /* CK_DES_C */ |
---|
101 | |
---|
102 | typedef struct _session_key { |
---|
103 | short type; |
---|
104 | int length; |
---|
105 | unsigned char *data; |
---|
106 | } Session_Key; |
---|
107 | |
---|
108 | #ifdef __STDC__ |
---|
109 | typedef struct { |
---|
110 | char *name; |
---|
111 | int type; |
---|
112 | void (*output)(unsigned char *, int); |
---|
113 | int (*input)(int); |
---|
114 | void (*init)(int); |
---|
115 | int (*start)(int, int); |
---|
116 | int (*is)(unsigned char *, int); |
---|
117 | int (*reply)(unsigned char *, int); |
---|
118 | int (*session)(Session_Key *, int); |
---|
119 | int (*keyid)(int, unsigned char *, int *); |
---|
120 | void (*printsub)(unsigned char *, int, unsigned char *, int); |
---|
121 | } Encryptions; |
---|
122 | #if !defined(P) |
---|
123 | #define P(x) x |
---|
124 | #endif |
---|
125 | #else |
---|
126 | typedef struct { |
---|
127 | char *name; |
---|
128 | int type; |
---|
129 | void (*output)(); |
---|
130 | int (*input)(); |
---|
131 | void (*init)(); |
---|
132 | int (*start)(); |
---|
133 | int (*is)(); |
---|
134 | int (*reply)(); |
---|
135 | int (*session)(); |
---|
136 | int (*keyid)(); |
---|
137 | void (*printsub)(); |
---|
138 | } Encryptions; |
---|
139 | #if !defined(P) |
---|
140 | #define P(x) () |
---|
141 | #endif |
---|
142 | #endif |
---|
143 | |
---|
144 | int encrypt_parse(unsigned char *, int); |
---|
145 | |
---|
146 | #ifdef DEBUG |
---|
147 | int printsub(char, unsigned char *, size_t); |
---|
148 | #endif |
---|
149 | |
---|
150 | #define SK_GENERIC 0 /* Just a string of bits */ |
---|
151 | #define SK_DES 1 /* Matched Kerberos v5 ENCTYPE_DES */ |
---|
152 | |
---|
153 | void encrypt_init P((kstream,int)); |
---|
154 | Encryptions *findencryption P((int)); |
---|
155 | void encrypt_send_support P((void)); |
---|
156 | void encrypt_auto P((int)); |
---|
157 | void decrypt_auto P((int)); |
---|
158 | int encrypt_is P((unsigned char *, int)); |
---|
159 | int encrypt_reply P((unsigned char *, int)); |
---|
160 | void encrypt_start_input P((int)); |
---|
161 | int encrypt_session_key P((Session_Key *, int)); |
---|
162 | void encrypt_end_input P((void)); |
---|
163 | void encrypt_start_output P((int)); |
---|
164 | void encrypt_end_output P((void)); |
---|
165 | void encrypt_send_request_start P((void)); |
---|
166 | void encrypt_send_request_end P((void)); |
---|
167 | void encrypt_send_end P((void)); |
---|
168 | void encrypt_wait P((void)); |
---|
169 | int encrypt_is_encrypting P((void)); |
---|
170 | void encrypt_send_support P((void)); |
---|
171 | int encrypt_send_keyid P((int, unsigned char *, int, int)); |
---|
172 | |
---|
173 | int encrypt_cmd P((int, char **)); |
---|
174 | void encrypt_display P((void)); |
---|
175 | |
---|
176 | #ifdef CK_KERBEROS |
---|
177 | void krbdes_encrypt P((unsigned char *, int)); |
---|
178 | int krbdes_decrypt P((int)); |
---|
179 | int krbdes_is P((unsigned char *, int)); |
---|
180 | int krbdes_reply P((unsigned char *, int)); |
---|
181 | void krbdes_init P((int)); |
---|
182 | int krbdes_start P((int, int)); |
---|
183 | void krbdes_session P((Session_Key *, int)); |
---|
184 | void krbdes_printsub P((unsigned char *, int, unsigned char *, int)); |
---|
185 | #endif /* CK_KERBEROS */ |
---|
186 | |
---|
187 | void cfb64_encrypt P((unsigned char *, int)); |
---|
188 | int cfb64_decrypt P((int)); |
---|
189 | void cfb64_init P((int)); |
---|
190 | int cfb64_start P((int, int)); |
---|
191 | int cfb64_is P((unsigned char *, int)); |
---|
192 | int cfb64_reply P((unsigned char *, int)); |
---|
193 | int cfb64_session P((Session_Key *, int)); |
---|
194 | int cfb64_keyid P((int, unsigned char *, int *)); |
---|
195 | void cfb64_printsub P((unsigned char *, int, unsigned char *, int)); |
---|
196 | |
---|
197 | void ofb64_encrypt P((unsigned char *, int)); |
---|
198 | int ofb64_decrypt P((int)); |
---|
199 | void ofb64_init P((int)); |
---|
200 | int ofb64_start P((int, int)); |
---|
201 | int ofb64_is P((unsigned char *, int)); |
---|
202 | int ofb64_reply P((unsigned char *, int)); |
---|
203 | int ofb64_session P((Session_Key *, int)); |
---|
204 | int ofb64_keyid P((int, unsigned char *, int *)); |
---|
205 | void ofb64_printsub P((unsigned char *, int, unsigned char *, int)); |
---|
206 | |
---|
207 | void des3_cfb64_encrypt P((unsigned char *, int)); |
---|
208 | int des3_cfb64_decrypt P((int)); |
---|
209 | void des3_cfb64_init P((int)); |
---|
210 | int des3_cfb64_start P((int, int)); |
---|
211 | int des3_cfb64_is P((unsigned char *, int)); |
---|
212 | int des3_cfb64_reply P((unsigned char *, int)); |
---|
213 | int des3_cfb64_session P((Session_Key *, int)); |
---|
214 | int des3_cfb64_keyid P((int, unsigned char *, int *)); |
---|
215 | void des3_cfb64_printsub P((unsigned char *, int, unsigned char *, int)); |
---|
216 | |
---|
217 | void des3_ofb64_encrypt P((unsigned char *, int)); |
---|
218 | int des3_ofb64_decrypt P((int)); |
---|
219 | void des3_ofb64_init P((int)); |
---|
220 | int des3_ofb64_start P((int, int)); |
---|
221 | int des3_ofb64_is P((unsigned char *, int)); |
---|
222 | int des3_ofb64_reply P((unsigned char *, int)); |
---|
223 | int des3_ofb64_session P((Session_Key *, int)); |
---|
224 | int des3_ofb64_keyid P((int, unsigned char *, int *)); |
---|
225 | void des3_ofb64_printsub P((unsigned char *, int, unsigned char *, int)); |
---|
226 | |
---|
227 | #ifdef CAST_ENCRYPTION |
---|
228 | void cast_cfb64_encrypt P((unsigned char *, int)); |
---|
229 | int cast_cfb64_decrypt P((int)); |
---|
230 | void cast_cfb64_init P((int)); |
---|
231 | int cast_cfb64_start P((int, int)); |
---|
232 | int cast_cfb64_is P((unsigned char *, int)); |
---|
233 | int cast_cfb64_reply P((unsigned char *, int)); |
---|
234 | int cast_cfb64_session P((Session_Key *, int)); |
---|
235 | int cast_cfb64_keyid P((int, unsigned char *, int *)); |
---|
236 | void cast_cfb64_printsub P((unsigned char *, int, unsigned char *, int)); |
---|
237 | |
---|
238 | void cast_ofb64_encrypt P((unsigned char *, int)); |
---|
239 | int cast_ofb64_decrypt P((int)); |
---|
240 | void cast_ofb64_init P((int)); |
---|
241 | int cast_ofb64_start P((int, int)); |
---|
242 | int cast_ofb64_is P((unsigned char *, int)); |
---|
243 | int cast_ofb64_reply P((unsigned char *, int)); |
---|
244 | int cast_ofb64_session P((Session_Key *, int)); |
---|
245 | int cast_ofb64_keyid P((int, unsigned char *, int *)); |
---|
246 | void cast_ofb64_printsub P((unsigned char *, int, unsigned char *, int)); |
---|
247 | |
---|
248 | void castexp_cfb64_encrypt P((unsigned char *, int)); |
---|
249 | int castexp_cfb64_decrypt P((int)); |
---|
250 | void castexp_cfb64_init P((int)); |
---|
251 | int castexp_cfb64_start P((int, int)); |
---|
252 | int castexp_cfb64_is P((unsigned char *, int)); |
---|
253 | int castexp_cfb64_reply P((unsigned char *, int)); |
---|
254 | int castexp_cfb64_session P((Session_Key *, int)); |
---|
255 | int castexp_cfb64_keyid P((int, unsigned char *, int *)); |
---|
256 | void castexp_cfb64_printsub P((unsigned char *, int, unsigned char *, int)); |
---|
257 | |
---|
258 | void castexp_ofb64_encrypt P((unsigned char *, int)); |
---|
259 | int castexp_ofb64_decrypt P((int)); |
---|
260 | void castexp_ofb64_init P((int)); |
---|
261 | int castexp_ofb64_start P((int, int)); |
---|
262 | int castexp_ofb64_is P((unsigned char *, int)); |
---|
263 | int castexp_ofb64_reply P((unsigned char *, int)); |
---|
264 | int castexp_ofb64_session P((Session_Key *, int)); |
---|
265 | int castexp_ofb64_keyid P((int, unsigned char *, int *)); |
---|
266 | void castexp_ofb64_printsub P((unsigned char *, int, unsigned char *, int)); |
---|
267 | #endif /* CAST_ENCRYPTION */ |
---|
268 | |
---|
269 | /* int des_string_to_key P((char *, Block)); */ |
---|
270 | |
---|
271 | #ifdef DEBUG |
---|
272 | extern int encrypt_debug_mode; |
---|
273 | #endif |
---|
274 | |
---|
275 | #ifndef CRYPT_DLL |
---|
276 | extern int (*decrypt_input) P((int)); |
---|
277 | extern void (*encrypt_output) P((unsigned char *, int)); |
---|
278 | #endif /* CRYPT_DLL */ |
---|
279 | |
---|
280 | int decrypt_ks_hack(unsigned char *, int); |
---|
281 | |
---|
282 | #endif /* __ENCRYPTION__ */ |
---|
283 | #endif /* ENCRYPTION */ |
---|
284 | |
---|
285 | #ifdef CRYPT_DLL |
---|
286 | struct _crypt_dll_init { |
---|
287 | int version; |
---|
288 | |
---|
289 | /* Version 1 variables */ |
---|
290 | int (*p_ttol)(char *,int); |
---|
291 | int (*p_dodebug)(int,char *,char *,long); |
---|
292 | int (*p_dohexdump)(char *,char *,int); |
---|
293 | void (*p_tn_debug)(char *); |
---|
294 | int (*p_vscrnprintf)(char *, ...); |
---|
295 | |
---|
296 | /* Version 2 variables */ |
---|
297 | void * p_k5_context; |
---|
298 | |
---|
299 | /* Version 3 variables */ |
---|
300 | void (*p_install_funcs)(char *,void *); |
---|
301 | |
---|
302 | /* Version 5 variables */ |
---|
303 | unsigned long (*p_reqtelmutex)(unsigned long); |
---|
304 | unsigned long (*p_reltelmutex)(void); |
---|
305 | }; |
---|
306 | #endif /* CRYPT_DLL */ |
---|
307 | |
---|
308 | /* per Kerberos v5 protocol spec */ |
---|
309 | #ifndef ENCTYPE_NULL |
---|
310 | #define ENCTYPE_NULL 0x0000 |
---|
311 | #endif |
---|
312 | #ifndef ENCTYPE_DES_CBC_CRC |
---|
313 | #define ENCTYPE_DES_CBC_CRC 0x0001 /* DES cbc mode with CRC-32 */ |
---|
314 | #endif |
---|
315 | #ifndef ENCTYPE_DES_CBC_MD4 |
---|
316 | #define ENCTYPE_DES_CBC_MD4 0x0002 /* DES cbc mode with RSA-MD4 */ |
---|
317 | #endif |
---|
318 | #ifndef ENCTYPE_DES_CBC_MD5 |
---|
319 | #define ENCTYPE_DES_CBC_MD5 0x0003 /* DES cbc mode with RSA-MD5 */ |
---|
320 | #endif |
---|
321 | #ifndef ENCTYPE_DES_CBC_RAW |
---|
322 | #define ENCTYPE_DES_CBC_RAW 0x0004 /* DES cbc mode raw */ |
---|
323 | #endif |
---|
324 | /* XXX deprecated? */ |
---|
325 | #ifndef ENCTYPE_DES3_CBC_SHA |
---|
326 | #define ENCTYPE_DES3_CBC_SHA 0x0005 /* DES-3 cbc mode with NIST-SHA */ |
---|
327 | #endif |
---|
328 | #ifndef ENCTYPE_DES3_CBC_RAW |
---|
329 | #define ENCTYPE_DES3_CBC_RAW 0x0006 /* DES-3 cbc mode raw */ |
---|
330 | #endif |
---|
331 | #ifndef ENCTYPE_DES_HMAC_SHA1 |
---|
332 | #define ENCTYPE_DES_HMAC_SHA1 0x0008 |
---|
333 | #endif |
---|
334 | #ifndef ENCTYPE_DES3_CBC_SHA1 |
---|
335 | #define ENCTYPE_DES3_CBC_SHA1 0x0010 |
---|
336 | #endif |
---|
337 | #ifndef ENCTYPE_UNKNOWN |
---|
338 | #define ENCTYPE_UNKNOWN 0x01ff |
---|
339 | #endif |
---|
340 | /* local crud */ |
---|
341 | /* marc's DES-3 with 32-bit length */ |
---|
342 | #ifndef ENCTYPE_LOCAL_DES3_HMAC_SHA1 |
---|
343 | #define ENCTYPE_LOCAL_DES3_HMAC_SHA1 0x7007 |
---|
344 | #endif |
---|
345 | #endif /* KRB5_TELNET_H */ |
---|