xref: /illumos-gate/usr/src/uts/common/gssapi/mechs/krb5/include/gssapiP_krb5.h (revision 159d09a20817016f09b3ea28d1bdada4a336bb91)
1 /*
2  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 
7 /*
8  * Copyright 2000 by the Massachusetts Institute of Technology.
9  * All Rights Reserved.
10  *
11  * Export of this software from the United States of America may
12  *   require a specific license from the United States Government.
13  *   It is the responsibility of any person or organization contemplating
14  *   export to obtain such a license before exporting.
15  *
16  * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
17  * distribute this software and its documentation for any purpose and
18  * without fee is hereby granted, provided that the above copyright
19  * notice appear in all copies and that both that copyright notice and
20  * this permission notice appear in supporting documentation, and that
21  * the name of M.I.T. not be used in advertising or publicity pertaining
22  * to distribution of the software without specific, written prior
23  * permission.  Furthermore if you modify this software you must label
24  * your software as modified software and not distribute it in such a
25  * fashion that it might be confused with the original M.I.T. software.
26  * M.I.T. makes no representations about the suitability of
27  * this software for any purpose.  It is provided "as is" without express
28  * or implied warranty.
29  *
30  */
31 /*
32  * Copyright 1993 by OpenVision Technologies, Inc.
33  *
34  * Permission to use, copy, modify, distribute, and sell this software
35  * and its documentation for any purpose is hereby granted without fee,
36  * provided that the above copyright notice appears in all copies and
37  * that both that copyright notice and this permission notice appear in
38  * supporting documentation, and that the name of OpenVision not be used
39  * in advertising or publicity pertaining to distribution of the software
40  * without specific, written prior permission. OpenVision makes no
41  * representations about the suitability of this software for any
42  * purpose.  It is provided "as is" without express or implied warranty.
43  *
44  * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
45  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
46  * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR
47  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
48  * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
49  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
50  * PERFORMANCE OF THIS SOFTWARE.
51  */
52 
53 #ifndef _GSSAPIP_KRB5_H_
54 #define _GSSAPIP_KRB5_H_
55 
56 #include <k5-int.h>
57 
58 #ifdef HAVE_MEMORY_H
59 #include <memory.h>
60 #endif
61 
62 /* work around sunos braindamage */
63 #ifdef major
64 #undef major
65 #endif
66 #ifdef minor
67 #undef minor
68 #endif
69 
70 #include "gssapiP_generic.h"
71 
72 /* The include of gssapi_krb5.h will dtrt with the above #defines in
73  * effect.
74  */
75 #include "gssapi_krb5.h"
76 #include "gssapi_err_krb5.h"
77 
78 /* for debugging */
79 #undef CFX_EXERCISE
80 
81 /** constants **/
82 
83 #define GSS_MECH_KRB5_OID_LENGTH 9
84 #define GSS_MECH_KRB5_OID "\052\206\110\206\367\022\001\002\002"
85 
86 #define GSS_MECH_KRB5_OLD_OID_LENGTH 5
87 #define GSS_MECH_KRB5_OLD_OID "\053\005\001\005\002"
88 
89 /* Incorrect krb5 mech OID emitted by MS. */
90 #define GSS_MECH_KRB5_WRONG_OID_LENGTH 9
91 #define GSS_MECH_KRB5_WRONG_OID "\052\206\110\202\367\022\001\002\002"
92 
93 
94 #define CKSUMTYPE_KG_CB		0x8003
95 
96 #define KG_TOK_CTX_AP_REQ	0x0100
97 #define KG_TOK_CTX_AP_REP	0x0200
98 #define KG_TOK_CTX_ERROR	0x0300
99 #define KG_TOK_SIGN_MSG		0x0101
100 #define KG_TOK_SEAL_MSG		0x0201
101 #define	KG_TOK_MIC_MSG		0x0101
102 #define	KG_TOK_WRAP_MSG		0x0201
103 #define KG_TOK_DEL_CTX		0x0102
104 
105 #define KG2_TOK_INITIAL		0x0101
106 #define KG2_TOK_RESPONSE	0x0202
107 #define KG2_TOK_MIC		0x0303
108 #define KG2_TOK_WRAP_INTEG	0x0404
109 #define KG2_TOK_WRAP_PRIV	0x0505
110 
111 #define KRB5_GSS_FOR_CREDS_OPTION 1
112 
113 #define KG2_RESP_FLAG_ERROR		0x0001
114 #define KG2_RESP_FLAG_DELEG_OK		0x0002
115 
116 /* These are to be stored in little-endian order, i.e., des-mac is
117    stored as 02 00.  */
118 enum sgn_alg {
119   SGN_ALG_DES_MAC_MD5           = 0x0000,
120   SGN_ALG_MD2_5                 = 0x0001,
121   SGN_ALG_DES_MAC               = 0x0002,
122   SGN_ALG_3			= 0x0003, /* not published */
123   SGN_ALG_HMAC_MD5              = 0x0011, /* microsoft w2k;  */
124   SGN_ALG_HMAC_SHA1_DES3_KD     = 0x0004
125 };
126 enum seal_alg {
127   SEAL_ALG_NONE            = 0xffff,
128   SEAL_ALG_DES             = 0x0000,
129   SEAL_ALG_1		   = 0x0001, /* not published */
130   SEAL_ALG_MICROSOFT_RC4   = 0x0010, /* microsoft w2k;  */
131   SEAL_ALG_DES3KD          = 0x0002
132 };
133 
134 /* for 3DES */
135 #define KG_USAGE_SEAL 22
136 #define KG_USAGE_SIGN 23
137 #define KG_USAGE_SEQ  24
138 
139 /* for draft-ietf-krb-wg-gssapi-cfx-01 */
140 #define KG_USAGE_ACCEPTOR_SEAL	22
141 #define KG_USAGE_ACCEPTOR_SIGN	23
142 #define KG_USAGE_INITIATOR_SEAL	24
143 #define KG_USAGE_INITIATOR_SIGN	25
144 
145 enum qop {
146   GSS_KRB5_INTEG_C_QOP_MD5       = 0x0001, /* *partial* MD5 = "MD2.5" */
147   GSS_KRB5_INTEG_C_QOP_DES_MD5   = 0x0002,
148   GSS_KRB5_INTEG_C_QOP_DES_MAC   = 0x0003,
149   GSS_KRB5_INTEG_C_QOP_HMAC_SHA1 = 0x0004,
150   GSS_KRB5_INTEG_C_QOP_MASK      = 0x00ff,
151   GSS_KRB5_CONF_C_QOP_DES        = 0x0100,
152   GSS_KRB5_CONF_C_QOP_DES3_KD    = 0x0200,
153   GSS_KRB5_CONF_C_QOP_MASK       = 0xff00
154 };
155 
156 /** internal types **/
157 
158 typedef krb5_principal krb5_gss_name_t;
159 
160 typedef struct _krb5_gss_cred_id_rec {
161    /* protect against simultaneous accesses */
162    k5_mutex_t lock;
163 
164    /* name/type of credential */
165    gss_cred_usage_t usage;
166    krb5_principal princ;	/* this is not interned as a gss_name_t */
167    int prerfc_mech;
168    int rfc_mech;
169 
170    /* keytab (accept) data */
171    krb5_keytab keytab;
172    krb5_rcache rcache;
173 
174    /* ccache (init) data */
175    krb5_ccache ccache;
176    krb5_timestamp tgt_expire;
177    krb5_enctype *req_enctypes;	/* limit negotiated enctypes to this list */
178 } krb5_gss_cred_id_rec, *krb5_gss_cred_id_t;
179 
180 typedef struct _krb5_gss_ctx_id_rec {
181    unsigned int initiate : 1;	/* nonzero if initiating, zero if accepting */
182    unsigned int established : 1;
183    unsigned int big_endian : 1;
184    unsigned int have_acceptor_subkey : 1;
185    unsigned int seed_init : 1;	/* XXX tested but never actually set */
186    OM_uint32 gss_flags;
187    unsigned char seed[16];
188    krb5_principal here;
189    krb5_principal there;
190    krb5_keyblock *subkey;
191    int signalg;
192    size_t cksum_size;
193    int sealalg;
194    krb5_keyblock *enc;
195    krb5_keyblock *seq;
196    krb5_timestamp endtime;
197    krb5_flags krb_flags;
198    /* XXX these used to be signed.  the old spec is inspecific, and
199       the new spec specifies unsigned.  I don't believe that the change
200       affects the wire encoding. */
201    gssint_uint64 seq_send;
202    gssint_uint64 seq_recv;
203    void *seqstate;
204    krb5_context k5_context;
205    krb5_auth_context auth_context;
206    gss_OID_desc *mech_used;
207     /* Protocol spec revision
208        0 => RFC 1964 with 3DES and RC4 enhancements
209        1 => draft-ietf-krb-wg-gssapi-cfx-01
210        No others defined so far.  */
211    int proto;
212    krb5_cksumtype cksumtype;	/* for "main" subkey */
213    krb5_keyblock *acceptor_subkey; /* CFX only */
214    krb5_cksumtype acceptor_subkey_cksumtype;
215    int cred_rcache;		/* did we get rcache from creds? */
216 } krb5_gss_ctx_id_rec, *krb5_gss_ctx_id_t;
217 
218 extern g_set kg_vdb;
219 
220 extern k5_mutex_t gssint_krb5_keytab_lock;
221 
222 /* helper macros */
223 
224 #define kg_save_name(name)		g_save_name(&kg_vdb,name)
225 #define kg_save_cred_id(cred)		g_save_cred_id(&kg_vdb,cred)
226 #define kg_save_ctx_id(ctx)		g_save_ctx_id(&kg_vdb,ctx)
227 #define kg_save_lucidctx_id(lctx)	g_save_lucidctx_id(&kg_vdb,lctx)
228 
229 #define kg_validate_name(name)		g_validate_name(&kg_vdb,name)
230 #define kg_validate_cred_id(cred)	g_validate_cred_id(&kg_vdb,cred)
231 #define kg_validate_ctx_id(ctx)		g_validate_ctx_id(&kg_vdb,ctx)
232 #define kg_validate_lucidctx_id(lctx)	g_validate_lucidctx_id(&kg_vdb,lctx)
233 
234 #define kg_delete_name(name)		g_delete_name(&kg_vdb,name)
235 #define kg_delete_cred_id(cred)		g_delete_cred_id(&kg_vdb,cred)
236 #define kg_delete_ctx_id(ctx)		g_delete_ctx_id(&kg_vdb,ctx)
237 #define kg_delete_lucidctx_id(lctx)	g_delete_lucidctx_id(&kg_vdb,lctx)
238 
239 /** helper functions **/
240 
241 OM_uint32 kg_get_defcred
242 	(OM_uint32 *minor_status,
243 		   gss_cred_id_t *cred);
244 
245 krb5_error_code kg_checksum_channel_bindings
246          (krb5_context context, gss_channel_bindings_t cb,
247 					     krb5_checksum *cksum,
248 					     int bigend);
249 
250 krb5_error_code kg_make_seq_num (krb5_context context,
251 					   krb5_keyblock *key,
252             int direction, krb5_ui_4 seqnum, unsigned char *cksum,
253 				unsigned char *buf);
254 
255 krb5_error_code kg_get_seq_num (krb5_context context,
256 					  krb5_keyblock *key,
257             unsigned char *cksum, unsigned char *buf, int *direction,
258 					  krb5_ui_4 *seqnum);
259 
260 krb5_error_code kg_make_seed (krb5_context context,
261 					krb5_keyblock *key,
262 					unsigned char *seed);
263 
264 int kg_confounder_size (krb5_context context, krb5_keyblock *key);
265 
266 krb5_error_code kg_make_confounder (krb5_context context,
267 	    krb5_keyblock *key, unsigned char *buf);
268 
269 krb5_error_code kg_encrypt (krb5_context context,
270 				      krb5_keyblock *key, int usage,
271 				      krb5_pointer iv,
272 				      krb5_const_pointer in,
273 				      krb5_pointer out,
274 				      unsigned int length);
275 krb5_error_code
276 kg_arcfour_docrypt (krb5_context,
277 		    const krb5_keyblock *longterm_key , int ms_usage,
278 		    const unsigned char *kd_data, size_t kd_data_len,
279 		    const unsigned char *input_buf, size_t input_len,
280 		    unsigned char *output_buf);
281 
282 krb5_error_code kg_decrypt (krb5_context context,
283 				      krb5_keyblock *key,  int usage,
284 				      krb5_pointer iv,
285 				      krb5_const_pointer in,
286 				      krb5_pointer out,
287 				      unsigned int length);
288 
289 OM_uint32 kg_seal (OM_uint32 *minor_status,
290 		  gss_ctx_id_t context_handle,
291 		  int conf_req_flag,
292 		  int qop_req,
293 		  gss_buffer_t input_message_buffer,
294 		  int *conf_state,
295 		  gss_buffer_t output_message_buffer,
296 		  int toktype);
297 
298 OM_uint32 kg_unseal (OM_uint32 *minor_status,
299 		    gss_ctx_id_t context_handle,
300 		    gss_buffer_t input_token_buffer,
301 		    gss_buffer_t message_buffer,
302 		    int *conf_state,
303 		    int *qop_state,
304 		    int toktype);
305 
306 OM_uint32 kg_seal_size (OM_uint32 *minor_status,
307 				  gss_ctx_id_t context_handle,
308 				  int conf_req_flag,
309 				  gss_qop_t qop_req,
310 				  OM_uint32 output_size,
311 				  OM_uint32 *input_size);
312 
313 krb5_error_code kg_ctx_size (krb5_context kcontext,
314 				       krb5_pointer arg,
315 				       size_t *sizep);
316 
317 krb5_error_code kg_ctx_externalize (krb5_context kcontext,
318 					      krb5_pointer arg,
319 					      krb5_octet **buffer,
320 					      size_t *lenremain);
321 
322 krb5_error_code kg_ctx_internalize (krb5_context kcontext,
323 					      krb5_pointer *argp,
324 					      krb5_octet **buffer,
325 					      size_t *lenremain);
326 
327 OM_uint32 kg_sync_ccache_name (krb5_context context, OM_uint32 *minor_status);
328 
329 OM_uint32 kg_caller_provided_ccache_name (OM_uint32 *minor_status,
330                                           int *out_caller_provided_name);
331 
332 OM_uint32 kg_get_ccache_name (OM_uint32 *minor_status,
333                               const char **out_name);
334 
335 OM_uint32 kg_set_ccache_name (OM_uint32 *minor_status,
336                               const char *name);
337 
338 /** declarations of internal name mechanism functions **/
339 
340 OM_uint32 krb5_gss_acquire_cred
341 (OM_uint32*,       /* minor_status */
342             gss_name_t,       /* desired_name */
343             OM_uint32,        /* time_req */
344             gss_OID_set,      /* desired_mechs */
345             gss_cred_usage_t, /* cred_usage */
346             gss_cred_id_t*,   /* output_cred_handle */
347             gss_OID_set*,     /* actual_mechs */
348             OM_uint32*        /* time_rec */
349            );
350 
351 OM_uint32 krb5_gss_release_cred
352 (OM_uint32*,       /* minor_status */
353             gss_cred_id_t*    /* cred_handle */
354            );
355 
356 OM_uint32 krb5_gss_init_sec_context
357 (OM_uint32*,       /* minor_status */
358             gss_cred_id_t,    /* claimant_cred_handle */
359             gss_ctx_id_t*,    /* context_handle */
360             gss_name_t,       /* target_name */
361             gss_OID,          /* mech_type */
362             OM_uint32,        /* req_flags */
363             OM_uint32,        /* time_req */
364             gss_channel_bindings_t,
365                               /* input_chan_bindings */
366             gss_buffer_t,     /* input_token */
367             gss_OID*,         /* actual_mech_type */
368             gss_buffer_t,     /* output_token */
369             OM_uint32*,       /* ret_flags */
370             OM_uint32*        /* time_rec */
371            );
372 
373 OM_uint32 krb5_gss_accept_sec_context
374 (OM_uint32*,       /* minor_status */
375             gss_ctx_id_t*,    /* context_handle */
376             gss_cred_id_t,    /* verifier_cred_handle */
377             gss_buffer_t,     /* input_token_buffer */
378             gss_channel_bindings_t,
379                               /* input_chan_bindings */
380             gss_name_t*,      /* src_name */
381             gss_OID*,         /* mech_type */
382             gss_buffer_t,     /* output_token */
383             OM_uint32*,       /* ret_flags */
384             OM_uint32*,       /* time_rec */
385             gss_cred_id_t*    /* delegated_cred_handle */
386            );
387 
388 OM_uint32 krb5_gss_process_context_token
389 (OM_uint32*,       /* minor_status */
390             gss_ctx_id_t,     /* context_handle */
391             gss_buffer_t      /* token_buffer */
392            );
393 
394 OM_uint32 krb5_gss_delete_sec_context
395 (OM_uint32*,       /* minor_status */
396             gss_ctx_id_t*,    /* context_handle */
397             gss_buffer_t      /* output_token */
398 #ifdef	_KERNEL
399             /* */, OM_uint32	/* context verifier */
400 #endif
401            );
402 
403 OM_uint32 krb5_gss_context_time
404 (OM_uint32*,       /* minor_status */
405             gss_ctx_id_t,     /* context_handle */
406             OM_uint32*        /* time_rec */
407            );
408 
409 OM_uint32 krb5_gss_sign
410 (OM_uint32*,       /* minor_status */
411             gss_ctx_id_t,     /* context_handle */
412             int,              /* qop_req */
413             gss_buffer_t,     /* message_buffer */
414             gss_buffer_t      /* message_token */
415 #ifdef	_KERNEL
416             /* */, OM_uint32	/* context verifier */
417 #endif
418            );
419 
420 OM_uint32 krb5_gss_verify
421 (OM_uint32*,       /* minor_status */
422             gss_ctx_id_t,     /* context_handle */
423             gss_buffer_t,     /* message_buffer */
424             gss_buffer_t,     /* token_buffer */
425             int*              /* qop_state */
426 #ifdef	_KERNEL
427             /* */, OM_uint32	/* context verifier */
428 #endif
429            );
430 
431 /* EXPORT DELETE START */
432 OM_uint32 krb5_gss_seal
433 (OM_uint32*,       /* minor_status */
434             gss_ctx_id_t,     /* context_handle */
435             int,              /* conf_req_flag */
436             int,              /* qop_req */
437             gss_buffer_t,     /* input_message_buffer */
438             int*,             /* conf_state */
439             gss_buffer_t      /* output_message_buffer */
440 #ifdef	_KERNEL
441             /* */, OM_uint32	/* context verifier */
442 #endif
443            );
444 
445 OM_uint32 krb5_gss_unseal
446 (OM_uint32*,       /* minor_status */
447             gss_ctx_id_t,     /* context_handle */
448             gss_buffer_t,     /* input_message_buffer */
449             gss_buffer_t,     /* output_message_buffer */
450             int*,             /* conf_state */
451             int*              /* qop_state */
452 #ifdef	_KERNEL
453             /* */, OM_uint32	/* context verifier */
454 #endif
455            );
456 /* EXPORT DELETE END */
457 
458 OM_uint32 krb5_gss_display_status
459 (OM_uint32*,       /* minor_status */
460             OM_uint32,        /* status_value */
461             int,              /* status_type */
462             gss_OID,          /* mech_type */
463             OM_uint32*,       /* message_context */
464             gss_buffer_t      /* status_string */
465            );
466 
467 OM_uint32 krb5_gss_indicate_mechs
468 (OM_uint32*,       /* minor_status */
469             gss_OID_set*      /* mech_set */
470            );
471 
472 OM_uint32 krb5_gss_compare_name
473 (OM_uint32*,       /* minor_status */
474             gss_name_t,       /* name1 */
475             gss_name_t,       /* name2 */
476             int*              /* name_equal */
477            );
478 
479 OM_uint32 krb5_gss_display_name
480 (OM_uint32*,      /* minor_status */
481             gss_name_t,      /* input_name */
482             gss_buffer_t,    /* output_name_buffer */
483             gss_OID*         /* output_name_type */
484            );
485 
486 OM_uint32 krb5_gss_import_name
487 (OM_uint32*,       /* minor_status */
488             gss_buffer_t,     /* input_name_buffer */
489             gss_OID,          /* input_name_type */
490             gss_name_t*       /* output_name */
491            );
492 
493 OM_uint32 krb5_gss_release_name
494 (OM_uint32*,       /* minor_status */
495             gss_name_t*       /* input_name */
496            );
497 
498 OM_uint32 krb5_gss_inquire_cred
499 (OM_uint32 *,      /* minor_status */
500             gss_cred_id_t,    /* cred_handle */
501             gss_name_t *,     /* name */
502             OM_uint32 *,      /* lifetime */
503             gss_cred_usage_t*,/* cred_usage */
504             gss_OID_set *     /* mechanisms */
505            );
506 
507 OM_uint32 krb5_gss_inquire_context
508 (OM_uint32*,       /* minor_status */
509 	    gss_ctx_id_t,     /* context_handle */
510 	    gss_name_t*,      /* initiator_name */
511 	    gss_name_t*,      /* acceptor_name */
512 	    OM_uint32*,       /* lifetime_rec */
513 	    gss_OID*,         /* mech_type */
514 	    OM_uint32*,       /* ret_flags */
515 	    int*,             /* locally_initiated */
516 	    int*              /* open */
517 	   );
518 
519 /* New V2 entry points */
520 OM_uint32 krb5_gss_get_mic
521 (OM_uint32 *,		/* minor_status */
522 	    gss_ctx_id_t,		/* context_handle */
523 	    gss_qop_t,			/* qop_req */
524 	    gss_buffer_t,		/* message_buffer */
525 	    gss_buffer_t		/* message_token */
526 	   );
527 
528 OM_uint32 krb5_gss_verify_mic
529 (OM_uint32 *,		/* minor_status */
530 	    gss_ctx_id_t,		/* context_handle */
531 	    gss_buffer_t,		/* message_buffer */
532 	    gss_buffer_t,		/* message_token */
533 	    gss_qop_t *			/* qop_state */
534 	   );
535 
536 OM_uint32 krb5_gss_wrap
537 (OM_uint32 *,		/* minor_status */
538 	    gss_ctx_id_t,		/* context_handle */
539 	    int,			/* conf_req_flag */
540 	    gss_qop_t,			/* qop_req */
541 	    gss_buffer_t,		/* input_message_buffer */
542 	    int *,			/* conf_state */
543 	    gss_buffer_t		/* output_message_buffer */
544 	   );
545 
546 OM_uint32 krb5_gss_unwrap
547 (OM_uint32 *,		/* minor_status */
548 	    gss_ctx_id_t,		/* context_handle */
549 	    gss_buffer_t,		/* input_message_buffer */
550 	    gss_buffer_t,		/* output_message_buffer */
551 	    int *,			/* conf_state */
552 	    gss_qop_t *			/* qop_state */
553 	   );
554 
555 OM_uint32 krb5_gss_wrap_size_limit
556 (OM_uint32 *,		/* minor_status */
557 	    gss_ctx_id_t,		/* context_handle */
558 	    int,			/* conf_req_flag */
559 	    gss_qop_t,			/* qop_req */
560 	    OM_uint32,			/* req_output_size */
561 	    OM_uint32 *			/* max_input_size */
562 	   );
563 
564 OM_uint32 krb5_gss_import_name_object
565 (OM_uint32 *,		/* minor_status */
566 	    void *,			/* input_name */
567 	    gss_OID,			/* input_name_type */
568 	    gss_name_t *		/* output_name */
569 	   );
570 
571 OM_uint32 krb5_gss_export_name_object
572 (OM_uint32 *,		/* minor_status */
573 	    gss_name_t,			/* input_name */
574 	    gss_OID,			/* desired_name_type */
575 	    void * *			/* output_name */
576 	   );
577 
578 OM_uint32 krb5_gss_add_cred
579 (OM_uint32 *,		/* minor_status */
580 	    gss_cred_id_t,		/* input_cred_handle */
581 	    gss_name_t,			/* desired_name */
582 	    gss_OID,			/* desired_mech */
583 	    gss_cred_usage_t,		/* cred_usage */
584 	    OM_uint32,			/* initiator_time_req */
585 	    OM_uint32,			/* acceptor_time_req */
586 	    gss_cred_id_t *,		/* output_cred_handle */
587 	    gss_OID_set *,		/* actual_mechs */
588 	    OM_uint32 *,		/* initiator_time_rec */
589 	    OM_uint32 *			/* acceptor_time_rec */
590 	   );
591 
592 OM_uint32 krb5_gss_inquire_cred_by_mech
593 (OM_uint32  *,		/* minor_status */
594 	    gss_cred_id_t,		/* cred_handle */
595 	    gss_OID,			/* mech_type */
596 	    gss_name_t *,		/* name */
597 	    OM_uint32 *,		/* initiator_lifetime */
598 	    OM_uint32 *,		/* acceptor_lifetime */
599 	    gss_cred_usage_t * 		/* cred_usage */
600 	   );
601 
602 OM_uint32 krb5_gss_export_sec_context
603 (OM_uint32 *,		/* minor_status */
604 	    gss_ctx_id_t *,		/* context_handle */
605 	    gss_buffer_t		/* interprocess_token */
606 	    );
607 
608 OM_uint32 krb5_gss_import_sec_context
609 (OM_uint32 *,		/* minor_status */
610 	    gss_buffer_t,		/* interprocess_token */
611 	    gss_ctx_id_t *		/* context_handle */
612             /* Note no _KERNEL context verifier */
613 	    );
614 
615 krb5_error_code krb5_gss_ser_init(krb5_context);
616 
617 OM_uint32 krb5_gss_release_oid
618 (OM_uint32 *,		/* minor_status */
619 	    gss_OID *			/* oid */
620 	   );
621 
622 OM_uint32 krb5_gss_internal_release_oid
623 (OM_uint32 *,		/* minor_status */
624 	    gss_OID *			/* oid */
625 	   );
626 
627 OM_uint32 krb5_gss_inquire_names_for_mech
628 (OM_uint32 *,		/* minor_status */
629 	    gss_OID,			/* mechanism */
630 	    gss_OID_set *		/* name_types */
631 	   );
632 
633 /* SUNW15resync - XXX nullify? */
634 OM_uint32 krb5_gss_canonicalize_name
635 (OM_uint32  *,		/* minor_status */
636 	    const gss_name_t,		/* input_name */
637 	    const gss_OID,		/* mech_type */
638 	    gss_name_t *		/* output_name */
639 	 );
640 
641 OM_uint32 krb5_gss_export_name
642 (OM_uint32  *,		/* minor_status */
643 	    const gss_name_t,		/* input_name */
644 	    gss_buffer_t		/* exported_name */
645 	 );
646 
647 OM_uint32 krb5_gss_duplicate_name
648 (OM_uint32  *,		/* minor_status */
649 	    const gss_name_t,		/* input_name */
650 	    gss_name_t *		/* dest_name */
651 	 );
652 
653 OM_uint32 krb5_gss_validate_cred
654 (OM_uint32 *,		/* minor_status */
655 	    gss_cred_id_t		/* cred */
656          );
657 
658 OM_uint32
659 krb5_gss_validate_cred_1(OM_uint32 * /* minor_status */,
660 			 gss_cred_id_t /* cred_handle */,
661 			 krb5_context /* context */);
662 
663 gss_OID krb5_gss_convert_static_mech_oid(gss_OID oid);
664 
665 krb5_error_code gss_krb5int_make_seal_token_v3(krb5_context,
666 					       krb5_gss_ctx_id_rec *,
667 					       const gss_buffer_desc *,
668 					       gss_buffer_t,
669 					       int, int);
670 
671 OM_uint32 gss_krb5int_unseal_token_v3(krb5_context *contextptr,
672 				      OM_uint32 *minor_status,
673 				      krb5_gss_ctx_id_rec *ctx,
674 				      unsigned char *ptr, int bodysize,
675 				      gss_buffer_t message_buffer,
676 				      int *conf_state, int *qop_state,
677 				      int toktype);
678 
679 /*
680  * SUNW15resync
681  * Solaris specific interfaces start
682  */
683 
684 OM_uint32 krb5_gss_store_cred (
685 	    OM_uint32 *,            /* minor_status */
686 	    const gss_cred_id_t,    /* input_cred */
687 	    gss_cred_usage_t,       /* cred_usage */
688 	    const gss_OID,          /* desired_mech */
689 	    OM_uint32,              /* overwrite_cred */
690 	    OM_uint32,              /* default_cred */
691 	    gss_OID_set *,          /* elements_stored */
692 	    gss_cred_usage_t *      /* cred_usage_stored */
693 	   );
694 
695 OM_uint32 krb5_pname_to_uid(
696 		OM_uint32 *,		/* minor status */
697 		const gss_name_t,	/* pname */
698 		uid_t *			/* uidOUt */
699 		);
700 
701 OM_uint32 krb5_gss_userok(
702 	OM_uint32 *,		/* minor status */
703 	const gss_name_t,	/* remote user principal name */
704 	const char *,		/* local unix user name */
705 	int *			/* remote user ok to login w/out pw? */
706 	);
707 
708 
709 /*
710  * SUNW15resync
711  * Solaris specific interfaces end
712  */
713 
714 
715 /*
716  * These take unglued krb5-mech-specific contexts.
717  */
718 
719 OM_uint32 KRB5_CALLCONV gss_krb5int_get_tkt_flags
720 	(OM_uint32 *minor_status,
721 		   gss_ctx_id_t context_handle,
722 		   krb5_flags *ticket_flags);
723 
724 OM_uint32 KRB5_CALLCONV gss_krb5int_copy_ccache
725 	(OM_uint32 *minor_status,
726 		   gss_cred_id_t cred_handle,
727 		   krb5_ccache out_ccache);
728 
729 OM_uint32 KRB5_CALLCONV
730 gss_krb5int_set_allowable_enctypes(OM_uint32 *minor_status,
731 				   gss_cred_id_t cred,
732 				   OM_uint32 num_ktypes,
733 				   krb5_enctype *ktypes);
734 
735 OM_uint32 KRB5_CALLCONV
736 gss_krb5int_export_lucid_sec_context(OM_uint32 *minor_status,
737 				     gss_ctx_id_t *context_handle,
738 				     OM_uint32 version,
739 				     void **kctx);
740 
741 
742 extern k5_mutex_t kg_kdc_flag_mutex;
743 krb5_error_code krb5_gss_init_context (krb5_context *ctxp);
744 
745 krb5_error_code krb5_gss_use_kdc_context(void);
746 
747 #endif /* _GSSAPIP_KRB5_H_ */
748