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