1 /* #ident "@(#)mglueP.h 1.2 96/01/18 SMI" */
4 * This header contains the private mechglue definitions.
6 * Copyright (c) 1995, by Sun Microsystems, Inc.
10 #ifndef _GSS_MECHGLUEP_H
11 #define _GSS_MECHGLUEP_H
15 #include "gssapiP_generic.h"
17 #define g_OID_copy(o1, o2) \
19 memcpy((o1)->elements, (o2)->elements, (o2)->length); \
20 (o1)->length = (o2)->length; \
23 #define GSS_EMPTY_BUFFER(buf) ((buf) == NULL ||\
24 (buf)->value == NULL || (buf)->length == 0)
27 * Array of context IDs typed by mechanism OID
29 typedef struct gss_union_ctx_id_t {
31 gss_ctx_id_t internal_ctx_id;
32 } gss_union_ctx_id_desc, *gss_union_ctx_id_t;
35 * Generic GSSAPI names. A name can either be a generic name, or a
36 * mechanism specific name....
38 typedef struct gss_union_name_t {
40 gss_buffer_t external_name;
42 * These last two fields are only filled in for mechanism
47 } gss_union_name_desc, *gss_union_name_t;
50 * Structure for holding list of mechanism-specific name types
52 typedef struct gss_mech_spec_name_t {
55 struct gss_mech_spec_name_t *next, *prev;
56 } gss_mech_spec_name_desc, *gss_mech_spec_name;
59 * Credential auxiliary info, used in the credential structure
61 typedef struct gss_union_cred_auxinfo {
64 OM_uint32 creation_time;
67 } gss_union_cred_auxinfo;
70 * Set of Credentials typed on mechanism OID
72 typedef struct gss_union_cred_t {
75 gss_cred_id_t *cred_array;
76 gss_union_cred_auxinfo auxinfo;
77 } gss_union_cred_desc, *gss_union_cred_t;
79 /********************************************************/
80 /* The Mechanism Dispatch Table -- a mechanism needs to */
81 /* define one of these and provide a function to return */
82 /* it to initialize the GSSAPI library */
85 * This is the definition of the mechs_array struct, which is used to
86 * define the mechs array table. This table is used to indirectly
87 * access mechanism specific versions of the gssapi routines through
88 * the routines in the glue module (gssd_mech_glue.c)
90 * This contants all of the functions defined in gssapi.h except for
91 * gss_release_buffer() and gss_release_oid_set(), which I am
92 * assuming, for now, to be equal across mechanisms.
95 typedef struct gss_config {
98 gss_OID_desc mech_type;
100 OM_uint32 (*gss_acquire_cred)
103 OM_uint32*, /* minor_status */
104 gss_name_t, /* desired_name */
105 OM_uint32, /* time_req */
106 gss_OID_set, /* desired_mechs */
107 int, /* cred_usage */
108 gss_cred_id_t*, /* output_cred_handle */
109 gss_OID_set*, /* actual_mechs */
110 OM_uint32* /* time_rec */
112 OM_uint32 (*gss_release_cred)
115 OM_uint32*, /* minor_status */
116 gss_cred_id_t* /* cred_handle */
118 OM_uint32 (*gss_init_sec_context)
121 OM_uint32*, /* minor_status */
122 gss_cred_id_t, /* claimant_cred_handle */
123 gss_ctx_id_t*, /* context_handle */
124 gss_name_t, /* target_name */
125 gss_OID, /* mech_type */
126 OM_uint32, /* req_flags */
127 OM_uint32, /* time_req */
128 gss_channel_bindings_t, /* input_chan_bindings */
129 gss_buffer_t, /* input_token */
130 gss_OID*, /* actual_mech_type */
131 gss_buffer_t, /* output_token */
132 OM_uint32*, /* ret_flags */
133 OM_uint32* /* time_rec */
135 OM_uint32 (*gss_accept_sec_context)
138 OM_uint32*, /* minor_status */
139 gss_ctx_id_t*, /* context_handle */
140 gss_cred_id_t, /* verifier_cred_handle */
141 gss_buffer_t, /* input_token_buffer */
142 gss_channel_bindings_t, /* input_chan_bindings */
143 gss_name_t*, /* src_name */
144 gss_OID*, /* mech_type */
145 gss_buffer_t, /* output_token */
146 OM_uint32*, /* ret_flags */
147 OM_uint32*, /* time_rec */
148 gss_cred_id_t* /* delegated_cred_handle */
150 OM_uint32 (*gss_process_context_token)
153 OM_uint32*, /* minor_status */
154 gss_ctx_id_t, /* context_handle */
155 gss_buffer_t /* token_buffer */
157 OM_uint32 (*gss_delete_sec_context)
160 OM_uint32*, /* minor_status */
161 gss_ctx_id_t*, /* context_handle */
162 gss_buffer_t /* output_token */
164 OM_uint32 (*gss_context_time)
167 OM_uint32*, /* minor_status */
168 gss_ctx_id_t, /* context_handle */
169 OM_uint32* /* time_rec */
171 OM_uint32 (*gss_sign)
174 OM_uint32*, /* minor_status */
175 gss_ctx_id_t, /* context_handle */
177 gss_buffer_t, /* message_buffer */
178 gss_buffer_t /* message_token */
180 OM_uint32 (*gss_verify)
183 OM_uint32*, /* minor_status */
184 gss_ctx_id_t, /* context_handle */
185 gss_buffer_t, /* message_buffer */
186 gss_buffer_t, /* token_buffer */
189 OM_uint32 (*gss_seal)
192 OM_uint32*, /* minor_status */
193 gss_ctx_id_t, /* context_handle */
194 int, /* conf_req_flag */
196 gss_buffer_t, /* input_message_buffer */
197 int*, /* conf_state */
198 gss_buffer_t /* output_message_buffer */
200 OM_uint32 (*gss_unseal)
203 OM_uint32*, /* minor_status */
204 gss_ctx_id_t, /* context_handle */
205 gss_buffer_t, /* input_message_buffer */
206 gss_buffer_t, /* output_message_buffer */
207 int*, /* conf_state */
210 OM_uint32 (*gss_display_status)
213 OM_uint32*, /* minor_status */
214 OM_uint32, /* status_value */
215 int, /* status_type */
216 gss_OID, /* mech_type */
217 OM_uint32*, /* message_context */
218 gss_buffer_t /* status_string */
220 OM_uint32 (*gss_indicate_mechs)
223 OM_uint32*, /* minor_status */
224 gss_OID_set* /* mech_set */
226 OM_uint32 (*gss_compare_name)
229 OM_uint32*, /* minor_status */
230 gss_name_t, /* name1 */
231 gss_name_t, /* name2 */
232 int* /* name_equal */
234 OM_uint32 (*gss_display_name)
237 OM_uint32*, /* minor_status */
238 gss_name_t, /* input_name */
239 gss_buffer_t, /* output_name_buffer */
240 gss_OID* /* output_name_type */
242 OM_uint32 (*gss_import_name)
245 OM_uint32*, /* minor_status */
246 gss_buffer_t, /* input_name_buffer */
247 gss_OID, /* input_name_type */
248 gss_name_t* /* output_name */
250 OM_uint32 (*gss_release_name)
253 OM_uint32*, /* minor_status */
254 gss_name_t* /* input_name */
256 OM_uint32 (*gss_inquire_cred)
259 OM_uint32 *, /* minor_status */
260 gss_cred_id_t, /* cred_handle */
261 gss_name_t *, /* name */
262 OM_uint32 *, /* lifetime */
263 int *, /* cred_usage */
264 gss_OID_set * /* mechanisms */
266 OM_uint32 (*gss_add_cred)
269 OM_uint32 *, /* minor_status */
270 gss_cred_id_t, /* input_cred_handle */
271 gss_name_t, /* desired_name */
272 gss_OID, /* desired_mech */
273 gss_cred_usage_t, /* cred_usage */
274 OM_uint32, /* initiator_time_req */
275 OM_uint32, /* acceptor_time_req */
276 gss_cred_id_t *, /* output_cred_handle */
277 gss_OID_set *, /* actual_mechs */
278 OM_uint32 *, /* initiator_time_rec */
279 OM_uint32 * /* acceptor_time_rec */
281 OM_uint32 (*gss_export_sec_context)
284 OM_uint32 *, /* minor_status */
285 gss_ctx_id_t *, /* context_handle */
286 gss_buffer_t /* interprocess_token */
288 OM_uint32 (*gss_import_sec_context)
290 void *, /* context */
291 OM_uint32 *, /* minor_status */
292 gss_buffer_t, /* interprocess_token */
293 gss_ctx_id_t * /* context_handle */
295 OM_uint32 (*gss_inquire_cred_by_mech)
297 void *, /* context */
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 */
306 OM_uint32 (*gss_inquire_names_for_mech)
308 void *, /* context */
309 OM_uint32 *, /* minor_status */
310 gss_OID, /* mechanism */
311 gss_OID_set * /* name_types */
313 OM_uint32 (*gss_inquire_context)
315 void *, /* context */
316 OM_uint32 *, /* minor_status */
317 gss_ctx_id_t, /* context_handle */
318 gss_name_t *, /* src_name */
319 gss_name_t *, /* targ_name */
320 OM_uint32 *, /* lifetime_rec */
321 gss_OID *, /* mech_type */
322 OM_uint32 *, /* ctx_flags */
323 int *, /* locally_initiated */
326 OM_uint32 (*gss_internal_release_oid)
328 void *, /* context */
329 OM_uint32 *, /* minor_status */
332 OM_uint32 (*gss_wrap_size_limit)
334 void *, /* context */
335 OM_uint32 *, /* minor_status */
336 gss_ctx_id_t, /* context_handle */
337 int, /* conf_req_flag */
338 gss_qop_t, /* qop_req */
339 OM_uint32, /* req_output_size */
340 OM_uint32 * /* max_input_size */
344 void *, /* context */
346 gss_OID, /* name type */
347 gss_OID, /* mech type */
350 OM_uint32 (*gssint_userok)
352 void *, /* context */
353 OM_uint32 *, /* minor_status */
354 const gss_name_t, /* pname */
355 const char *, /* local user */
358 OM_uint32 (*gss_export_name)
360 void *, /* context */
361 OM_uint32 *, /* minor_status */
362 const gss_name_t, /* input_name */
363 gss_buffer_t /* exported_name */
365 OM_uint32 (*gss_store_cred)
367 void *, /* context */
368 OM_uint32 *, /* minor_status */
369 const gss_cred_id_t, /* input_cred */
370 gss_cred_usage_t, /* cred_usage */
371 const gss_OID, /* desired_mech */
372 OM_uint32, /* overwrite_cred */
373 OM_uint32, /* default_cred */
374 gss_OID_set *, /* elements_stored */
375 gss_cred_usage_t * /* cred_usage_stored */
380 * In the user space we use a wrapper structure to encompass the
381 * mechanism entry points. The wrapper contain the mechanism
382 * entry points and other data which is only relevant to the gss-api
383 * layer. In the kernel we use only the gss_config strucutre because
384 * the kernal does not cantain any of the extra gss-api specific data.
386 typedef struct gss_mech_config {
387 char *kmodName; /* kernel module name */
388 char *uLibName; /* user library name */
389 char *mechNameStr; /* mechanism string name */
390 char *optionStr; /* optional mech parameters */
391 void *dl_handle; /* RTLD object handle for the mech */
392 gss_OID mech_type; /* mechanism oid */
393 gss_mechanism mech; /* mechanism initialization struct */
394 struct gss_mech_config *next; /* next element in the list */
397 /********************************************************/
398 /* Internal mechglue routines */
400 int gssint_mechglue_init(void);
401 void gssint_mechglue_fini(void);
403 gss_mechanism gssint_get_mechanism (gss_OID);
404 OM_uint32 gssint_get_mech_type (gss_OID, gss_buffer_t);
405 char *gssint_get_kmodName(const gss_OID);
406 char *gssint_get_modOptions(const gss_OID);
407 OM_uint32 gssint_import_internal_name (OM_uint32 *, gss_OID, gss_union_name_t,
409 OM_uint32 gssint_export_internal_name(OM_uint32 *, const gss_OID,
410 const gss_name_t, gss_buffer_t);
411 OM_uint32 gssint_display_internal_name (OM_uint32 *, gss_OID, gss_name_t,
412 gss_buffer_t, gss_OID *);
413 OM_uint32 gssint_release_internal_name (OM_uint32 *, gss_OID, gss_name_t *);
415 OM_uint32 gssint_convert_name_to_union_name
416 (OM_uint32 *, /* minor_status */
417 gss_mechanism, /* mech */
418 gss_name_t, /* internal_name */
419 gss_name_t * /* external_name */
421 gss_cred_id_t gssint_get_mechanism_cred
422 (gss_union_cred_t, /* union_cred */
423 gss_OID /* mech_type */
426 OM_uint32 gssint_create_copy_buffer(
427 const gss_buffer_t, /* src buffer */
428 gss_buffer_t *, /* destination buffer */
429 int /* NULL terminate buffer ? */
432 OM_uint32 gssint_copy_oid_set(
433 OM_uint32 *, /* minor_status */
434 const gss_OID_set_desc *, /* oid set */
435 gss_OID_set * /* new oid set */
438 gss_OID gss_find_mechanism_from_name_type (gss_OID); /* name_type */
440 OM_uint32 gss_add_mech_name_type
441 (OM_uint32 *, /* minor_status */
442 gss_OID, /* name_type */
447 * Sun extensions to GSS-API v2
452 const char *mech, /* mechanism string name */
453 gss_OID *oid /* mechanism oid */
458 const gss_OID oid /* mechanism oid */
462 gssint_get_mechanisms(
463 char *mechArray[], /* array to populate with mechs */
464 int arrayLen /* length of passed in array */
469 OM_uint32 *, /* minor_status */
470 const gss_cred_id_t, /* input_cred_handle */
471 gss_cred_usage_t, /* cred_usage */
472 const gss_OID, /* desired_mech */
473 OM_uint32, /* overwrite_cred */
474 OM_uint32, /* default_cred */
475 gss_OID_set *, /* elements_stored */
476 gss_cred_usage_t * /* cred_usage_stored */
480 gssint_get_der_length(
481 unsigned char **, /* buf */
482 unsigned int, /* buf_len */
483 unsigned int * /* bytes */
487 gssint_der_length_size(unsigned int /* len */);
490 gssint_put_der_length(
491 unsigned int, /* length */
492 unsigned char **, /* buf */
493 unsigned int /* max_len */
496 #endif /* _GSS_MECHGLUEP_H */