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_ctx_id_struct {
30 struct gss_ctx_id_struct *loopback;
32 gss_ctx_id_t internal_ctx_id;
33 } gss_union_ctx_id_desc, *gss_union_ctx_id_t;
36 * Generic GSSAPI names. A name can either be a generic name, or a
37 * mechanism specific name....
39 typedef struct gss_name_struct {
40 struct gss_name_struct *loopback;
42 gss_buffer_t external_name;
44 * These last two fields are only filled in for mechanism
49 } gss_union_name_desc, *gss_union_name_t;
52 * Structure for holding list of mechanism-specific name types
54 typedef struct gss_mech_spec_name_t {
57 struct gss_mech_spec_name_t *next, *prev;
58 } gss_mech_spec_name_desc, *gss_mech_spec_name;
61 * Credential auxiliary info, used in the credential structure
63 typedef struct gss_union_cred_auxinfo {
66 OM_uint32 creation_time;
69 } gss_union_cred_auxinfo;
72 * Set of Credentials typed on mechanism OID
74 typedef struct gss_cred_id_struct {
75 struct gss_cred_id_struct *loopback;
78 gss_cred_id_t *cred_array;
79 gss_union_cred_auxinfo auxinfo;
80 } gss_union_cred_desc, *gss_union_cred_t;
83 * Rudimentary pointer validation macro to check whether the
84 * "loopback" field of an opaque struct points back to itself. This
85 * field also catches some programming errors where an opaque pointer
86 * is passed to a function expecting the address of the opaque
89 #define GSSINT_CHK_LOOP(p) (!((p) != NULL && (p)->loopback == (p)))
91 /********************************************************/
92 /* The Mechanism Dispatch Table -- a mechanism needs to */
93 /* define one of these and provide a function to return */
94 /* it to initialize the GSSAPI library */
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)
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.
107 typedef struct gss_config {
110 gss_OID_desc mech_type;
112 OM_uint32 (*gss_acquire_cred)
115 OM_uint32*, /* minor_status */
116 gss_name_t, /* desired_name */
117 OM_uint32, /* time_req */
118 gss_OID_set, /* desired_mechs */
119 int, /* cred_usage */
120 gss_cred_id_t*, /* output_cred_handle */
121 gss_OID_set*, /* actual_mechs */
122 OM_uint32* /* time_rec */
124 OM_uint32 (*gss_release_cred)
127 OM_uint32*, /* minor_status */
128 gss_cred_id_t* /* cred_handle */
130 OM_uint32 (*gss_init_sec_context)
133 OM_uint32*, /* minor_status */
134 gss_cred_id_t, /* claimant_cred_handle */
135 gss_ctx_id_t*, /* context_handle */
136 gss_name_t, /* target_name */
137 gss_OID, /* mech_type */
138 OM_uint32, /* req_flags */
139 OM_uint32, /* time_req */
140 gss_channel_bindings_t, /* input_chan_bindings */
141 gss_buffer_t, /* input_token */
142 gss_OID*, /* actual_mech_type */
143 gss_buffer_t, /* output_token */
144 OM_uint32*, /* ret_flags */
145 OM_uint32* /* time_rec */
147 OM_uint32 (*gss_accept_sec_context)
150 OM_uint32*, /* minor_status */
151 gss_ctx_id_t*, /* context_handle */
152 gss_cred_id_t, /* verifier_cred_handle */
153 gss_buffer_t, /* input_token_buffer */
154 gss_channel_bindings_t, /* input_chan_bindings */
155 gss_name_t*, /* src_name */
156 gss_OID*, /* mech_type */
157 gss_buffer_t, /* output_token */
158 OM_uint32*, /* ret_flags */
159 OM_uint32*, /* time_rec */
160 gss_cred_id_t* /* delegated_cred_handle */
162 OM_uint32 (*gss_process_context_token)
165 OM_uint32*, /* minor_status */
166 gss_ctx_id_t, /* context_handle */
167 gss_buffer_t /* token_buffer */
169 OM_uint32 (*gss_delete_sec_context)
172 OM_uint32*, /* minor_status */
173 gss_ctx_id_t*, /* context_handle */
174 gss_buffer_t /* output_token */
176 OM_uint32 (*gss_context_time)
179 OM_uint32*, /* minor_status */
180 gss_ctx_id_t, /* context_handle */
181 OM_uint32* /* time_rec */
183 OM_uint32 (*gss_sign)
186 OM_uint32*, /* minor_status */
187 gss_ctx_id_t, /* context_handle */
189 gss_buffer_t, /* message_buffer */
190 gss_buffer_t /* message_token */
192 OM_uint32 (*gss_verify)
195 OM_uint32*, /* minor_status */
196 gss_ctx_id_t, /* context_handle */
197 gss_buffer_t, /* message_buffer */
198 gss_buffer_t, /* token_buffer */
201 OM_uint32 (*gss_seal)
204 OM_uint32*, /* minor_status */
205 gss_ctx_id_t, /* context_handle */
206 int, /* conf_req_flag */
208 gss_buffer_t, /* input_message_buffer */
209 int*, /* conf_state */
210 gss_buffer_t /* output_message_buffer */
212 OM_uint32 (*gss_unseal)
215 OM_uint32*, /* minor_status */
216 gss_ctx_id_t, /* context_handle */
217 gss_buffer_t, /* input_message_buffer */
218 gss_buffer_t, /* output_message_buffer */
219 int*, /* conf_state */
222 OM_uint32 (*gss_display_status)
225 OM_uint32*, /* minor_status */
226 OM_uint32, /* status_value */
227 int, /* status_type */
228 gss_OID, /* mech_type */
229 OM_uint32*, /* message_context */
230 gss_buffer_t /* status_string */
232 OM_uint32 (*gss_indicate_mechs)
235 OM_uint32*, /* minor_status */
236 gss_OID_set* /* mech_set */
238 OM_uint32 (*gss_compare_name)
241 OM_uint32*, /* minor_status */
242 gss_name_t, /* name1 */
243 gss_name_t, /* name2 */
244 int* /* name_equal */
246 OM_uint32 (*gss_display_name)
249 OM_uint32*, /* minor_status */
250 gss_name_t, /* input_name */
251 gss_buffer_t, /* output_name_buffer */
252 gss_OID* /* output_name_type */
254 OM_uint32 (*gss_import_name)
257 OM_uint32*, /* minor_status */
258 gss_buffer_t, /* input_name_buffer */
259 gss_OID, /* input_name_type */
260 gss_name_t* /* output_name */
262 OM_uint32 (*gss_release_name)
265 OM_uint32*, /* minor_status */
266 gss_name_t* /* input_name */
268 OM_uint32 (*gss_inquire_cred)
271 OM_uint32 *, /* minor_status */
272 gss_cred_id_t, /* cred_handle */
273 gss_name_t *, /* name */
274 OM_uint32 *, /* lifetime */
275 int *, /* cred_usage */
276 gss_OID_set * /* mechanisms */
278 OM_uint32 (*gss_add_cred)
281 OM_uint32 *, /* minor_status */
282 gss_cred_id_t, /* input_cred_handle */
283 gss_name_t, /* desired_name */
284 gss_OID, /* desired_mech */
285 gss_cred_usage_t, /* cred_usage */
286 OM_uint32, /* initiator_time_req */
287 OM_uint32, /* acceptor_time_req */
288 gss_cred_id_t *, /* output_cred_handle */
289 gss_OID_set *, /* actual_mechs */
290 OM_uint32 *, /* initiator_time_rec */
291 OM_uint32 * /* acceptor_time_rec */
293 OM_uint32 (*gss_export_sec_context)
296 OM_uint32 *, /* minor_status */
297 gss_ctx_id_t *, /* context_handle */
298 gss_buffer_t /* interprocess_token */
300 OM_uint32 (*gss_import_sec_context)
302 void *, /* context */
303 OM_uint32 *, /* minor_status */
304 gss_buffer_t, /* interprocess_token */
305 gss_ctx_id_t * /* context_handle */
307 OM_uint32 (*gss_inquire_cred_by_mech)
309 void *, /* context */
310 OM_uint32 *, /* minor_status */
311 gss_cred_id_t, /* cred_handle */
312 gss_OID, /* mech_type */
313 gss_name_t *, /* name */
314 OM_uint32 *, /* initiator_lifetime */
315 OM_uint32 *, /* acceptor_lifetime */
316 gss_cred_usage_t * /* cred_usage */
318 OM_uint32 (*gss_inquire_names_for_mech)
320 void *, /* context */
321 OM_uint32 *, /* minor_status */
322 gss_OID, /* mechanism */
323 gss_OID_set * /* name_types */
325 OM_uint32 (*gss_inquire_context)
327 void *, /* context */
328 OM_uint32 *, /* minor_status */
329 gss_ctx_id_t, /* context_handle */
330 gss_name_t *, /* src_name */
331 gss_name_t *, /* targ_name */
332 OM_uint32 *, /* lifetime_rec */
333 gss_OID *, /* mech_type */
334 OM_uint32 *, /* ctx_flags */
335 int *, /* locally_initiated */
338 OM_uint32 (*gss_internal_release_oid)
340 void *, /* context */
341 OM_uint32 *, /* minor_status */
344 OM_uint32 (*gss_wrap_size_limit)
346 void *, /* context */
347 OM_uint32 *, /* minor_status */
348 gss_ctx_id_t, /* context_handle */
349 int, /* conf_req_flag */
350 gss_qop_t, /* qop_req */
351 OM_uint32, /* req_output_size */
352 OM_uint32 * /* max_input_size */
354 OM_uint32 (*gss_export_name)
356 void *, /* context */
357 OM_uint32 *, /* minor_status */
358 const gss_name_t, /* input_name */
359 gss_buffer_t /* exported_name */
361 OM_uint32 (*gss_store_cred)
363 void *, /* context */
364 OM_uint32 *, /* minor_status */
365 const gss_cred_id_t, /* input_cred */
366 gss_cred_usage_t, /* cred_usage */
367 const gss_OID, /* desired_mech */
368 OM_uint32, /* overwrite_cred */
369 OM_uint32, /* default_cred */
370 gss_OID_set *, /* elements_stored */
371 gss_cred_usage_t * /* cred_usage_stored */
376 * In the user space we use a wrapper structure to encompass the
377 * mechanism entry points. The wrapper contain the mechanism
378 * entry points and other data which is only relevant to the gss-api
379 * layer. In the kernel we use only the gss_config strucutre because
380 * the kernal does not cantain any of the extra gss-api specific data.
382 typedef struct gss_mech_config {
383 char *kmodName; /* kernel module name */
384 char *uLibName; /* user library name */
385 char *mechNameStr; /* mechanism string name */
386 char *optionStr; /* optional mech parameters */
387 void *dl_handle; /* RTLD object handle for the mech */
388 gss_OID mech_type; /* mechanism oid */
389 gss_mechanism mech; /* mechanism initialization struct */
390 struct gss_mech_config *next; /* next element in the list */
393 /********************************************************/
394 /* Internal mechglue routines */
396 int gssint_mechglue_init(void);
397 void gssint_mechglue_fini(void);
399 gss_mechanism gssint_get_mechanism (gss_OID);
400 OM_uint32 gssint_get_mech_type (gss_OID, gss_buffer_t);
401 char *gssint_get_kmodName(const gss_OID);
402 char *gssint_get_modOptions(const gss_OID);
403 OM_uint32 gssint_import_internal_name (OM_uint32 *, gss_OID, gss_union_name_t,
405 OM_uint32 gssint_export_internal_name(OM_uint32 *, const gss_OID,
406 const gss_name_t, gss_buffer_t);
407 OM_uint32 gssint_display_internal_name (OM_uint32 *, gss_OID, gss_name_t,
408 gss_buffer_t, gss_OID *);
409 OM_uint32 gssint_release_internal_name (OM_uint32 *, gss_OID, gss_name_t *);
411 OM_uint32 gssint_convert_name_to_union_name
412 (OM_uint32 *, /* minor_status */
413 gss_mechanism, /* mech */
414 gss_name_t, /* internal_name */
415 gss_name_t * /* external_name */
417 gss_cred_id_t gssint_get_mechanism_cred
418 (gss_union_cred_t, /* union_cred */
419 gss_OID /* mech_type */
422 OM_uint32 gssint_create_copy_buffer(
423 const gss_buffer_t, /* src buffer */
424 gss_buffer_t *, /* destination buffer */
425 int /* NULL terminate buffer ? */
428 OM_uint32 gssint_copy_oid_set(
429 OM_uint32 *, /* minor_status */
430 const gss_OID_set_desc *, /* oid set */
431 gss_OID_set * /* new oid set */
434 gss_OID gss_find_mechanism_from_name_type (gss_OID); /* name_type */
436 OM_uint32 gss_add_mech_name_type
437 (OM_uint32 *, /* minor_status */
438 gss_OID, /* name_type */
443 * Sun extensions to GSS-API v2
448 const char *mech, /* mechanism string name */
449 gss_OID *oid /* mechanism oid */
454 const gss_OID oid /* mechanism oid */
458 gssint_get_mechanisms(
459 char *mechArray[], /* array to populate with mechs */
460 int arrayLen /* length of passed in array */
465 OM_uint32 *, /* minor_status */
466 const gss_cred_id_t, /* input_cred_handle */
467 gss_cred_usage_t, /* cred_usage */
468 const gss_OID, /* desired_mech */
469 OM_uint32, /* overwrite_cred */
470 OM_uint32, /* default_cred */
471 gss_OID_set *, /* elements_stored */
472 gss_cred_usage_t * /* cred_usage_stored */
476 gssint_get_der_length(
477 unsigned char **, /* buf */
478 unsigned int, /* buf_len */
479 unsigned int * /* bytes */
483 gssint_der_length_size(unsigned int /* len */);
486 gssint_put_der_length(
487 unsigned int, /* length */
488 unsigned char **, /* buf */
489 unsigned int /* max_len */
492 #endif /* _GSS_MECHGLUEP_H */