Add IAKERB mechanism and gss_acquire_cred_with_password
[krb5.git] / src / lib / gssapi / mechglue / mglueP.h
1 /* #ident  "@(#)mglueP.h 1.2     96/01/18 SMI" */
2
3 /*
4  * This header contains the private mechglue definitions.
5  *
6  * Copyright (c) 1995, by Sun Microsystems, Inc.
7  * All rights reserved.
8  */
9
10 #ifndef _GSS_MECHGLUEP_H
11 #define _GSS_MECHGLUEP_H
12
13 #include "autoconf.h"
14 #include "mechglue.h"
15 #include "gssapiP_generic.h"
16
17 #define g_OID_copy(o1, o2)                                      \
18 do {                                                            \
19         memcpy((o1)->elements, (o2)->elements, (o2)->length);   \
20         (o1)->length = (o2)->length;                            \
21 } while (0)
22
23 /*
24  * Array of context IDs typed by mechanism OID
25  */
26 typedef struct gss_ctx_id_struct {
27         struct gss_ctx_id_struct *loopback;
28         gss_OID                 mech_type;
29         gss_ctx_id_t            internal_ctx_id;
30 } gss_union_ctx_id_desc, *gss_union_ctx_id_t;
31
32 /*
33  * Generic GSSAPI names.  A name can either be a generic name, or a
34  * mechanism specific name....
35  */
36 typedef struct gss_name_struct {
37         struct gss_name_struct *loopback;
38         gss_OID                 name_type;
39         gss_buffer_t            external_name;
40         /*
41          * These last two fields are only filled in for mechanism
42          * names.
43          */
44         gss_OID                 mech_type;
45         gss_name_t              mech_name;
46 } gss_union_name_desc, *gss_union_name_t;
47
48 /*
49  * Structure for holding list of mechanism-specific name types
50  */
51 typedef struct gss_mech_spec_name_t {
52     gss_OID     name_type;
53     gss_OID     mech;
54     struct gss_mech_spec_name_t *next, *prev;
55 } gss_mech_spec_name_desc, *gss_mech_spec_name;
56
57 /*
58  * Credential auxiliary info, used in the credential structure
59  */
60 typedef struct gss_union_cred_auxinfo {
61         gss_buffer_desc         name;
62         gss_OID                 name_type;
63         OM_uint32               creation_time;
64         OM_uint32               time_rec;
65         int                     cred_usage;
66 } gss_union_cred_auxinfo;
67
68 /*
69  * Set of Credentials typed on mechanism OID
70  */
71 typedef struct gss_cred_id_struct {
72         struct gss_cred_id_struct *loopback;
73         int                     count;
74         gss_OID                 mechs_array;
75         gss_cred_id_t           *cred_array;
76         gss_union_cred_auxinfo  auxinfo;
77 } gss_union_cred_desc, *gss_union_cred_t;
78
79 typedef OM_uint32           (*gss_acquire_cred_with_password_sfct)(
80                     OM_uint32 *,        /* minor_status */
81                     const gss_name_t,   /* desired_name */
82                     const gss_buffer_t, /* password */
83                     OM_uint32,          /* time_req */
84                     const gss_OID_set,  /* desired_mechs */
85                     int,                /* cred_usage */
86                     gss_cred_id_t *,    /* output_cred_handle */
87                     gss_OID_set *,      /* actual_mechs */
88                     OM_uint32 *         /* time_rec */
89         /* */);
90
91 /*
92  * Rudimentary pointer validation macro to check whether the
93  * "loopback" field of an opaque struct points back to itself.  This
94  * field also catches some programming errors where an opaque pointer
95  * is passed to a function expecting the address of the opaque
96  * pointer.
97  */
98 #define GSSINT_CHK_LOOP(p) (!((p) != NULL && (p)->loopback == (p)))
99
100 /********************************************************/
101 /* The Mechanism Dispatch Table -- a mechanism needs to */
102 /* define one of these and provide a function to return */
103 /* it to initialize the GSSAPI library            */
104 int gssint_mechglue_initialize_library(void);
105
106 OM_uint32 gssint_get_mech_type_oid(gss_OID OID, gss_buffer_t token);
107
108 /*
109  * This is the definition of the mechs_array struct, which is used to
110  * define the mechs array table. This table is used to indirectly
111  * access mechanism specific versions of the gssapi routines through
112  * the routines in the glue module (gssd_mech_glue.c)
113  *
114  * This contants all of the functions defined in gssapi.h except for
115  * gss_release_buffer() and gss_release_oid_set(), which I am
116  * assuming, for now, to be equal across mechanisms.
117  */
118
119 typedef struct gss_config {
120     gss_OID_desc    mech_type;
121     void *          context;
122     OM_uint32       (*gss_acquire_cred)
123         (
124                     OM_uint32*,         /* minor_status */
125                     gss_name_t,         /* desired_name */
126                     OM_uint32,          /* time_req */
127                     gss_OID_set,        /* desired_mechs */
128                     int,                /* cred_usage */
129                     gss_cred_id_t*,     /* output_cred_handle */
130                     gss_OID_set*,       /* actual_mechs */
131                     OM_uint32*          /* time_rec */
132                     );
133     OM_uint32       (*gss_release_cred)
134         (
135                     OM_uint32*,         /* minor_status */
136                     gss_cred_id_t*      /* cred_handle */
137                     );
138     OM_uint32       (*gss_init_sec_context)
139         (
140                     OM_uint32*,                 /* minor_status */
141                     gss_cred_id_t,              /* claimant_cred_handle */
142                     gss_ctx_id_t*,              /* context_handle */
143                     gss_name_t,                 /* target_name */
144                     gss_OID,                    /* mech_type */
145                     OM_uint32,                  /* req_flags */
146                     OM_uint32,                  /* time_req */
147                     gss_channel_bindings_t,     /* input_chan_bindings */
148                     gss_buffer_t,               /* input_token */
149                     gss_OID*,                   /* actual_mech_type */
150                     gss_buffer_t,               /* output_token */
151                     OM_uint32*,                 /* ret_flags */
152                     OM_uint32*                  /* time_rec */
153                     );
154     OM_uint32       (*gss_accept_sec_context)
155         (
156                     OM_uint32*,                 /* minor_status */
157                     gss_ctx_id_t*,              /* context_handle */
158                     gss_cred_id_t,              /* verifier_cred_handle */
159                     gss_buffer_t,               /* input_token_buffer */
160                     gss_channel_bindings_t,     /* input_chan_bindings */
161                     gss_name_t*,                /* src_name */
162                     gss_OID*,                   /* mech_type */
163                     gss_buffer_t,               /* output_token */
164                     OM_uint32*,                 /* ret_flags */
165                     OM_uint32*,                 /* time_rec */
166                     gss_cred_id_t*              /* delegated_cred_handle */
167                     );
168     OM_uint32       (*gss_process_context_token)
169         (
170                     OM_uint32*,         /* minor_status */
171                     gss_ctx_id_t,       /* context_handle */
172                     gss_buffer_t        /* token_buffer */
173                     );
174     OM_uint32       (*gss_delete_sec_context)
175         (
176                     OM_uint32*,         /* minor_status */
177                     gss_ctx_id_t*,      /* context_handle */
178                     gss_buffer_t        /* output_token */
179                     );
180     OM_uint32       (*gss_context_time)
181         (
182                     OM_uint32*,         /* minor_status */
183                     gss_ctx_id_t,       /* context_handle */
184                     OM_uint32*          /* time_rec */
185                     );
186     OM_uint32       (*gss_get_mic)
187         (
188                     OM_uint32*,         /* minor_status */
189                     gss_ctx_id_t,       /* context_handle */
190                     gss_qop_t,          /* qop_req */
191                     gss_buffer_t,       /* message_buffer */
192                     gss_buffer_t        /* message_token */
193                     );
194     OM_uint32       (*gss_verify_mic)
195         (
196                     OM_uint32*,         /* minor_status */
197                     gss_ctx_id_t,       /* context_handle */
198                     gss_buffer_t,       /* message_buffer */
199                     gss_buffer_t,       /* token_buffer */
200                     gss_qop_t*          /* qop_state */
201                     );
202     OM_uint32       (*gss_wrap)
203         (
204                     OM_uint32*,         /* minor_status */
205                     gss_ctx_id_t,       /* context_handle */
206                     int,                /* conf_req_flag */
207                     gss_qop_t,          /* qop_req */
208                     gss_buffer_t,       /* input_message_buffer */
209                     int*,               /* conf_state */
210                     gss_buffer_t        /* output_message_buffer */
211                     );
212     OM_uint32       (*gss_unwrap)
213         (
214                     OM_uint32*,         /* minor_status */
215                     gss_ctx_id_t,       /* context_handle */
216                     gss_buffer_t,       /* input_message_buffer */
217                     gss_buffer_t,       /* output_message_buffer */
218                     int*,               /* conf_state */
219                     gss_qop_t*          /* qop_state */
220                     );
221     OM_uint32       (*gss_display_status)
222         (
223                     OM_uint32*,         /* minor_status */
224                     OM_uint32,          /* status_value */
225                     int,                /* status_type */
226                     gss_OID,            /* mech_type */
227                     OM_uint32*,         /* message_context */
228                     gss_buffer_t        /* status_string */
229                     );
230     OM_uint32       (*gss_indicate_mechs)
231         (
232                     OM_uint32*,         /* minor_status */
233                     gss_OID_set*        /* mech_set */
234                     );
235     OM_uint32       (*gss_compare_name)
236         (
237                     OM_uint32*,         /* minor_status */
238                     gss_name_t,         /* name1 */
239                     gss_name_t,         /* name2 */
240                     int*                /* name_equal */
241                     );
242     OM_uint32       (*gss_display_name)
243         (
244                     OM_uint32*,         /* minor_status */
245                     gss_name_t,         /* input_name */
246                     gss_buffer_t,       /* output_name_buffer */
247                     gss_OID*            /* output_name_type */
248                     );
249     OM_uint32       (*gss_import_name)
250         (
251                     OM_uint32*,         /* minor_status */
252                     gss_buffer_t,       /* input_name_buffer */
253                     gss_OID,            /* input_name_type */
254                     gss_name_t*         /* output_name */
255                     );
256     OM_uint32       (*gss_release_name)
257         (
258                     OM_uint32*,         /* minor_status */
259                     gss_name_t*         /* input_name */
260                     );
261     OM_uint32       (*gss_inquire_cred)
262         (
263                     OM_uint32 *,                /* minor_status */
264                     gss_cred_id_t,              /* cred_handle */
265                     gss_name_t *,               /* name */
266                     OM_uint32 *,                /* lifetime */
267                     int *,                      /* cred_usage */
268                     gss_OID_set *               /* mechanisms */
269                     );
270     OM_uint32       (*gss_add_cred)
271         (
272                     OM_uint32 *,        /* minor_status */
273                     gss_cred_id_t,      /* input_cred_handle */
274                     gss_name_t,         /* desired_name */
275                     gss_OID,            /* desired_mech */
276                     gss_cred_usage_t,   /* cred_usage */
277                     OM_uint32,          /* initiator_time_req */
278                     OM_uint32,          /* acceptor_time_req */
279                     gss_cred_id_t *,    /* output_cred_handle */
280                     gss_OID_set *,      /* actual_mechs */
281                     OM_uint32 *,        /* initiator_time_rec */
282                     OM_uint32 *         /* acceptor_time_rec */
283                     );
284     OM_uint32       (*gss_export_sec_context)
285         (
286                     OM_uint32 *,        /* minor_status */
287                     gss_ctx_id_t *,     /* context_handle */
288                     gss_buffer_t        /* interprocess_token */
289                     );
290     OM_uint32       (*gss_import_sec_context)
291         (
292                     OM_uint32 *,        /* minor_status */
293                     gss_buffer_t,       /* interprocess_token */
294                     gss_ctx_id_t *      /* context_handle */
295                     );
296     OM_uint32       (*gss_inquire_cred_by_mech)
297         (
298                     OM_uint32 *,        /* minor_status */
299                     gss_cred_id_t,      /* cred_handle */
300                     gss_OID,            /* mech_type */
301                     gss_name_t *,       /* name */
302                     OM_uint32 *,        /* initiator_lifetime */
303                     OM_uint32 *,        /* acceptor_lifetime */
304                     gss_cred_usage_t *  /* cred_usage */
305                     );
306     OM_uint32       (*gss_inquire_names_for_mech)
307         (
308                     OM_uint32 *,        /* minor_status */
309                     gss_OID,            /* mechanism */
310                     gss_OID_set *       /* name_types */
311                     );
312     OM_uint32   (*gss_inquire_context)
313         (
314                     OM_uint32 *,        /* minor_status */
315                     gss_ctx_id_t,       /* context_handle */
316                     gss_name_t *,       /* src_name */
317                     gss_name_t *,       /* targ_name */
318                     OM_uint32 *,        /* lifetime_rec */
319                     gss_OID *,          /* mech_type */
320                     OM_uint32 *,        /* ctx_flags */
321                     int *,              /* locally_initiated */
322                     int *               /* open */
323                     );
324     OM_uint32       (*gss_internal_release_oid)
325         (
326                     OM_uint32 *,        /* minor_status */
327                     gss_OID *           /* OID */
328          );
329     OM_uint32        (*gss_wrap_size_limit)
330         (
331                     OM_uint32 *,        /* minor_status */
332                     gss_ctx_id_t,       /* context_handle */
333                     int,                /* conf_req_flag */
334                     gss_qop_t,          /* qop_req */
335                     OM_uint32,          /* req_output_size */
336                     OM_uint32 *         /* max_input_size */
337          );
338 #if 0
339     int              (*pname_to_uid)
340         (
341                     char *,             /* pname */
342                     gss_OID,            /* name type */
343                     gss_OID,            /* mech type */
344                     uid_t *             /* uid */
345                     );
346         OM_uint32               (*gssint_userok)
347         (
348                     OM_uint32 *,        /* minor_status */
349                     const gss_name_t,   /* pname */
350                     const char *,       /* local user */
351                     int *               /* user ok? */
352         /* */);
353 #endif
354         OM_uint32               (*gss_export_name)
355         (
356                 OM_uint32 *,            /* minor_status */
357                 const gss_name_t,       /* input_name */
358                 gss_buffer_t            /* exported_name */
359         /* */);
360         OM_uint32       (*gss_store_cred)
361         (
362                 OM_uint32 *,            /* minor_status */
363                 const gss_cred_id_t,    /* input_cred */
364                 gss_cred_usage_t,       /* cred_usage */
365                 const gss_OID,          /* desired_mech */
366                 OM_uint32,              /* overwrite_cred */
367                 OM_uint32,              /* default_cred */
368                 gss_OID_set *,          /* elements_stored */
369                 gss_cred_usage_t *      /* cred_usage_stored */
370         /* */);
371
372
373         /* GGF extensions */
374
375         OM_uint32       (*gss_inquire_sec_context_by_oid)
376         (
377                     OM_uint32 *,        /* minor_status */
378                     const gss_ctx_id_t, /* context_handle */
379                     const gss_OID,      /* OID */
380                     gss_buffer_set_t *  /* data_set */
381                     );
382         OM_uint32       (*gss_inquire_cred_by_oid)
383         (
384                     OM_uint32 *,        /* minor_status */
385                     const gss_cred_id_t, /* cred_handle */
386                     const gss_OID,      /* OID */
387                     gss_buffer_set_t *  /* data_set */
388                     );
389         OM_uint32       (*gss_set_sec_context_option)
390         (
391                     OM_uint32 *,        /* minor_status */
392                     gss_ctx_id_t *,     /* context_handle */
393                     const gss_OID,      /* OID */
394                     const gss_buffer_t  /* value */
395                     );
396         OM_uint32       (*gssspi_set_cred_option)
397         (
398                     OM_uint32 *,        /* minor_status */
399                     gss_cred_id_t,      /* cred_handle */
400                     const gss_OID,      /* OID */
401                     const gss_buffer_t  /* value */
402                     );
403         OM_uint32       (*gssspi_mech_invoke)
404         (
405                     OM_uint32*,         /* minor_status */
406                     const gss_OID,      /* mech OID */
407                     const gss_OID,      /* OID */
408                     gss_buffer_t        /* value */
409                     );
410
411         /* AEAD extensions */
412         OM_uint32       (*gss_wrap_aead)
413         (
414             OM_uint32 *,                /* minor_status */
415             gss_ctx_id_t,               /* context_handle */
416             int,                        /* conf_req_flag */
417             gss_qop_t,                  /* qop_req */
418             gss_buffer_t,               /* input_assoc_buffer */
419             gss_buffer_t,               /* input_payload_buffer */
420             int *,                      /* conf_state */
421             gss_buffer_t                /* output_message_buffer */
422         /* */);
423
424         OM_uint32       (*gss_unwrap_aead)
425         (
426             OM_uint32 *,                /* minor_status */
427             gss_ctx_id_t,               /* context_handle */
428             gss_buffer_t,               /* input_message_buffer */
429             gss_buffer_t,               /* input_assoc_buffer */
430             gss_buffer_t,               /* output_payload_buffer */
431             int *,                      /* conf_state */
432             gss_qop_t *                 /* qop_state */
433         /* */);
434
435         /* SSPI extensions */
436         OM_uint32       (*gss_wrap_iov)
437         (
438             OM_uint32 *,                /* minor_status */
439             gss_ctx_id_t,               /* context_handle */
440             int,                        /* conf_req_flag */
441             gss_qop_t,                  /* qop_req */
442             int *,                      /* conf_state */
443             gss_iov_buffer_desc *,      /* iov */
444             int                         /* iov_count */
445         /* */);
446
447         OM_uint32       (*gss_unwrap_iov)
448         (
449             OM_uint32 *,                /* minor_status */
450             gss_ctx_id_t,               /* context_handle */
451             int *,                      /* conf_state */
452             gss_qop_t *,                /* qop_state */
453             gss_iov_buffer_desc *,      /* iov */
454             int                         /* iov_count */
455         /* */);
456
457         OM_uint32       (*gss_wrap_iov_length)
458         (
459             OM_uint32 *,                /* minor_status */
460             gss_ctx_id_t,               /* context_handle */
461             int,                        /* conf_req_flag*/
462             gss_qop_t,                  /* qop_req */
463             int *,                      /* conf_state */
464             gss_iov_buffer_desc *,      /* iov */
465             int                         /* iov_count */
466         /* */);
467
468         OM_uint32       (*gss_complete_auth_token)
469         (
470                     OM_uint32*,         /* minor_status */
471                     const gss_ctx_id_t, /* context_handle */
472                     gss_buffer_t        /* input_message_buffer */
473                     );
474
475         /* New for 1.8 */
476
477         OM_uint32       (*gss_acquire_cred_impersonate_name)
478         (
479             OM_uint32 *,                /* minor_status */
480             const gss_cred_id_t,        /* impersonator_cred_handle */
481             const gss_name_t,           /* desired_name */
482             OM_uint32,                  /* time_req */
483             const gss_OID_set,          /* desired_mechs */
484             gss_cred_usage_t,           /* cred_usage */
485             gss_cred_id_t *,            /* output_cred_handle */
486             gss_OID_set *,              /* actual_mechs */
487             OM_uint32 *                 /* time_rec */
488         /* */);
489
490         OM_uint32       (*gss_add_cred_impersonate_name)
491         (
492             OM_uint32 *,                /* minor_status */
493             gss_cred_id_t,              /* input_cred_handle */
494             const gss_cred_id_t,        /* impersonator_cred_handle */
495             const gss_name_t,           /* desired_name */
496             const gss_OID,              /* desired_mech */
497             gss_cred_usage_t,           /* cred_usage */
498             OM_uint32,                  /* initiator_time_req */
499             OM_uint32,                  /* acceptor_time_req */
500             gss_cred_id_t *,            /* output_cred_handle */
501             gss_OID_set *,              /* actual_mechs */
502             OM_uint32 *,                /* initiator_time_rec */
503             OM_uint32 *                 /* acceptor_time_rec */
504         /* */);
505
506         OM_uint32       (*gss_display_name_ext)
507         (
508             OM_uint32 *,                /* minor_status */
509             gss_name_t,                 /* name */
510             gss_OID,                    /* display_as_name_type */
511             gss_buffer_t                /* display_name */
512         /* */);
513
514         OM_uint32       (*gss_inquire_name)
515         (
516             OM_uint32 *,                /* minor_status */
517             gss_name_t,                 /* name */
518             int *,                      /* name_is_MN */
519             gss_OID *,                  /* MN_mech */
520             gss_buffer_set_t *          /* attrs */
521         /* */);
522
523         OM_uint32       (*gss_get_name_attribute)
524         (
525             OM_uint32 *,                /* minor_status */
526             gss_name_t,                 /* name */
527             gss_buffer_t,               /* attr */
528             int *,                      /* authenticated */
529             int *,                      /* complete */
530             gss_buffer_t,               /* value */
531             gss_buffer_t,               /* display_value */
532             int *                       /* more */
533         /* */);
534
535         OM_uint32       (*gss_set_name_attribute)
536         (
537             OM_uint32 *,                /* minor_status */
538             gss_name_t,                 /* name */
539             int,                        /* complete */
540             gss_buffer_t,               /* attr */
541             gss_buffer_t                /* value */
542         /* */);
543
544         OM_uint32       (*gss_delete_name_attribute)
545         (
546             OM_uint32 *,                /* minor_status */
547             gss_name_t,                 /* name */
548             gss_buffer_t                /* attr */
549         /* */);
550
551         OM_uint32       (*gss_export_name_composite)
552         (
553             OM_uint32 *,                /* minor_status */
554             gss_name_t,                 /* name */
555             gss_buffer_t                /* exp_composite_name */
556         /* */);
557
558         OM_uint32       (*gss_map_name_to_any)
559         (
560             OM_uint32 *,                /* minor_status */
561             gss_name_t,                 /* name */
562             int,                        /* authenticated */
563             gss_buffer_t,               /* type_id */
564             gss_any_t *                 /* output */
565         /* */);
566
567         OM_uint32       (*gss_release_any_name_mapping)
568         (
569             OM_uint32 *,                /* minor_status */
570             gss_name_t,                 /* name */
571             gss_buffer_t,               /* type_id */
572             gss_any_t *                 /* input */
573         /* */);
574
575         OM_uint32       (*gss_pseudo_random)
576         (
577             OM_uint32 *,                /* minor_status */
578             gss_ctx_id_t,               /* context */
579             int,                        /* prf_key */
580             const gss_buffer_t,         /* prf_in */
581             ssize_t,                    /* desired_output_len */
582             gss_buffer_t                /* prf_out */
583         /* */);
584
585         OM_uint32       (*gss_set_neg_mechs)
586         (
587             OM_uint32 *,                /* minor_status */
588             gss_cred_id_t,              /* cred_handle */
589             const gss_OID_set           /* mech_set */
590         /* */);
591 } *gss_mechanism;
592
593 /* This structure MUST NOT be used by any code outside libgss */
594 typedef struct gss_config_ext {
595     gss_acquire_cred_with_password_sfct gssspi_acquire_cred_with_password;
596 } *gss_mechanism_ext;
597
598 /*
599  * In the user space we use a wrapper structure to encompass the
600  * mechanism entry points.  The wrapper contain the mechanism
601  * entry points and other data which is only relevant to the gss-api
602  * layer.  In the kernel we use only the gss_config strucutre because
603  * the kernal does not cantain any of the extra gss-api specific data.
604  */
605 typedef struct gss_mech_config {
606         char *kmodName;                 /* kernel module name */
607         char *uLibName;                 /* user library name */
608         char *mechNameStr;              /* mechanism string name */
609         char *optionStr;                /* optional mech parameters */
610         void *dl_handle;                /* RTLD object handle for the mech */
611         gss_OID mech_type;              /* mechanism oid */
612         gss_mechanism mech;             /* mechanism initialization struct */
613         gss_mechanism_ext mech_ext;     /* extensions */
614         int priority;                   /* mechanism preference order */
615         int freeMech;                   /* free mech table */
616         struct gss_mech_config *next;   /* next element in the list */
617 } *gss_mech_info;
618
619 /********************************************************/
620 /* Internal mechglue routines */
621
622 #if 0
623 int gssint_mechglue_init(void);
624 void gssint_mechglue_fini(void);
625 #endif
626
627 gss_mechanism gssint_get_mechanism (gss_OID);
628 gss_mechanism_ext gssint_get_mechanism_ext(const gss_OID);
629 OM_uint32 gssint_get_mech_type (gss_OID, gss_buffer_t);
630 char *gssint_get_kmodName(const gss_OID);
631 char *gssint_get_modOptions(const gss_OID);
632 OM_uint32 gssint_import_internal_name (OM_uint32 *, gss_OID, gss_union_name_t,
633                                       gss_name_t *);
634 OM_uint32 gssint_export_internal_name(OM_uint32 *, const gss_OID,
635         const gss_name_t, gss_buffer_t);
636 OM_uint32 gssint_display_internal_name (OM_uint32 *, gss_OID, gss_name_t,
637                                        gss_buffer_t, gss_OID *);
638 OM_uint32 gssint_release_internal_name (OM_uint32 *, gss_OID, gss_name_t *);
639 OM_uint32 gssint_delete_internal_sec_context (OM_uint32 *, gss_OID,
640                                               gss_ctx_id_t *, gss_buffer_t);
641 #ifdef _GSS_STATIC_LINK
642 int gssint_register_mechinfo(gss_mech_info template);
643 #endif
644
645 OM_uint32 gssint_convert_name_to_union_name
646           (OM_uint32 *,         /* minor_status */
647            gss_mechanism,       /* mech */
648            gss_name_t,          /* internal_name */
649            gss_name_t *         /* external_name */
650            );
651 gss_cred_id_t gssint_get_mechanism_cred
652           (gss_union_cred_t,    /* union_cred */
653            gss_OID              /* mech_type */
654            );
655
656 OM_uint32 gssint_create_copy_buffer(
657         const gss_buffer_t,     /* src buffer */
658         gss_buffer_t *,         /* destination buffer */
659         int                     /* NULL terminate buffer ? */
660 );
661
662 OM_uint32 gssint_copy_oid_set(
663         OM_uint32 *,                    /* minor_status */
664         const gss_OID_set_desc * const, /* oid set */
665         gss_OID_set *                   /* new oid set */
666 );
667
668 gss_OID gss_find_mechanism_from_name_type (gss_OID); /* name_type */
669
670 OM_uint32 gss_add_mech_name_type
671            (OM_uint32 *,        /* minor_status */
672             gss_OID,            /* name_type */
673             gss_OID             /* mech */
674                );
675
676 /*
677  * Sun extensions to GSS-API v2
678  */
679
680 OM_uint32
681 gssint_mech_to_oid(
682         const char *mech,               /* mechanism string name */
683         gss_OID *oid                    /* mechanism oid */
684 );
685
686 const char *
687 gssint_oid_to_mech(
688         const gss_OID oid               /* mechanism oid */
689 );
690
691 OM_uint32
692 gssint_get_mechanisms(
693         char *mechArray[],              /* array to populate with mechs */
694         int arrayLen                    /* length of passed in array */
695 );
696
697 OM_uint32
698 gssint_userok(
699         OM_uint32 *,            /* minor */
700         const gss_name_t,       /* name */
701         const char *,           /* user */
702         int *                   /* user_ok */
703 );
704
705 OM_uint32
706 gss_store_cred(
707         OM_uint32 *,            /* minor_status */
708         const gss_cred_id_t,    /* input_cred_handle */
709         gss_cred_usage_t,       /* cred_usage */
710         const gss_OID,          /* desired_mech */
711         OM_uint32,              /* overwrite_cred */
712         OM_uint32,              /* default_cred */
713         gss_OID_set *,          /* elements_stored */
714         gss_cred_usage_t *      /* cred_usage_stored */
715 );
716
717 int
718 gssint_get_der_length(
719         unsigned char **,       /* buf */
720         unsigned int,           /* buf_len */
721         unsigned int *          /* bytes */
722 );
723
724 unsigned int
725 gssint_der_length_size(unsigned int /* len */);
726
727 int
728 gssint_put_der_length(
729         unsigned int,           /* length */
730         unsigned char **,       /* buf */
731         unsigned int            /* max_len */
732 );
733
734 OM_uint32
735 gssint_wrap_aead (gss_mechanism,        /* mech */
736                   OM_uint32 *,          /* minor_status */
737                   gss_union_ctx_id_t,   /* ctx */
738                   int,                  /* conf_req_flag */
739                   gss_qop_t,            /* qop_req_flag */
740                   gss_buffer_t,         /* input_assoc_buffer */
741                   gss_buffer_t,         /* input_payload_buffer */
742                   int *,                /* conf_state */
743                   gss_buffer_t);        /* output_message_buffer */
744 OM_uint32
745 gssint_unwrap_aead (gss_mechanism,      /* mech */
746                     OM_uint32 *,        /* minor_status */
747                     gss_union_ctx_id_t, /* ctx */
748                     gss_buffer_t,       /* input_message_buffer */
749                     gss_buffer_t,       /* input_assoc_buffer */
750                     gss_buffer_t,       /* output_payload_buffer */
751                     int *,              /* conf_state */
752                     gss_qop_t *);       /* qop_state */
753
754
755 /* Use this to map an error code that was returned from a mech
756    operation; the mech will be asked to produce the associated error
757    messages.
758
759    Remember that if the minor status code cannot be returned to the
760    caller (e.g., if it's stuffed in an automatic variable and then
761    ignored), then we don't care about producing a mapping.  */
762 #define map_error(MINORP, MECH) \
763     (*(MINORP) = gssint_mecherrmap_map(*(MINORP), &(MECH)->mech_type))
764 #define map_error_oid(MINORP, MECHOID) \
765     (*(MINORP) = gssint_mecherrmap_map(*(MINORP), (MECHOID)))
766
767 /* Use this to map an errno value or com_err error code being
768    generated within the mechglue code (e.g., by calling generic oid
769    ops).  Any errno or com_err values produced by mech operations
770    should be processed with map_error.  This means they'll be stored
771    separately even if the mech uses com_err, because we can't assume
772    that it will use com_err.  */
773 #define map_errcode(MINORP) \
774     (*(MINORP) = gssint_mecherrmap_map_errcode(*(MINORP)))
775
776 #endif /* _GSS_MECHGLUEP_H */