4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
26 * This header contains the private mechglue definitions.
30 #ifndef _GSS_MECHGLUEP_H
31 #define _GSS_MECHGLUEP_H
33 #if 0 /* SUNW15resync - disable for sake of non-krb5 mechs */
42 #include <gssapi/gssapi_ext.h> /* SUNW15resync - mechglue.h in mit 1.5 */
43 #if 0 /* Solaris Kerberos */
44 #include "gssapiP_generic.h"
51 #ifndef g_OID_copy /* SUNW15resync */
52 #define g_OID_copy(o1, o2) \
54 memcpy((o1)->elements, (o2)->elements, (o2)->length); \
55 (o1)->length = (o2)->length; \
59 #define GSS_EMPTY_BUFFER(buf) ((buf) == NULL ||\
60 (buf)->value == NULL || (buf)->length == 0)
63 * Array of context IDs typed by mechanism OID
65 typedef struct gss_union_ctx_id_t
{
67 gss_ctx_id_t internal_ctx_id
;
68 } gss_union_ctx_id_desc
, *gss_union_ctx_id_t
;
71 * Generic GSSAPI names. A name can either be a generic name, or a
72 * mechanism specific name....
74 typedef struct gss_name_struct
{
75 struct gss_name_struct
*loopback
;
77 gss_buffer_t external_name
;
79 * These last two fields are only filled in for mechanism
84 } gss_union_name_desc
, *gss_union_name_t
;
87 * Structure for holding list of mechanism-specific name types
89 typedef struct gss_mech_spec_name_t
{
92 struct gss_mech_spec_name_t
*next
, *prev
;
93 } gss_mech_spec_name_desc
, *gss_mech_spec_name
;
96 * Credential auxiliary info, used in the credential structure
98 typedef struct gss_union_cred_auxinfo
{
101 OM_uint32 creation_time
;
104 } gss_union_cred_auxinfo
;
107 * Set of Credentials typed on mechanism OID
109 typedef struct gss_union_cred_t
{
112 gss_cred_id_t
*cred_array
;
113 gss_union_cred_auxinfo auxinfo
;
114 } gss_union_cred_desc
, *gss_union_cred_t
;
116 /* Solaris Kerberos */
117 typedef OM_uint32 (*gss_acquire_cred_with_password_sfct
)(
118 void *, /* context */
119 OM_uint32
*, /* minor_status */
120 const gss_name_t
, /* desired_name */
121 const gss_buffer_t
, /* password */
122 OM_uint32
, /* time_req */
123 const gss_OID_set
, /* desired_mechs */
124 int, /* cred_usage */
125 gss_cred_id_t
*, /* output_cred_handle */
126 gss_OID_set
*, /* actual_mechs */
127 OM_uint32
* /* time_rec */
131 * Rudimentary pointer validation macro to check whether the
132 * "loopback" field of an opaque struct points back to itself. This
133 * field also catches some programming errors where an opaque pointer
134 * is passed to a function expecting the address of the opaque
137 #if 0 /* Solaris Kerberos - revisit for full 1.7/next resync */
138 #define GSSINT_CHK_LOOP(p) (!((p) != NULL && (p)->loopback == (p)))
140 #define GSSINT_CHK_LOOP(p) ((p) == NULL)
144 /* **************************************************** */
145 /* The Mechanism Dispatch Table -- a mechanism needs to */
146 /* define one of these and provide a function to return */
147 /* it to initialize the GSSAPI library */
150 * This is the definition of the mechs_array struct, which is used to
151 * define the mechs array table. This table is used to indirectly
152 * access mechanism specific versions of the gssapi routines through
153 * the routines in the glue module (gssd_mech_glue.c)
155 * This contants all of the functions defined in gssapi.h except for
156 * gss_release_buffer() and gss_release_oid_set(), which I am
157 * assuming, for now, to be equal across mechanisms.
160 typedef struct gss_config
{
161 #if 0 /* Solaris Kerberos */
165 gss_OID_desc mech_type
;
168 struct gss_config
*next
;
173 OM_uint32 (*gss_acquire_cred
)
175 void *, /* context */
176 OM_uint32
*, /* minor_status */
177 const gss_name_t
, /* desired_name */
178 OM_uint32
, /* time_req */
179 const gss_OID_set
, /* desired_mechs */
180 int, /* cred_usage */
181 gss_cred_id_t
*, /* output_cred_handle */
182 gss_OID_set
*, /* actual_mechs */
183 OM_uint32
* /* time_rec */
185 OM_uint32 (*gss_release_cred
)
187 void *, /* context */
188 OM_uint32
*, /* minor_status */
189 gss_cred_id_t
* /* cred_handle */
191 OM_uint32 (*gss_init_sec_context
)
193 void *, /* context */
194 OM_uint32
*, /* minor_status */
195 const gss_cred_id_t
, /* claimant_cred_handle */
196 gss_ctx_id_t
*, /* context_handle */
197 const gss_name_t
, /* target_name */
198 const gss_OID
, /* mech_type */
199 OM_uint32
, /* req_flags */
200 OM_uint32
, /* time_req */
201 const gss_channel_bindings_t
, /* input_chan_bindings */
202 const gss_buffer_t
, /* input_token */
203 gss_OID
*, /* actual_mech_type */
204 gss_buffer_t
, /* output_token */
205 OM_uint32
*, /* ret_flags */
206 OM_uint32
* /* time_rec */
208 OM_uint32 (*gss_accept_sec_context
)
210 void *, /* context */
211 OM_uint32
*, /* minor_status */
212 gss_ctx_id_t
*, /* context_handle */
213 const gss_cred_id_t
, /* verifier_cred_handle */
214 const gss_buffer_t
, /* input_token_buffer */
215 const gss_channel_bindings_t
, /* input_chan_bindings */
216 gss_name_t
*, /* src_name */
217 gss_OID
*, /* mech_type */
218 gss_buffer_t
, /* output_token */
219 OM_uint32
*, /* ret_flags */
220 OM_uint32
*, /* time_rec */
221 gss_cred_id_t
* /* delegated_cred_handle */
223 #endif /* ! _KERNEL */
226 * Note: there are two gss_unseal's in here. Make any changes to both.
228 OM_uint32 (*gss_unseal
)
230 void *, /* context */
231 OM_uint32
*, /* minor_status */
232 const gss_ctx_id_t
, /* context_handle */
233 const gss_buffer_t
, /* input_message_buffer */
234 gss_buffer_t
, /* output_message_buffer */
235 int *, /* conf_state */
236 int * /* qop_state */
242 OM_uint32 (*gss_process_context_token
)
244 void *, /* context */
245 OM_uint32
*, /* minor_status */
246 const gss_ctx_id_t
, /* context_handle */
247 const gss_buffer_t
/* token_buffer */
249 #endif /* ! _KERNEL */
250 OM_uint32 (*gss_delete_sec_context
)
252 void *, /* context */
253 OM_uint32
*, /* minor_status */
254 gss_ctx_id_t
*, /* context_handle */
255 gss_buffer_t
/* output_token */
261 OM_uint32 (*gss_context_time
)
263 void *, /* context */
264 OM_uint32
*, /* minor_status */
265 const gss_ctx_id_t
, /* context_handle */
266 OM_uint32
* /* time_rec */
268 OM_uint32 (*gss_display_status
)
270 void *, /* context */
271 OM_uint32
*, /* minor_status */
272 OM_uint32
, /* status_value */
273 int, /* status_type */
274 const gss_OID
, /* mech_type */
275 OM_uint32
*, /* message_context */
276 gss_buffer_t
/* status_string */
278 OM_uint32 (*gss_indicate_mechs
)
280 void *, /* context */
281 OM_uint32
*, /* minor_status */
282 gss_OID_set
* /* mech_set */
284 OM_uint32 (*gss_compare_name
)
286 void *, /* context */
287 OM_uint32
*, /* minor_status */
288 const gss_name_t
, /* name1 */
289 const gss_name_t
, /* name2 */
290 int * /* name_equal */
292 OM_uint32 (*gss_display_name
)
294 void *, /* context */
295 OM_uint32
*, /* minor_status */
296 const gss_name_t
, /* input_name */
297 gss_buffer_t
, /* output_name_buffer */
298 gss_OID
* /* output_name_type */
300 OM_uint32 (*gss_import_name
)
302 void *, /* context */
303 OM_uint32
*, /* minor_status */
304 const gss_buffer_t
, /* input_name_buffer */
305 const gss_OID
, /* input_name_type */
306 gss_name_t
* /* output_name */
308 OM_uint32 (*gss_release_name
)
310 void *, /* context */
311 OM_uint32
*, /* minor_status */
312 gss_name_t
* /* input_name */
314 OM_uint32 (*gss_inquire_cred
)
316 void *, /* context */
317 OM_uint32
*, /* minor_status */
318 const gss_cred_id_t
, /* cred_handle */
319 gss_name_t
*, /* name */
320 OM_uint32
*, /* lifetime */
321 int *, /* cred_usage */
322 gss_OID_set
* /* mechanisms */
324 OM_uint32 (*gss_add_cred
)
326 void *, /* context */
327 OM_uint32
*, /* minor_status */
328 const gss_cred_id_t
, /* input_cred_handle */
329 const gss_name_t
, /* desired_name */
330 const gss_OID
, /* desired_mech */
331 gss_cred_usage_t
, /* cred_usage */
332 OM_uint32
, /* initiator_time_req */
333 OM_uint32
, /* acceptor_time_req */
334 gss_cred_id_t
*, /* output_cred_handle */
335 gss_OID_set
*, /* actual_mechs */
336 OM_uint32
*, /* initiator_time_rec */
337 OM_uint32
* /* acceptor_time_rec */
339 #endif /* ! _KERNEL */
341 * Note: there are two gss_seal's in here. Make any changes to both.
343 OM_uint32 (*gss_seal
)
345 void *, /* context */
346 OM_uint32
*, /* minor_status */
347 const gss_ctx_id_t
, /* context_handle */
348 int, /* conf_req_flag */
350 const gss_buffer_t
, /* input_message_buffer */
351 int *, /* conf_state */
352 gss_buffer_t
/* output_message_buffer */
358 OM_uint32 (*gss_export_sec_context
)
360 void *, /* context */
361 OM_uint32
*, /* minor_status */
362 gss_ctx_id_t
*, /* context_handle */
363 gss_buffer_t
/* interprocess_token */
365 #endif /* ! _KERNEL */
366 OM_uint32 (*gss_import_sec_context
)
368 void *, /* context */
369 OM_uint32
*, /* minor_status */
370 const gss_buffer_t
, /* interprocess_token */
371 gss_ctx_id_t
* /* context_handle */
374 OM_uint32 (*gss_inquire_cred_by_mech
)
376 void *, /* context */
377 OM_uint32
*, /* minor_status */
378 const gss_cred_id_t
, /* cred_handle */
379 const gss_OID
, /* mech_type */
380 gss_name_t
*, /* name */
381 OM_uint32
*, /* initiator_lifetime */
382 OM_uint32
*, /* acceptor_lifetime */
383 gss_cred_usage_t
* /* cred_usage */
385 OM_uint32 (*gss_inquire_names_for_mech
)
387 void *, /* context */
388 OM_uint32
*, /* minor_status */
389 const gss_OID
, /* mechanism */
390 gss_OID_set
* /* name_types */
392 OM_uint32 (*gss_inquire_context
)
394 void *, /* context */
395 OM_uint32
*, /* minor_status */
396 const gss_ctx_id_t
, /* context_handle */
397 gss_name_t
*, /* src_name */
398 gss_name_t
*, /* targ_name */
399 OM_uint32
*, /* lifetime_rec */
400 gss_OID
*, /* mech_type */
401 OM_uint32
*, /* ctx_flags */
402 int *, /* locally_initiated */
405 OM_uint32 (*gss_internal_release_oid
)
407 void *, /* context */
408 OM_uint32
*, /* minor_status */
411 OM_uint32 (*gss_wrap_size_limit
)
413 void *, /* context */
414 OM_uint32
*, /* minor_status */
415 const gss_ctx_id_t
, /* context_handle */
416 int, /* conf_req_flag */
417 gss_qop_t
, /* qop_req */
418 OM_uint32
, /* req_output_size */
419 OM_uint32
* /* max_input_size */
421 OM_uint32 (*pname_to_uid
)
423 void *, /* context */
424 OM_uint32
*, /* minor_status */
425 const gss_name_t
, /* pname */
428 OM_uint32 (*__gss_userok
)
430 void *, /* context */
431 OM_uint32
*, /* minor_status */
432 const gss_name_t
, /* pname */
433 const char *, /* local user */
436 OM_uint32 (*gss_export_name
)
438 void *, /* context */
439 OM_uint32
*, /* minor_status */
440 const gss_name_t
, /* input_name */
441 gss_buffer_t
/* exported_name */
443 #endif /* ! _KERNEL */
444 OM_uint32 (*gss_sign
)
446 void *, /* context */
447 OM_uint32
*, /* minor_status */
448 const gss_ctx_id_t
, /* context_handle */
450 const gss_buffer_t
, /* message_buffer */
451 gss_buffer_t
/* message_token */
456 OM_uint32 (*gss_verify
)
458 void *, /* context */
459 OM_uint32
*, /* minor_status */
460 const gss_ctx_id_t
, /* context_handle */
461 const gss_buffer_t
, /* message_buffer */
462 const gss_buffer_t
, /* token_buffer */
463 int * /* qop_state */
469 OM_uint32 (*gss_store_cred
)
471 void *, /* context */
472 OM_uint32
*, /* minor_status */
473 const gss_cred_id_t
, /* input_cred */
474 gss_cred_usage_t
, /* cred_usage */
475 const gss_OID
, /* desired_mech */
476 OM_uint32
, /* overwrite_cred */
477 OM_uint32
, /* default_cred */
478 gss_OID_set
*, /* elements_stored */
479 gss_cred_usage_t
* /* cred_usage_stored */
484 OM_uint32 (*gss_inquire_sec_context_by_oid
)
486 OM_uint32
*, /* minor_status */
487 const gss_ctx_id_t
, /* context_handle */
488 const gss_OID
, /* OID */
489 gss_buffer_set_t
* /* data_set */
498 /* This structure MUST NOT be used by any code outside libgss */
499 typedef struct gss_config_ext
{
500 gss_acquire_cred_with_password_sfct gss_acquire_cred_with_password
;
501 } *gss_mechanism_ext
;
506 * In the user space we use a wrapper structure to encompass the
507 * mechanism entry points. The wrapper contain the mechanism
508 * entry points and other data which is only relevant to the gss-api
509 * layer. In the kernel we use only the gss_config strucutre because
510 * the kernal does not cantain any of the extra gss-api specific data.
512 typedef struct gss_mech_config
{
513 char *kmodName
; /* kernel module name */
514 char *uLibName
; /* user library name */
515 char *mechNameStr
; /* mechanism string name */
516 char *optionStr
; /* optional mech parameters */
517 void *dl_handle
; /* RTLD object handle for the mech */
518 gss_OID mech_type
; /* mechanism oid */
519 gss_mechanism mech
; /* mechanism initialization struct */
521 gss_mechanism_ext mech_ext
; /* Solaris extensions */
523 struct gss_mech_config
*next
; /* next element in the list */
526 /* ***************************************************** */
527 /* Internal mechglue routines */
529 /* SUNW15resync - Solaris versions - replace w/mit ones? */
530 gss_mechanism
__gss_get_mechanism(const gss_OID
);
532 gss_mechanism_ext
__gss_get_mechanism_ext(const gss_OID
);
534 char *__gss_get_kmodName(const gss_OID
);
535 char *__gss_get_modOptions(const gss_OID
);
536 OM_uint32
__gss_import_internal_name(OM_uint32
*, const gss_OID
,
537 gss_union_name_t
, gss_name_t
*);
538 OM_uint32
__gss_export_internal_name(OM_uint32
*, const gss_OID
,
539 const gss_name_t
, gss_buffer_t
);
540 OM_uint32
__gss_display_internal_name(OM_uint32
*, const gss_OID
,
541 const gss_name_t
, gss_buffer_t
, gss_OID
*);
542 OM_uint32
__gss_release_internal_name(OM_uint32
*, const gss_OID
,
544 OM_uint32
gssint_delete_internal_sec_context(OM_uint32
*, gss_OID
,
545 gss_ctx_id_t
*, gss_buffer_t
);
546 OM_uint32
__gss_convert_name_to_union_name(
547 OM_uint32
*, /* minor_status */
548 gss_mechanism
, /* mech */
549 gss_name_t
, /* internal_name */
550 gss_name_t
* /* external_name */
553 gss_cred_id_t
__gss_get_mechanism_cred(
554 const gss_union_cred_t
, /* union_cred */
555 const gss_OID
/* mech_type */
562 int gssint_mechglue_init(void);
563 void gssint_mechglue_fini(void);
565 gss_mechanism
gssint_get_mechanism(gss_OID
);
566 OM_uint32
gssint_get_mech_type(gss_OID
, gss_buffer_t
);
567 char *gssint_get_kmodName(const gss_OID
);
568 char *gssint_get_modOptions(const gss_OID
);
569 OM_uint32
gssint_import_internal_name(OM_uint32
*, gss_OID
, gss_union_name_t
,
571 OM_uint32
gssint_export_internal_name(OM_uint32
*, const gss_OID
,
572 const gss_name_t
, gss_buffer_t
);
573 OM_uint32
gssint_display_internal_name(OM_uint32
*, gss_OID
, gss_name_t
,
574 gss_buffer_t
, gss_OID
*);
575 OM_uint32
gssint_release_internal_name(OM_uint32
*, gss_OID
, gss_name_t
*);
577 OM_uint32
gssint_convert_name_to_union_name(
578 OM_uint32
*, /* minor_status */
579 gss_mechanism
, /* mech */
580 gss_name_t
, /* internal_name */
581 gss_name_t
* /* external_name */
583 gss_cred_id_t
gssint_get_mechanism_cred(
584 gss_union_cred_t
, /* union_cred */
585 gss_OID
/* mech_type */
587 OM_uint32
gssint_create_copy_buffer(
588 const gss_buffer_t
, /* src buffer */
589 gss_buffer_t
*, /* destination buffer */
590 int /* NULL terminate buffer ? */
594 OM_uint32
gssint_copy_oid_set(
595 OM_uint32
*, /* minor_status */
596 const gss_OID_set_desc
*, /* oid set */
597 gss_OID_set
* /* new oid set */
600 /* SUNW15resync - for old Solaris version in libgss */
601 OM_uint32
gss_copy_oid_set(
602 OM_uint32
*, /* minor_status */
603 const gss_OID_set_desc
*, /* oid set */
604 gss_OID_set
* /* new oid set */
608 gss_OID
gss_find_mechanism_from_name_type(gss_OID
); /* name_type */
610 OM_uint32
gss_add_mech_name_type(
611 OM_uint32
*, /* minor_status */
612 gss_OID
, /* name_type */
617 * Sun extensions to GSS-API v2
620 OM_uint32 gssint_mech_to_oid
621 (const char *mech
, /* mechanism string name */
622 gss_OID
*oid
/* mechanism oid */
627 (const gss_OID oid
/* mechanism oid */
631 gssint_get_mechanisms
632 (char *mechArray
[], /* array to populate with mechs */
633 int arrayLen
/* length of passed in array */
638 (OM_uint32
*, /* minor_status */
639 const gss_cred_id_t
, /* input_cred_handle */
640 gss_cred_usage_t
, /* cred_usage */
641 const gss_OID
, /* desired_mech */
642 OM_uint32
, /* overwrite_cred */
643 OM_uint32
, /* default_cred */
644 gss_OID_set
*, /* elements_stored */
645 gss_cred_usage_t
* /* cred_usage_stored */
649 gssint_get_der_length
650 (unsigned char **, /* buf */
651 unsigned int, /* buf_len */
652 unsigned int * /* bytes */
656 gssint_der_length_size(unsigned int /* len */);
659 gssint_put_der_length
660 (unsigned int, /* length */
661 unsigned char **, /* buf */
662 unsigned int /* max_len */
667 /* Solaris kernel and gssd support */
670 * derived types for passing context and credential handles
671 * between gssd and kernel
673 typedef unsigned int gssd_ctx_id_t
;
674 typedef unsigned int gssd_cred_id_t
;
676 #define GSSD_NO_CONTEXT ((gssd_ctx_id_t)0)
677 #define GSSD_NO_CREDENTIAL ((gssd_cred_id_t)0)
682 /* These macros are defined for Kerberos in krb5.h, and have priority */
683 #define MALLOC(n) kmem_alloc((n), KM_SLEEP)
684 #define FREE(x, n) kmem_free((x), (n))
687 gss_mechanism
__kgss_get_mechanism(gss_OID
);
688 void __kgss_add_mechanism(gss_mechanism
);
692 gssd_cred_id_t gssd_cred
;
693 OM_uint32 gssd_cred_verifier
;
696 #define KCRED_TO_KGSS_CRED(cred) ((struct kgss_cred *)(cred))
697 #define KCRED_TO_CRED(cred) (KCRED_TO_KGSS_CRED(cred)->gssd_cred)
698 #define KCRED_TO_CREDV(cred) (KCRED_TO_KGSS_CRED(cred)->gssd_cred_verifier)
701 gssd_ctx_id_t gssd_ctx
;
703 gss_ctx_id_t gssd_i_ctx
;
707 OM_uint32 gssd_ctx_verifier
;
710 #define KCTX_TO_KGSS_CTX(ctx) ((struct kgss_ctx *)(ctx))
711 #define KCTX_TO_CTX_IMPORTED(ctx) (KCTX_TO_KGSS_CTX(ctx)->ctx_imported)
712 #define KCTX_TO_GSSD_CTX(ctx) (KCTX_TO_KGSS_CTX(ctx)->gssd_ctx)
713 #define KCTX_TO_CTXV(ctx) (KCTX_TO_KGSS_CTX(ctx)->gssd_ctx_verifier)
714 #define KCTX_TO_MECH(ctx) (KCTX_TO_KGSS_CTX(ctx)->mech)
715 #define KCTX_TO_PRIVATE(ctx) (KCTX_TO_MECH(ctx)->context)
716 #define KGSS_CTX_TO_GSSD_CTX(ctx) \
717 (((ctx) == GSS_C_NO_CONTEXT) ? (gssd_ctx_id_t)(uintptr_t)(ctx) : \
718 KCTX_TO_GSSD_CTX(ctx))
719 #define KGSS_CTX_TO_GSSD_CTXV(ctx) \
720 (((ctx) == GSS_C_NO_CONTEXT) ? 0 : KCTX_TO_CTXV(ctx))
723 #define KCTX_TO_I_CTX(ctx) (KCTX_TO_KGSS_CTX(ctx)->gssd_i_ctx)
724 #define KCTX_TO_CTX(ctx) \
725 ((KCTX_TO_CTX_IMPORTED(ctx) == FALSE) ? (ctx) : \
727 #define KGSS_CRED_ALLOC() kmem_zalloc(sizeof (struct kgss_cred), \
729 #define KGSS_CRED_FREE(cred) kmem_free(cred, sizeof (struct kgss_cred))
731 #define KGSS_ALLOC() kmem_zalloc(sizeof (struct kgss_ctx), KM_SLEEP)
732 #define KGSS_FREE(ctx) kmem_free(ctx, sizeof (struct kgss_ctx))
734 #define KGSS_SIGN(minor_st, ctx, qop, msg, tkn) \
735 (*(KCTX_TO_MECH(ctx)->gss_sign))(KCTX_TO_PRIVATE(ctx), minor_st, \
736 KCTX_TO_CTX(ctx), qop, msg, tkn, KCTX_TO_CTXV(ctx))
738 #define KGSS_VERIFY(minor_st, ctx, msg, tkn, qop) \
739 (*(KCTX_TO_MECH(ctx)->gss_verify))(KCTX_TO_PRIVATE(ctx), minor_st,\
740 KCTX_TO_CTX(ctx), msg, tkn, qop, KCTX_TO_CTXV(ctx))
742 #define KGSS_DELETE_SEC_CONTEXT(minor_st, ctx, int_ctx_id, tkn) \
743 (*(KCTX_TO_MECH(ctx)->gss_delete_sec_context))(KCTX_TO_PRIVATE(ctx),\
744 minor_st, int_ctx_id, tkn, KCTX_TO_CTXV(ctx))
746 #define KGSS_IMPORT_SEC_CONTEXT(minor_st, tkn, ctx, int_ctx_id) \
747 (*(KCTX_TO_MECH(ctx)->gss_import_sec_context))(KCTX_TO_PRIVATE(ctx),\
748 minor_st, tkn, int_ctx_id)
750 #define KGSS_SEAL(minor_st, ctx, conf_req, qop, msg, conf_state, tkn) \
751 (*(KCTX_TO_MECH(ctx)->gss_seal))(KCTX_TO_PRIVATE(ctx), minor_st, \
752 KCTX_TO_CTX(ctx), conf_req, qop, msg, conf_state, tkn,\
755 #define KGSS_UNSEAL(minor_st, ctx, msg, tkn, conf, qop) \
756 (*(KCTX_TO_MECH(ctx)->gss_unseal))(KCTX_TO_PRIVATE(ctx), minor_st,\
757 KCTX_TO_CTX(ctx), msg, tkn, conf, qop, \
760 #define KGSS_INIT_CONTEXT(ctx) krb5_init_context(ctx)
761 #define KGSS_RELEASE_OID(minor_st, oid) krb5_gss_release_oid(minor_st, oid)
762 extern OM_uint32
kgss_release_oid(OM_uint32
*, gss_OID
*);
766 #define KGSS_INIT_CONTEXT(ctx) krb5_gss_init_context(ctx)
767 #define KGSS_RELEASE_OID(minor_st, oid) gss_release_oid(minor_st, oid)
769 #define KCTX_TO_CTX(ctx) (KCTX_TO_KGSS_CTX(ctx)->gssd_ctx)
770 #define MALLOC(n) malloc(n)
771 #define FREE(x, n) free(x)
772 #define KGSS_CRED_ALLOC() (struct kgss_cred *) \
773 MALLOC(sizeof (struct kgss_cred))
774 #define KGSS_CRED_FREE(cred) free(cred)
775 #define KGSS_ALLOC() (struct kgss_ctx *)MALLOC(sizeof (struct kgss_ctx))
776 #define KGSS_FREE(ctx) free(ctx)
778 #define KGSS_SIGN(minor_st, ctx, qop, msg, tkn) \
779 kgss_sign_wrapped(minor_st, \
780 KCTX_TO_CTX(ctx), qop, msg, tkn, KCTX_TO_CTXV(ctx))
782 #define KGSS_VERIFY(minor_st, ctx, msg, tkn, qop) \
783 kgss_verify_wrapped(minor_st,\
784 KCTX_TO_CTX(ctx), msg, tkn, qop, KCTX_TO_CTXV(ctx))
786 #define KGSS_SEAL(minor_st, ctx, conf_req, qop, msg, conf_state, tkn) \
787 kgss_seal_wrapped(minor_st, \
788 KCTX_TO_CTX(ctx), conf_req, qop, msg, conf_state, tkn, \
791 #define KGSS_UNSEAL(minor_st, ctx, msg, tkn, conf, qop) \
792 kgss_unseal_wrapped(minor_st,\
793 KCTX_TO_CTX(ctx), msg, tkn, conf, qop, \
797 /* SUNW15resync - moved from gssapiP_generic.h for sake of non-krb5 mechs */
798 OM_uint32 generic_gss_release_buffer
799 (OM_uint32
*, /* minor_status */
800 gss_buffer_t
/* buffer */
803 OM_uint32 generic_gss_release_oid_set
804 (OM_uint32
*, /* minor_status */
805 gss_OID_set
* /* set */
808 OM_uint32 generic_gss_release_oid
809 (OM_uint32
*, /* minor_status */
813 OM_uint32 generic_gss_copy_oid
814 (OM_uint32
*, /* minor_status */
815 gss_OID_desc
* const, /* oid */ /* SUNW15resync */
816 gss_OID
* /* new_oid */
819 OM_uint32 generic_gss_create_empty_oid_set
820 (OM_uint32
*, /* minor_status */
821 gss_OID_set
* /* oid_set */
824 OM_uint32 generic_gss_add_oid_set_member
825 (OM_uint32
*, /* minor_status */
826 gss_OID_desc
* const, /* member_oid */
827 gss_OID_set
* /* oid_set */
830 OM_uint32 generic_gss_test_oid_set_member
831 (OM_uint32
*, /* minor_status */
832 gss_OID_desc
* const, /* member */
833 gss_OID_set
, /* set */
837 OM_uint32 generic_gss_oid_to_str
838 (OM_uint32
*, /* minor_status */
839 gss_OID_desc
* const, /* oid */
840 gss_buffer_t
/* oid_str */
843 OM_uint32 generic_gss_str_to_oid
844 (OM_uint32
*, /* minor_status */
845 gss_buffer_t
, /* oid_str */
850 generic_gss_oid_compose
851 (OM_uint32
*, /* minor_status */
852 const char *, /* prefix */
853 size_t, /* prefix_len */
855 gss_OID_desc
* /* oid */
859 generic_gss_oid_decompose
860 (OM_uint32
*, /* minor_status */
861 const char *, /* prefix */
862 size_t, /* prefix_len */
863 gss_OID_desc
*, /* oid */
866 OM_uint32 generic_gss_create_empty_buffer_set
867 (OM_uint32
* /* minor_status */,
868 gss_buffer_set_t
* /* buffer_set */
871 OM_uint32 generic_gss_add_buffer_set_member
872 (OM_uint32
* /* minor_status */,
873 const gss_buffer_t
/* member_buffer */,
874 gss_buffer_set_t
* /* buffer_set */);
876 OM_uint32 generic_gss_release_buffer_set
877 (OM_uint32
* /* minor_status */,
878 gss_buffer_set_t
* /* buffer_set */);
882 * New map error API in MIT 1.7, at build time generates code for errors.
883 * Solaris does not gen the errors at build time so we just stub these
884 * for now, need to revisit.
885 * See mglueP.h and util_errmap.c in MIT 1.7.
889 #define map_error(MINORP, MECH)
890 #define map_errcode(MINORP)
895 * Use this to map an error code that was returned from a mech
896 * operation; the mech will be asked to produce the associated error
899 * Remember that if the minor status code cannot be returned to the
900 * caller (e.g., if it's stuffed in an automatic variable and then
901 * ignored), then we don't care about producing a mapping.
903 #define map_error(MINORP, MECH) \
904 (*(MINORP) = gssint_mecherrmap_map(*(MINORP), &(MECH)->mech_type))
905 #define map_error_oid(MINORP, MECHOID) \
906 (*(MINORP) = gssint_mecherrmap_map(*(MINORP), (MECHOID)))
909 * Use this to map an errno value or com_err error code being
910 * generated within the mechglue code (e.g., by calling generic oid
911 * ops). Any errno or com_err values produced by mech operations
912 * should be processed with map_error. This means they'll be stored
913 * separately even if the mech uses com_err, because we can't assume
914 * that it will use com_err.
916 #define map_errcode(MINORP) \
917 (*(MINORP) = gssint_mecherrmap_map_errcode(*(MINORP)))
921 #endif /* _GSS_MECHGLUEP_H */