1 /* C K U A T H . H -- "C-Kermit to Authentication" interface */
4 Author: Jeffrey E Altman <jaltman@secure-endpoints.com>,
5 Secure Endpoints Inc., New York City.
7 Copyright (C) 1999, 2004,
8 Trustees of Columbia University in the City of New York.
9 All rights reserved. See the C-Kermit COPYING.TXT file or the
10 copyright text in the ckcmai.c module for disclaimer and permissions.
14 * Based on a concatenation of all necessary include files distributed with
15 * the Kerberos 5 NT Alpha 2 Telnet package from MIT.
25 /* Header file for encrypted-stream library.
26 * Written by Ken Raeburn (Raeburn@Cygnus.COM).
27 * Copyright (C) 1991, 1992, 1994 by Cygnus Support.
29 * Permission to use, copy, modify, and
30 * distribute this software and its documentation for any purpose and
31 * without fee is hereby granted, provided that the above copyright
32 * notice appear in all copies and that both that copyright notice and
33 * this permission notice appear in supporting documentation.
34 * Cygnus Support makes no representations about the suitability of
35 * this software for any purpose. It is provided "as is" without express
36 * or implied warranty.
42 typedef void *kstream_ptr; /* Data send on the kstream */
43 struct kstream_data_block {
48 typedef struct kstream_int { /* Object we pass around */
49 int fd; /* Open socket descriptor */
50 int (*encrypt)(struct kstream_data_block *, /* output */
51 struct kstream_data_block *); /* input */
53 int (*decrypt)(struct kstream_data_block *, /* output */
54 struct kstream_data_block *); /* input */
60 int kstream_destroy();
61 void kstream_set_buffer_mode(int);
62 int kstream_create_from_fd(int fd, kstream_ptr);
63 int kstream_write(void *, size_t);
64 int kstream_read(void *, size_t);
66 #endif /* K5STREAM_H */
69 * Implements Telnet authentication and encryption
75 int auth_parse(unsigned char *, int);
77 int auth_init(kstream);
79 void auth_destroy(void);
81 int auth_encrypt(struct kstream_data_block *, struct kstream_data_block *);
83 int auth_decrypt(struct kstream_data_block *, struct kstream_data_block *);
85 extern BOOL forward_flag;
86 extern BOOL forwardable_flag;
87 extern BOOL forwarded_tickets;
88 #endif /* TEL_AUTH_H */
91 /* C-Kermit specific functions */
92 _PROTOTYP(void auth_finished,(int));
93 _PROTOTYP(int ck_auth_init, (char *, char *, char *, int));
94 _PROTOTYP(int ck_tn_auth_valid, (VOID));
95 _PROTOTYP(int ck_tn_auth_in_progress,(VOID));
96 _PROTOTYP(int ck_tn_sb_auth, (char *, int));
97 _PROTOTYP(int ck_tn_sb_encrypt, (char *, int));
98 _PROTOTYP(int ck_tn_auth_request, (VOID));
99 _PROTOTYP(void ck_tn_encrypt, (char *, int));
100 _PROTOTYP(void ck_tn_decrypt, (char *, int));
101 _PROTOTYP(void ck_tn_encrypt_start, (VOID));
102 _PROTOTYP(void ck_tn_encrypt_stop, (VOID));
103 _PROTOTYP(int ck_tn_authenticated, (VOID));
105 _PROTOTYP(int ck_tn_encrypting, (VOID));
106 _PROTOTYP(int ck_tn_decrypting, (VOID));
107 #endif /* CK_ENCRYPTION */
109 _PROTOTYP(int ck_tn_tls_negotiate, (VOID));
110 _PROTOTYP(int SendSSLAuthSB, (int, void *, int));
114 /* Define MIT_CURRENT to compile the code for use with versions of */
115 /* Kerberos later than KRB5 1.0.5. Note. This will not compile */
116 /* successfully in Kermit 95 due to the segmentation of crypto */
117 /* into a separate DLL. */
119 #define KRB_DEFTIM 600 /* Default lifetime (minutes) */
121 /* Kerberos structure definitions */
123 struct krb_op_data { /* Operational data for all actions */
124 int version; /* Kerberos version */
125 char * cache; /* Kerberos cache file */
128 struct krb4_init_data { /* INITIALIZE data structure */
130 char * principal; /* Principal string */
132 char * realm; /* Realm string */
133 char * password; /* Kerberos password */
134 int preauth; /* Use preauth mode? */
135 int verbose; /* Verbose output? */
138 #define KRB5_NUM_OF_ADDRS 16
139 struct krb5_init_data { /* INITIALIZE data structure */
140 int forwardable; /* Switch values */
141 int proxiable; /* Correspond to switch names... */
148 char * principal; /* Principal string */
150 char * realm; /* Realm string */
151 char * password; /* Kerberos password */
152 int preauth; /* Use preauth mode? */
153 int verbose; /* Verbose output? */
154 int getk4; /* Get K4 TGT? */
155 char * addrs[KRB5_NUM_OF_ADDRS+1]; /* List of IP Addresses */
156 int no_addresses; /* Do not include IP Addresses */
159 struct krb5_list_cred_data { /* List Credentials data */
165 _PROTOTYP(int ck_krb5_autoget_TGT, (char *));
166 _PROTOTYP(int ck_krb5_initTGT, (struct krb_op_data *,struct krb5_init_data *,
167 struct krb4_init_data *));
168 _PROTOTYP(int ck_krb5_destroy, (struct krb_op_data *));
169 _PROTOTYP(int ck_krb5_list_creds, (struct krb_op_data *,
170 struct krb5_list_cred_data *));
171 _PROTOTYP(char * ck_krb5_getrealm, (char *));
172 _PROTOTYP(char * ck_krb5_getprincipal, (char *));
173 _PROTOTYP(char * ck_krb5_get_cc_name, (VOID));
175 _PROTOTYP(int ck_krb4_autoget_TGT, (char *));
176 _PROTOTYP(int ck_krb4_initTGT, (struct krb_op_data *,struct krb4_init_data *));
177 _PROTOTYP(int ck_krb4_destroy, (struct krb_op_data *));
178 _PROTOTYP(int ck_krb4_list_creds, (struct krb_op_data *));
179 _PROTOTYP(char * ck_krb4_getrealm, (VOID));
180 _PROTOTYP(char * ck_krb4_getprincipal, (VOID));
182 _PROTOTYP(int ck_krb4_get_tkts, (VOID));
183 _PROTOTYP(char * ck_krb4_get_next_tkt, (VOID));
184 _PROTOTYP(int ck_krb4_tkt_isvalid,(char *));
185 _PROTOTYP(int ck_krb4_is_tgt_valid,(VOID));
186 _PROTOTYP(int ck_krb4_tkt_time,(char *));
188 _PROTOTYP(int ck_krb5_get_tkts, (char *));
189 _PROTOTYP(char * ck_krb5_get_next_tkt, (VOID));
190 _PROTOTYP(int ck_krb5_tkt_isvalid,(char *,char *));
191 _PROTOTYP(char * ck_krb5_tkt_flags,(char *,char *));
192 _PROTOTYP(int ck_krb5_is_tgt_valid,(VOID));
193 _PROTOTYP(int ck_krb5_tkt_time,(char *,char *));
195 _PROTOTYP(int krb4_des_avail,(int));
196 _PROTOTYP(int krb4_des_write,(int,char *,int));
197 _PROTOTYP(int krb4_des_read, (int,char *,int));
198 _PROTOTYP(int krb5_des_avail,(int));
199 _PROTOTYP(int krb5_des_write,(int,char *,int,int));
200 _PROTOTYP(int krb5_des_read, (int,char *,int,int));
201 _PROTOTYP(int krb5_u2u_avail,(int));
202 _PROTOTYP(int krb5_u2u_write,(int,char *,int));
203 _PROTOTYP(int krb5_u2u_read, (int,char *,int));
204 _PROTOTYP(int k5_user_to_user_server_auth,(VOID));
205 _PROTOTYP(int k5_user_to_user_client_auth,(VOID));
206 #endif /* CK_KERBEROS */
208 _PROTOTYP(int ck_krb5_is_installed,(void));
209 _PROTOTYP(int ck_krb4_is_installed,(void));
210 _PROTOTYP(int ck_srp_is_installed,(void));
211 _PROTOTYP(int ck_ntlm_is_installed,(void));
212 _PROTOTYP(int ck_crypt_is_installed,(void));
213 _PROTOTYP(int ck_ssleay_is_installed,(void));
214 _PROTOTYP(int ck_gssapi_is_installed,(void));
215 _PROTOTYP(int ck_krypto_is_installed,(void));
217 _PROTOTYP(VOID ck_encrypt_send_support,(VOID));
218 _PROTOTYP(int ck_get_crypt_table,(struct keytab **, int *));
219 _PROTOTYP(char * ck_krb4_realmofhost,(char *));
220 _PROTOTYP(char * ck_krb5_realmofhost,(char *));
222 #define FORWARD /* allow forwarding of credential */
224 _PROTOTYP(int kerberos5_forward,(VOID));
227 #define AUTHTYPLSTSZ 8
228 #endif /*KRB5_KERMIT_H*/