home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / ckc197.zip / ckuat2.h < prev    next >
C/C++ Source or Header  |  2000-01-02  |  12KB  |  332 lines

  1. /*
  2.   C K U A T 2 . H  --  Kerberos headers for C-Kermit
  3.  
  4.   Copyright (C) 1985, 2000,
  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.  
  101. typedef    struct {
  102.   short        type;
  103.   int        length;
  104.   unsigned char    *data;
  105. } Session_Key;
  106. #endif /* CK_DES_C */
  107.  
  108. #if !defined(P)
  109. #ifdef __STDC__
  110. #define P(x)    x
  111. #else
  112. #define P(x)    ()
  113. #endif
  114. #endif
  115.  
  116. #ifdef DEBUG
  117. int printsub(char, unsigned char *, size_t);
  118. #endif
  119.  
  120. int encrypt_parse(unsigned char *, int);
  121.  
  122. typedef struct {
  123.   char    *name;
  124.   int    type;
  125.   void    (*output) P((unsigned char *, int));
  126.   int    (*input) P((int));
  127.   void    (*init) P((int));
  128.   int    (*start) P((int, int));
  129.   int    (*is) P((unsigned char *, int));
  130.   int    (*reply) P((unsigned char *, int));
  131.   int    (*session) P((Session_Key *, int));
  132.   int    (*keyid) P((int, unsigned char *, int *));
  133.   void    (*printsub) P((unsigned char *, int, unsigned char *, int));
  134. } Encryptions;
  135.  
  136. #define SK_GENERIC      0       /* Just a string of bits */
  137. #define    SK_DES        1    /* Matched Kerberos v5 ENCTYPE_DES */
  138.  
  139. void encrypt_init P((kstream,int));
  140. Encryptions *findencryption P((int));
  141. void encrypt_send_support P((void));
  142. void encrypt_auto P((int));
  143. void decrypt_auto P((int));
  144. int  encrypt_is P((unsigned char *, int));
  145. int  encrypt_reply P((unsigned char *, int));
  146. void encrypt_start_input P((int));
  147. int  encrypt_session_key P((Session_Key *, int));
  148. void encrypt_end_input P((void));
  149. void encrypt_start_output P((int));
  150. void encrypt_end_output P((void));
  151. void encrypt_send_request_start P((void));
  152. void encrypt_send_request_end P((void));
  153. void encrypt_send_end P((void));
  154. void encrypt_wait P((void));
  155. int  encrypt_is_encrypting P((void));
  156. void encrypt_send_support P((void));
  157. int  encrypt_send_keyid P((int, unsigned char *, int, int));
  158.  
  159. int encrypt_cmd P((int, char **));
  160. void encrypt_display P((void));
  161.  
  162. #ifdef CK_KERBEROS
  163. void krbdes_encrypt P((unsigned char *, int));
  164. int  krbdes_decrypt P((int));
  165. int  krbdes_is P((unsigned char *, int));
  166. int  krbdes_reply P((unsigned char *, int));
  167. void krbdes_init P((int));
  168. int  krbdes_start P((int, int));
  169. void krbdes_session P((Session_Key *, int));
  170. void krbdes_printsub P((unsigned char *, int, unsigned char *, int));
  171. #endif /* CK_KERBEROS */
  172.  
  173. void cfb64_encrypt P((unsigned char *, int));
  174. int cfb64_decrypt P((int));
  175. void cfb64_init P((int));
  176. int cfb64_start P((int, int));
  177. int cfb64_is P((unsigned char *, int));
  178. int cfb64_reply P((unsigned char *, int));
  179. int cfb64_session P((Session_Key *, int));
  180. int cfb64_keyid P((int, unsigned char *, int *));
  181. void cfb64_printsub P((unsigned char *, int, unsigned char *, int));
  182.  
  183. void ofb64_encrypt P((unsigned char *, int));
  184. int ofb64_decrypt P((int));
  185. void ofb64_init P((int));
  186. int ofb64_start P((int, int));
  187. int ofb64_is P((unsigned char *, int));
  188. int ofb64_reply P((unsigned char *, int));
  189. int ofb64_session P((Session_Key *, int));
  190. int ofb64_keyid P((int, unsigned char *, int *));
  191. void ofb64_printsub P((unsigned char *, int, unsigned char *, int));
  192.  
  193. void des3_cfb64_encrypt P((unsigned char *, int));
  194. int  des3_cfb64_decrypt P((int));
  195. void des3_cfb64_init P((int));
  196. int  des3_cfb64_start P((int, int));
  197. int  des3_cfb64_is P((unsigned char *, int));
  198. int  des3_cfb64_reply P((unsigned char *, int));
  199. int  des3_cfb64_session P((Session_Key *, int));
  200. int  des3_cfb64_keyid P((int, unsigned char *, int *));
  201. void des3_cfb64_printsub P((unsigned char *, int, unsigned char *, int));
  202.  
  203. void des3_ofb64_encrypt P((unsigned char *, int));
  204. int  des3_ofb64_decrypt P((int));
  205. void des3_ofb64_init P((int));
  206. int  des3_ofb64_start P((int, int));
  207. int  des3_ofb64_is P((unsigned char *, int));
  208. int  des3_ofb64_reply P((unsigned char *, int));
  209. int  des3_ofb64_session P((Session_Key *, int));
  210. int  des3_ofb64_keyid P((int, unsigned char *, int *));
  211. void des3_ofb64_printsub P((unsigned char *, int, unsigned char *, int));
  212.  
  213. #ifdef CAST_ENCRYPTION
  214. void cast_cfb64_encrypt P((unsigned char *, int));
  215. int  cast_cfb64_decrypt P((int));
  216. void cast_cfb64_init P((int));
  217. int  cast_cfb64_start P((int, int));
  218. int  cast_cfb64_is P((unsigned char *, int));
  219. int  cast_cfb64_reply P((unsigned char *, int));
  220. int  cast_cfb64_session P((Session_Key *, int));
  221. int  cast_cfb64_keyid P((int, unsigned char *, int *));
  222. void cast_cfb64_printsub P((unsigned char *, int, unsigned char *, int));
  223.  
  224. void cast_ofb64_encrypt P((unsigned char *, int));
  225. int  cast_ofb64_decrypt P((int));
  226. void cast_ofb64_init P((int));
  227. int  cast_ofb64_start P((int, int));
  228. int  cast_ofb64_is P((unsigned char *, int));
  229. int  cast_ofb64_reply P((unsigned char *, int));
  230. int  cast_ofb64_session P((Session_Key *, int));
  231. int  cast_ofb64_keyid P((int, unsigned char *, int *));
  232. void cast_ofb64_printsub P((unsigned char *, int, unsigned char *, int));
  233.  
  234. void castexp_cfb64_encrypt P((unsigned char *, int));
  235. int  castexp_cfb64_decrypt P((int));
  236. void castexp_cfb64_init P((int));
  237. int  castexp_cfb64_start P((int, int));
  238. int  castexp_cfb64_is P((unsigned char *, int));
  239. int  castexp_cfb64_reply P((unsigned char *, int));
  240. int  castexp_cfb64_session P((Session_Key *, int));
  241. int  castexp_cfb64_keyid P((int, unsigned char *, int *));
  242. void castexp_cfb64_printsub P((unsigned char *, int, unsigned char *, int));
  243.  
  244. void castexp_ofb64_encrypt P((unsigned char *, int));
  245. int  castexp_ofb64_decrypt P((int));
  246. void castexp_ofb64_init P((int));
  247. int  castexp_ofb64_start P((int, int));
  248. int  castexp_ofb64_is P((unsigned char *, int));
  249. int  castexp_ofb64_reply P((unsigned char *, int));
  250. int  castexp_ofb64_session P((Session_Key *, int));
  251. int  castexp_ofb64_keyid P((int, unsigned char *, int *));
  252. void castexp_ofb64_printsub P((unsigned char *, int, unsigned char *, int));
  253. #endif /* CAST_ENCRYPTION */
  254.  
  255. /* int    des_string_to_key P((char *, Block)); */
  256.  
  257. #ifdef DEBUG
  258. extern int encrypt_debug_mode;
  259. #endif
  260.  
  261. #ifndef CRYPT_DLL
  262. extern int (*decrypt_input) P((int));
  263. extern void (*encrypt_output) P((unsigned char *, int));
  264. #endif /* CRYPT_DLL */
  265.  
  266. int decrypt_ks_hack(unsigned char *, int);
  267.  
  268. #endif /* __ENCRYPTION__ */
  269.  
  270. #endif /* ENCRYPTION */
  271.  
  272. #define FORWARD
  273. /* allow forwarding of credentials */
  274.  
  275. #ifdef CRYPT_DLL
  276. struct _crypt_dll_init {
  277.     int version;
  278.  
  279.     /* Version 1 variables */
  280.     int (*p_ttol)(char *,int);
  281.     void (*p_dodebug)(int,char *,char *,long);
  282.     void (*p_dohexdump)(char *,char *,int);
  283.     void (*p_tn_debug)(char *);
  284.     int (*p_vscrnprintf)(char *, ...);
  285.  
  286.     /* Version 2 variables */
  287.     void * p_k5_context;
  288.  
  289.     /* Version 3 variables */
  290.     void (*p_install_funcs)(char *,void *);
  291. };
  292. #endif /* CRYPT_DLL */
  293.  
  294. /* per Kerberos v5 protocol spec */
  295. #ifndef ENCTYPE_NULL
  296. #define ENCTYPE_NULL            0x0000
  297. #endif
  298. #ifndef  ENCTYPE_DES_CBC_CRC
  299. #define ENCTYPE_DES_CBC_CRC     0x0001  /* DES cbc mode with CRC-32 */
  300. #endif
  301. #ifndef  ENCTYPE_DES_CBC_MD4
  302. #define ENCTYPE_DES_CBC_MD4     0x0002  /* DES cbc mode with RSA-MD4 */
  303. #endif
  304. #ifndef  ENCTYPE_DES_CBC_MD5
  305. #define ENCTYPE_DES_CBC_MD5     0x0003  /* DES cbc mode with RSA-MD5 */
  306. #endif
  307. #ifndef  ENCTYPE_DES_CBC_RAW
  308. #define ENCTYPE_DES_CBC_RAW     0x0004  /* DES cbc mode raw */
  309. #endif
  310. /* XXX deprecated? */
  311. #ifndef  ENCTYPE_DES3_CBC_SHA
  312. #define ENCTYPE_DES3_CBC_SHA    0x0005  /* DES-3 cbc mode with NIST-SHA */
  313. #endif
  314. #ifndef  ENCTYPE_DES3_CBC_RAW
  315. #define ENCTYPE_DES3_CBC_RAW    0x0006  /* DES-3 cbc mode raw */
  316. #endif
  317. #ifndef  ENCTYPE_DES3_HMAC_SHA1
  318. #define ENCTYPE_DES3_HMAC_SHA1  0x0007
  319. #endif
  320. #ifndef  ENCTYPE_DES_HMAC_SHA1
  321. #define ENCTYPE_DES_HMAC_SHA1   0x0008
  322. #endif
  323. #ifndef  ENCTYPE_UNKNOWN
  324. #define ENCTYPE_UNKNOWN         0x01ff
  325. #endif
  326. /* local crud */
  327. /* marc's DES-3 with 32-bit length */
  328. #ifndef  ENCTYPE_LOCAL_DES3_HMAC_SHA1
  329. #define ENCTYPE_LOCAL_DES3_HMAC_SHA1 0x7007
  330. #endif
  331. #endif /* KRB5_TELNET_H */
  332.