1/*-
2 * Copyright (c) 2005 Doug Rabson
3 * All rights reserved.
4 *
5 * Portions Copyright (c) 2009 Apple Inc. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 *    notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 *    notice, this list of conditions and the following disclaimer in the
14 *    documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 *	$FreeBSD: src/lib/libgssapi/mech_switch.h,v 1.1 2005/12/29 14:40:20 dfr Exp $
29 */
30
31#ifndef GSSAPI_MECH_H
32#define GSSAPI_MECH_H 1
33
34#include <gssapi.h>
35
36struct _gss_name;
37struct _gss_cred;
38
39typedef OM_uint32 GSSAPI_CALLCONV _gss_acquire_cred_t
40	      (OM_uint32 *,            /* minor_status */
41	       const gss_name_t,       /* desired_name */
42	       OM_uint32,              /* time_req */
43	       const gss_OID_set,      /* desired_mechs */
44	       gss_cred_usage_t,       /* cred_usage */
45	       gss_cred_id_t *,        /* output_cred_handle */
46	       gss_OID_set *,          /* actual_mechs */
47	       OM_uint32 *             /* time_rec */
48	      );
49
50typedef OM_uint32 GSSAPI_CALLCONV _gss_release_cred_t
51	      (OM_uint32 *,            /* minor_status */
52	       gss_cred_id_t *         /* cred_handle */
53	      );
54
55typedef OM_uint32 GSSAPI_CALLCONV _gss_init_sec_context_t
56	      (OM_uint32 *,            /* minor_status */
57	       const gss_cred_id_t,    /* initiator_cred_handle */
58	       gss_ctx_id_t *,         /* context_handle */
59	       const gss_name_t,       /* target_name */
60	       const gss_OID,          /* mech_type */
61	       OM_uint32,              /* req_flags */
62	       OM_uint32,              /* time_req */
63	       const gss_channel_bindings_t,
64				       /* input_chan_bindings */
65	       const gss_buffer_t,     /* input_token */
66	       gss_OID *,              /* actual_mech_type */
67	       gss_buffer_t,           /* output_token */
68	       OM_uint32 *,            /* ret_flags */
69	       OM_uint32 *             /* time_rec */
70	      );
71
72typedef OM_uint32 GSSAPI_CALLCONV _gss_accept_sec_context_t
73	      (OM_uint32 *,            /* minor_status */
74	       gss_ctx_id_t *,         /* context_handle */
75	       const gss_cred_id_t,    /* acceptor_cred_handle */
76	       const gss_buffer_t,     /* input_token_buffer */
77	       const gss_channel_bindings_t,
78				       /* input_chan_bindings */
79	       gss_name_t *,           /* src_name */
80	       gss_OID *,              /* mech_type */
81	       gss_buffer_t,           /* output_token */
82	       OM_uint32 *,            /* ret_flags */
83	       OM_uint32 *,            /* time_rec */
84	       gss_cred_id_t *         /* delegated_cred_handle */
85	      );
86
87typedef OM_uint32 GSSAPI_CALLCONV _gss_process_context_token_t
88	      (OM_uint32 *,            /* minor_status */
89	       const gss_ctx_id_t,     /* context_handle */
90	       const gss_buffer_t      /* token_buffer */
91	      );
92
93typedef OM_uint32 GSSAPI_CALLCONV _gss_delete_sec_context_t
94	      (OM_uint32 *,            /* minor_status */
95	       gss_ctx_id_t *,         /* context_handle */
96	       gss_buffer_t            /* output_token */
97	      );
98
99typedef OM_uint32 GSSAPI_CALLCONV _gss_context_time_t
100	      (OM_uint32 *,            /* minor_status */
101	       const gss_ctx_id_t,     /* context_handle */
102	       OM_uint32 *             /* time_rec */
103	      );
104
105typedef OM_uint32 GSSAPI_CALLCONV _gss_get_mic_t
106	      (OM_uint32 *,            /* minor_status */
107	       const gss_ctx_id_t,     /* context_handle */
108	       gss_qop_t,              /* qop_req */
109	       const gss_buffer_t,     /* message_buffer */
110	       gss_buffer_t            /* message_token */
111	      );
112
113typedef OM_uint32 GSSAPI_CALLCONV _gss_verify_mic_t
114	      (OM_uint32 *,            /* minor_status */
115	       const gss_ctx_id_t,     /* context_handle */
116	       const gss_buffer_t,     /* message_buffer */
117	       const gss_buffer_t,     /* token_buffer */
118	       gss_qop_t *             /* qop_state */
119	      );
120
121typedef OM_uint32 GSSAPI_CALLCONV _gss_wrap_t
122	      (OM_uint32 *,            /* minor_status */
123	       const gss_ctx_id_t,     /* context_handle */
124	       int,                    /* conf_req_flag */
125	       gss_qop_t,              /* qop_req */
126	       const gss_buffer_t,     /* input_message_buffer */
127	       int *,                  /* conf_state */
128	       gss_buffer_t            /* output_message_buffer */
129	      );
130
131typedef OM_uint32 GSSAPI_CALLCONV _gss_unwrap_t
132	      (OM_uint32 *,            /* minor_status */
133	       const gss_ctx_id_t,     /* context_handle */
134	       const gss_buffer_t,     /* input_message_buffer */
135	       gss_buffer_t,           /* output_message_buffer */
136	       int *,                  /* conf_state */
137	       gss_qop_t *             /* qop_state */
138	      );
139
140typedef OM_uint32 GSSAPI_CALLCONV _gss_display_status_t
141	      (OM_uint32 *,            /* minor_status */
142	       OM_uint32,              /* status_value */
143	       int,                    /* status_type */
144	       const gss_OID,          /* mech_type */
145	       OM_uint32 *,            /* message_context */
146	       gss_buffer_t            /* status_string */
147	      );
148
149typedef OM_uint32 GSSAPI_CALLCONV _gss_indicate_mechs_t
150	      (OM_uint32 *,            /* minor_status */
151	       gss_OID_set *           /* mech_set */
152	      );
153
154typedef OM_uint32 GSSAPI_CALLCONV _gss_compare_name_t
155	      (OM_uint32 *,            /* minor_status */
156	       const gss_name_t,       /* name1 */
157	       const gss_name_t,       /* name2 */
158	       int *                   /* name_equal */
159	      );
160
161typedef OM_uint32 GSSAPI_CALLCONV _gss_display_name_t
162	      (OM_uint32 *,            /* minor_status */
163	       const gss_name_t,       /* input_name */
164	       gss_buffer_t,           /* output_name_buffer */
165	       gss_OID *               /* output_name_type */
166	      );
167
168typedef OM_uint32 GSSAPI_CALLCONV _gss_import_name_t
169	      (OM_uint32 *,            /* minor_status */
170	       const gss_buffer_t,     /* input_name_buffer */
171	       gss_const_OID,          /* input_name_type */
172	       gss_name_t *            /* output_name */
173	      );
174
175typedef OM_uint32 GSSAPI_CALLCONV _gss_export_name_t
176	      (OM_uint32 *,            /* minor_status */
177	       const gss_name_t,       /* input_name */
178	       gss_buffer_t            /* exported_name */
179	      );
180
181typedef OM_uint32 GSSAPI_CALLCONV _gss_release_name_t
182	      (OM_uint32 *,            /* minor_status */
183	       gss_name_t *            /* input_name */
184	      );
185
186typedef OM_uint32 GSSAPI_CALLCONV _gss_inquire_cred_t
187	      (OM_uint32 *,            /* minor_status */
188	       const gss_cred_id_t,    /* cred_handle */
189	       gss_name_t *,           /* name */
190	       OM_uint32 *,            /* lifetime */
191	       gss_cred_usage_t *,     /* cred_usage */
192	       gss_OID_set *           /* mechanisms */
193	      );
194
195typedef OM_uint32 GSSAPI_CALLCONV _gss_inquire_context_t
196	      (OM_uint32 *,            /* minor_status */
197	       const gss_ctx_id_t,     /* context_handle */
198	       gss_name_t *,           /* src_name */
199	       gss_name_t *,           /* targ_name */
200	       OM_uint32 *,            /* lifetime_rec */
201	       gss_OID *,              /* mech_type */
202	       OM_uint32 *,            /* ctx_flags */
203	       int *,                  /* locally_initiated */
204	       int *                   /* open */
205	      );
206
207typedef OM_uint32 GSSAPI_CALLCONV _gss_wrap_size_limit_t
208	      (OM_uint32 *,            /* minor_status */
209	       const gss_ctx_id_t,     /* context_handle */
210	       int,                    /* conf_req_flag */
211	       gss_qop_t,              /* qop_req */
212	       OM_uint32,              /* req_output_size */
213	       OM_uint32 *             /* max_input_size */
214	      );
215
216typedef OM_uint32 GSSAPI_CALLCONV _gss_add_cred_t (
217	       OM_uint32 *,            /* minor_status */
218	       const gss_cred_id_t,    /* input_cred_handle */
219	       const gss_name_t,       /* desired_name */
220	       const gss_OID,          /* desired_mech */
221	       gss_cred_usage_t,       /* cred_usage */
222	       OM_uint32,              /* initiator_time_req */
223	       OM_uint32,              /* acceptor_time_req */
224	       gss_cred_id_t *,        /* output_cred_handle */
225	       gss_OID_set *,          /* actual_mechs */
226	       OM_uint32 *,            /* initiator_time_rec */
227	       OM_uint32 *             /* acceptor_time_rec */
228	      );
229
230typedef OM_uint32 GSSAPI_CALLCONV _gss_inquire_cred_by_mech_t (
231	       OM_uint32 *,            /* minor_status */
232	       const gss_cred_id_t,    /* cred_handle */
233	       const gss_OID,          /* mech_type */
234	       gss_name_t *,           /* name */
235	       OM_uint32 *,            /* initiator_lifetime */
236	       OM_uint32 *,            /* acceptor_lifetime */
237	       gss_cred_usage_t *      /* cred_usage */
238	      );
239
240typedef OM_uint32 GSSAPI_CALLCONV _gss_export_sec_context_t (
241	       OM_uint32 *,            /* minor_status */
242	       gss_ctx_id_t *,         /* context_handle */
243	       gss_buffer_t            /* interprocess_token */
244	      );
245
246typedef OM_uint32 GSSAPI_CALLCONV _gss_import_sec_context_t (
247	       OM_uint32 *,            /* minor_status */
248	       const gss_buffer_t,     /* interprocess_token */
249	       gss_ctx_id_t *          /* context_handle */
250	      );
251
252typedef OM_uint32 GSSAPI_CALLCONV _gss_inquire_names_for_mech_t (
253	       OM_uint32 *,            /* minor_status */
254	       gss_const_OID,          /* mechanism */
255	       gss_OID_set *           /* name_types */
256	      );
257
258typedef OM_uint32 GSSAPI_CALLCONV _gss_inquire_mechs_for_name_t (
259	       OM_uint32 *,            /* minor_status */
260	       const gss_name_t,       /* input_name */
261	       gss_OID_set *           /* mech_types */
262	      );
263
264typedef OM_uint32 GSSAPI_CALLCONV _gss_canonicalize_name_t (
265	       OM_uint32 *,            /* minor_status */
266	       const gss_name_t,       /* input_name */
267	       const gss_OID,          /* mech_type */
268	       gss_name_t *            /* output_name */
269	      );
270
271typedef OM_uint32 GSSAPI_CALLCONV _gss_duplicate_name_t (
272	       OM_uint32 *,            /* minor_status */
273	       const gss_name_t,       /* src_name */
274	       gss_name_t *            /* dest_name */
275	      );
276
277typedef OM_uint32 GSSAPI_CALLCONV _gss_inquire_sec_context_by_oid (
278	       OM_uint32 *minor_status,
279	       const gss_ctx_id_t context_handle,
280	       const gss_OID desired_object,
281	       gss_buffer_set_t *data_set
282	      );
283
284typedef OM_uint32 GSSAPI_CALLCONV _gss_inquire_cred_by_oid (
285	       OM_uint32 *minor_status,
286	       const gss_cred_id_t cred,
287	       const gss_OID desired_object,
288	       gss_buffer_set_t *data_set
289	      );
290
291typedef OM_uint32 GSSAPI_CALLCONV _gss_set_sec_context_option (
292	       OM_uint32 *minor_status,
293	       gss_ctx_id_t *cred_handle,
294	       const gss_OID desired_object,
295	       const gss_buffer_t value
296 	      );
297
298typedef OM_uint32 GSSAPI_CALLCONV _gss_set_cred_option (
299	       OM_uint32 *minor_status,
300	       gss_cred_id_t *cred_handle,
301	       const gss_OID desired_object,
302	       const gss_buffer_t value
303 	      );
304
305
306typedef OM_uint32 GSSAPI_CALLCONV _gss_pseudo_random(
307    	       OM_uint32 *minor_status,
308	       gss_ctx_id_t context,
309	       int prf_key,
310	       const gss_buffer_t prf_in,
311	       ssize_t desired_output_len,
312	       gss_buffer_t prf_out
313              );
314
315typedef OM_uint32 GSSAPI_CALLCONV
316_gss_wrap_iov_t(OM_uint32 *minor_status,
317		gss_ctx_id_t  context_handle,
318		int conf_req_flag,
319		gss_qop_t qop_req,
320		int * conf_state,
321		gss_iov_buffer_desc *iov,
322		int iov_count);
323
324typedef OM_uint32 GSSAPI_CALLCONV
325_gss_unwrap_iov_t(OM_uint32 *minor_status,
326		  gss_ctx_id_t context_handle,
327		  int *conf_state,
328		  gss_qop_t *qop_state,
329		  gss_iov_buffer_desc *iov,
330		  int iov_count);
331
332typedef OM_uint32 GSSAPI_CALLCONV
333_gss_wrap_iov_length_t(OM_uint32 * minor_status,
334		       gss_ctx_id_t context_handle,
335		       int conf_req_flag,
336		       gss_qop_t qop_req,
337		       int *conf_state,
338		       gss_iov_buffer_desc *iov,
339		       int iov_count);
340
341typedef OM_uint32 GSSAPI_CALLCONV
342_gss_store_cred_t(OM_uint32         *minor_status,
343		  gss_cred_id_t     input_cred_handle,
344		  gss_cred_usage_t  cred_usage,
345		  const gss_OID     desired_mech,
346		  OM_uint32         overwrite_cred,
347		  OM_uint32         default_cred,
348		  gss_OID_set       *elements_stored,
349		  gss_cred_usage_t  *cred_usage_stored);
350
351typedef OM_uint32 GSSAPI_CALLCONV
352_gss_export_cred_t(OM_uint32 *minor_status,
353		   gss_cred_id_t cred_handle,
354		   gss_buffer_t cred_token);
355
356typedef OM_uint32 GSSAPI_CALLCONV
357_gss_import_cred_t(OM_uint32 * minor_status,
358		   gss_buffer_t cred_token,
359		   gss_cred_id_t * cred_handle);
360
361typedef OM_uint32
362_gss_acquire_cred_ex_t(gss_status_id_t /* status */,
363		       const gss_name_t /* desired_name */,
364		       OM_uint32 /* flags */,
365		       OM_uint32 /* time_req */,
366		       gss_cred_usage_t /* cred_usage */,
367		       gss_auth_identity_t /* identity */,
368		       void * /* ctx */,
369		       void (* /*complete */)(void *, OM_uint32, gss_status_id_t, gss_cred_id_t, OM_uint32));
370
371typedef OM_uint32 GSSAPI_CALLCONV
372_gss_acquire_cred_ext_t(OM_uint32 * /*minor_status */,
373		        const gss_name_t /* desired_name */,
374		        gss_const_OID /* credential_type */,
375		        const void * /* credential_data */,
376		        OM_uint32 /* time_req */,
377		        gss_const_OID /* desired_mech */,
378		        gss_cred_usage_t /* cred_usage */,
379		        gss_cred_id_t * /* output_cred_handle */);
380
381typedef void GSSAPI_CALLCONV
382_gss_iter_creds_t(OM_uint32 /* flags */,
383		  void * /* userctx */,
384		  void (* /*cred_iter */ )(void *, gss_OID, gss_cred_id_t));
385
386typedef OM_uint32 GSSAPI_CALLCONV
387_gss_destroy_cred_t(OM_uint32 * /* minor_status */,
388		    gss_cred_id_t * /* cred */);
389
390typedef OM_uint32 GSSAPI_CALLCONV
391_gss_cred_hold_t(OM_uint32 * /* minor_status */,
392		 gss_cred_id_t /* cred */);
393
394typedef OM_uint32 GSSAPI_CALLCONV
395_gss_cred_unhold_t(OM_uint32 * /* minor_status */,
396		   gss_cred_id_t /* cred */);
397
398typedef OM_uint32 GSSAPI_CALLCONV
399_gss_cred_label_set_t(OM_uint32 * /* minor_status */,
400		      gss_cred_id_t /* cred */,
401		      const char * /* label */,
402		      gss_buffer_t /* value */);
403
404typedef OM_uint32 GSSAPI_CALLCONV
405_gss_cred_label_get_t(OM_uint32 * /* minor_status */,
406		      gss_cred_id_t /* cred */,
407		      const char * /* label */,
408		      gss_buffer_t /* value */);
409
410typedef OM_uint32 GSSAPI_CALLCONV _gss_display_name_ext_t (
411	       OM_uint32 *,            /* minor_status */
412	       gss_name_t,             /* name */
413	       gss_OID,                /* display_as_name_type */
414	       gss_buffer_t            /* display_name */
415	      );
416
417typedef OM_uint32 GSSAPI_CALLCONV _gss_inquire_name_t (
418	       OM_uint32 *,            /* minor_status */
419	       gss_name_t,             /* name */
420	       int *,                  /* name_is_MN */
421	       gss_OID *,              /* MN_mech */
422	       gss_buffer_set_t *      /* attrs */
423	      );
424
425typedef OM_uint32 GSSAPI_CALLCONV _gss_get_name_attribute_t (
426	       OM_uint32 *,	      /* minor_status */
427	       gss_name_t,            /* name */
428	       gss_buffer_t,          /* attr */
429	       int *,                 /* authenticated */
430	       int *,                 /* complete */
431	       gss_buffer_t,          /* value */
432	       gss_buffer_t,          /* display_value */
433	       int *                  /* more */
434	    );
435
436typedef OM_uint32 GSSAPI_CALLCONV _gss_set_name_attribute_t (
437	       OM_uint32 *,           /* minor_status */
438	       gss_name_t,            /* name */
439	       int,                   /* complete */
440	       gss_buffer_t,          /* attr */
441	       gss_buffer_t           /* value */
442	    );
443
444typedef OM_uint32 GSSAPI_CALLCONV _gss_delete_name_attribute_t (
445	       OM_uint32 *,           /* minor_status */
446	       gss_name_t,            /* name */
447	       gss_buffer_t           /* attr */
448	    );
449
450typedef OM_uint32 GSSAPI_CALLCONV _gss_export_name_composite_t (
451	       OM_uint32 *,           /* minor_status */
452	       gss_name_t,            /* name */
453	       gss_buffer_t           /* exp_composite_name */
454	    );
455
456typedef OM_uint32 GSSAPI_CALLCONV _gss_aapl_change_password_t(
457		OM_uint32 *,	      /* minor_status */
458		gss_name_t,	      /* name */
459		const char *,	      /* oldpw */
460		const char *	      /* newpw */
461	    );
462
463/*
464 *
465 */
466
467typedef struct gss_mo_desc gss_mo_desc;
468
469typedef OM_uint32 GSSAPI_CALLCONV
470_gss_mo_init (OM_uint32 *, gss_OID, gss_mo_desc **, size_t *);
471
472
473struct gss_mo_desc {
474    gss_OID option;
475    OM_uint32 flags;
476#define GSS_MO_MA		1
477#define GSS_MO_MA_CRITICAL	2
478    const char *name;
479    void *ctx;
480    int (*get)(gss_const_OID, gss_mo_desc *, gss_buffer_t);
481    int (*set)(gss_const_OID, gss_mo_desc *, int, gss_buffer_t);
482};
483
484typedef OM_uint32 GSSAPI_CALLCONV _gss_pname_to_uid_t (
485	       OM_uint32 *,		/* minor_status */
486	       const gss_name_t,	/* name */
487	       const gss_OID,		/* mech_type */
488	       uid_t *			/* uidOut */
489	      );
490
491typedef OM_uint32 GSSAPI_CALLCONV _gss_authorize_localname_t (
492	       OM_uint32 *,		/* minor_status */
493	       const gss_name_t,	/* name */
494	       gss_const_buffer_t,	/* user */
495	       gss_const_OID		/* user_name_type */
496	      );
497
498/* mechglue internal */
499struct gss_mech_compat_desc_struct;
500
501#define GMI_VERSION 5
502
503/* gm_flags */
504#define GM_USE_MG_CRED      	1	/* uses mech glue credentials */
505
506typedef struct gssapi_mech_interface_desc {
507	unsigned			gm_version;
508	const char			*gm_name;
509	gss_OID_desc			gm_mech_oid;
510        unsigned			gm_flags;
511	_gss_acquire_cred_t		*gm_acquire_cred;
512	_gss_release_cred_t		*gm_release_cred;
513	_gss_init_sec_context_t		*gm_init_sec_context;
514	_gss_accept_sec_context_t	*gm_accept_sec_context;
515	_gss_process_context_token_t	*gm_process_context_token;
516	_gss_delete_sec_context_t	*gm_delete_sec_context;
517	_gss_context_time_t		*gm_context_time;
518	_gss_get_mic_t			*gm_get_mic;
519	_gss_verify_mic_t		*gm_verify_mic;
520	_gss_wrap_t			*gm_wrap;
521	_gss_unwrap_t			*gm_unwrap;
522	_gss_display_status_t		*gm_display_status;
523	_gss_indicate_mechs_t		*gm_indicate_mechs;
524	_gss_compare_name_t		*gm_compare_name;
525	_gss_display_name_t		*gm_display_name;
526	_gss_import_name_t		*gm_import_name;
527	_gss_export_name_t		*gm_export_name;
528	_gss_release_name_t		*gm_release_name;
529	_gss_inquire_cred_t		*gm_inquire_cred;
530	_gss_inquire_context_t		*gm_inquire_context;
531	_gss_wrap_size_limit_t		*gm_wrap_size_limit;
532	_gss_add_cred_t			*gm_add_cred;
533	_gss_inquire_cred_by_mech_t	*gm_inquire_cred_by_mech;
534	_gss_export_sec_context_t	*gm_export_sec_context;
535	_gss_import_sec_context_t	*gm_import_sec_context;
536	_gss_inquire_names_for_mech_t	*gm_inquire_names_for_mech;
537	_gss_inquire_mechs_for_name_t	*gm_inquire_mechs_for_name;
538	_gss_canonicalize_name_t	*gm_canonicalize_name;
539	_gss_duplicate_name_t		*gm_duplicate_name;
540	_gss_inquire_sec_context_by_oid	*gm_inquire_sec_context_by_oid;
541	_gss_inquire_cred_by_oid	*gm_inquire_cred_by_oid;
542	_gss_set_sec_context_option	*gm_set_sec_context_option;
543	_gss_set_cred_option		*gm_set_cred_option;
544	_gss_pseudo_random		*gm_pseudo_random;
545	_gss_wrap_iov_t			*gm_wrap_iov;
546	_gss_unwrap_iov_t		*gm_unwrap_iov;
547	_gss_wrap_iov_length_t		*gm_wrap_iov_length;
548	_gss_store_cred_t		*gm_store_cred;
549	_gss_export_cred_t		*gm_export_cred;
550	_gss_import_cred_t		*gm_import_cred;
551	_gss_acquire_cred_ext_t		*gm_acquire_cred_ext;
552	_gss_iter_creds_t		*gm_iter_creds;
553	_gss_destroy_cred_t		*gm_destroy_cred;
554	_gss_cred_hold_t		*gm_cred_hold;
555	_gss_cred_unhold_t		*gm_cred_unhold;
556	_gss_cred_label_get_t		*gm_cred_label_get;
557	_gss_cred_label_set_t		*gm_cred_label_set;
558        gss_mo_desc			*gm_mo;
559        size_t				 gm_mo_num;
560        _gss_pname_to_uid_t             *gm_pname_to_uid;
561        _gss_authorize_localname_t      *gm_authorize_localname;
562        _gss_display_name_ext_t         *gm_display_name_ext;
563        _gss_inquire_name_t             *gm_inquire_name;
564        _gss_get_name_attribute_t       *gm_get_name_attribute;
565        _gss_set_name_attribute_t       *gm_set_name_attribute;
566        _gss_delete_name_attribute_t    *gm_delete_name_attribute;
567        _gss_export_name_composite_t    *gm_export_name_composite;
568        struct gss_mech_compat_desc_struct  *gm_compat;
569	_gss_aapl_change_password_t	*gm_aapl_change_password;
570} gssapi_mech_interface_desc, *gssapi_mech_interface;
571
572gssapi_mech_interface
573__gss_get_mechanism(gss_const_OID /* oid */);
574
575gssapi_mech_interface __gss_spnego_initialize(void);
576gssapi_mech_interface __gss_krb5_initialize(void);
577gssapi_mech_interface __gss_pku2u_initialize(void);
578gssapi_mech_interface __gss_iakerb_initialize(void);
579gssapi_mech_interface __gss_ntlm_initialize(void);
580gssapi_mech_interface __gss_scram_initialize(void);
581gssapi_mech_interface __gss_netlogon_initialize(void);
582
583void		gss_mg_collect_error(gss_OID, OM_uint32, OM_uint32);
584OM_uint32	gss_mg_export_name(OM_uint32 *, gss_const_OID,
585				   const void *, size_t, gss_buffer_t);
586OM_uint32	gss_mg_set_error_string(gss_OID mech, OM_uint32 maj, OM_uint32 min, const char *fmt, ...)
587    HEIMDAL_PRINTF_ATTRIBUTE((printf, 4, 5));
588
589int		_gss_mg_log_level(int);
590void		_gss_mg_log(int, const char *, ...)
591    HEIMDAL_PRINTF_ATTRIBUTE((printf, 2, 3));
592void		_gss_mg_log_name(int, struct _gss_name *, gss_OID, const char *, ...)
593    HEIMDAL_PRINTF_ATTRIBUTE((printf, 4, 5));
594void		_gss_mg_log_cred(int level, struct _gss_cred *name, const char *fmt, ...)
595    HEIMDAL_PRINTF_ATTRIBUTE((printf, 3, 4));
596
597
598
599struct _gss_name_type {
600    gss_OID	gnt_name_type;
601    OM_uint32	(*gnt_parse)(OM_uint32 *, gss_const_OID, const gss_buffer_t,
602			     gss_const_OID, gss_name_t *);
603};
604
605
606OM_uint32
607_gss_mech_import_name(OM_uint32 *, gss_const_OID,
608    struct _gss_name_type *, const gss_buffer_t, gss_const_OID, gss_name_t *);
609
610OM_uint32
611_gss_mech_inquire_names_for_mech(OM_uint32 *,
612    struct _gss_name_type *, gss_OID_set *);
613
614gss_iov_buffer_desc *
615_gss_mg_find_buffer(gss_iov_buffer_desc *, int, OM_uint32);
616
617OM_uint32
618_gss_mg_allocate_buffer(OM_uint32 *, gss_iov_buffer_desc *, size_t);
619
620OM_uint32
621gss_mg_validate_cb(OM_uint32 *, const gss_channel_bindings_t,
622		   const uint8_t [16], gss_buffer_t);
623
624OM_uint32 gss_mg_gen_cb(OM_uint32 *, const gss_channel_bindings_t,
625			uint8_t [16], gss_buffer_t);
626
627gss_OID
628_gss_mg_support_mechanism(gss_const_OID mech);
629
630struct _gss_oid_name_table {
631    gss_OID oid;
632    const char *name;
633    const char *short_desc;
634    const char *long_desc;
635};
636
637extern struct _gss_oid_name_table _gss_ont_mech[];
638extern struct _gss_oid_name_table _gss_ont_ma[];
639
640/*
641 * Extended credentials acqusition API, not to be exported until
642 * it or something equivalent has been standardised.
643 */
644extern gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_cred_password_oid_desc;
645#define GSS_C_CRED_PASSWORD (&__gss_c_cred_password_oid_desc)
646
647extern gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_cred_certificate_oid_desc;
648#define GSS_C_CRED_CERTIFICATE (&__gss_c_cred_certificate_oid_desc)
649
650#ifdef __APPLE__
651#include <CoreFoundation/CoreFoundation.h>
652
653CFTypeRef
654_gss_mg_copy_key(CFStringRef domain, CFStringRef key);
655
656CFErrorRef
657_gss_mg_cferror(OM_uint32 major,
658		OM_uint32 minor,
659		gss_const_OID mech);
660
661#endif /* __APPLE__ */
662
663#endif /* GSSAPI_MECH_H */
664