2 * Copyright (c) 2011, JANET(UK)
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of JANET(UK) nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * Portions Copyright 2003-2010 Massachusetts Institute of Technology.
34 * All Rights Reserved.
36 * Export of this software from the United States of America may
37 * require a specific license from the United States Government.
38 * It is the responsibility of any person or organization contemplating
39 * export to obtain such a license before exporting.
41 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
42 * distribute this software and its documentation for any purpose and
43 * without fee is hereby granted, provided that the above copyright
44 * notice appear in all copies and that both that copyright notice and
45 * this permission notice appear in supporting documentation, and that
46 * the name of M.I.T. not be used in advertising or publicity pertaining
47 * to distribution of the software without specific, written prior
48 * permission. Furthermore if you modify this software you must label
49 * your software as modified software and not distribute it in such a
50 * fashion that it might be confused with the original M.I.T. software.
51 * M.I.T. makes no representations about the suitability of
52 * this software for any purpose. It is provided "as is" without express
53 * or implied warranty.
64 #if defined(HAVE_SYS_PARAM_H)
65 #include <sys/param.h>
72 ///#if defined(HAVE_STDINT_H)
73 ///#include <stdint.h>
77 ///#define INLINE __inline
79 ///#define INLINE inline
83 #define inline __inline
92 #define MIN(_a,_b) ((_a)<(_b)?(_a):(_b))
95 #if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
96 #define GSSEAP_UNUSED __attribute__ ((__unused__))
103 makeStringBuffer(OM_uint32 *minor,
105 gss_buffer_t buffer);
108 bufferToString(OM_uint32 *minor,
109 const gss_buffer_t buffer,
113 duplicateBuffer(OM_uint32 *minor,
114 const gss_buffer_t src,
118 bufferEqual(const gss_buffer_t b1, const gss_buffer_t b2)
120 return (b1->length == b2->length &&
121 memcmp(b1->value, b2->value, b2->length) == 0);
125 bufferEqualString(const gss_buffer_t b1, const char *s)
129 b2.length = strlen(s);
130 b2.value = (char *)s;
132 return bufferEqual(b1, &b2);
137 gssEapSign(krb5_context context,
140 #ifdef HAVE_HEIMDAL_VERSION
145 krb5_keyusage sign_usage,
146 gss_iov_buffer_desc *iov,
150 gssEapVerify(krb5_context context,
153 #ifdef HAVE_HEIMDAL_VERSION
158 krb5_keyusage sign_usage,
159 gss_iov_buffer_desc *iov,
165 gssEapEncodeGssChannelBindings(OM_uint32 *minor,
166 gss_channel_bindings_t chanBindings,
167 gss_buffer_t encodedBindings);
171 #define EAP_EXPORT_CONTEXT_V1 1
173 enum gss_eap_token_type {
174 TOK_TYPE_NONE = 0x0000, /* no token */
175 TOK_TYPE_MIC = 0x0404, /* RFC 4121 MIC token */
176 TOK_TYPE_WRAP = 0x0504, /* RFC 4121 wrap token */
177 TOK_TYPE_EXPORT_NAME = 0x0401, /* RFC 2743 exported name */
178 TOK_TYPE_EXPORT_NAME_COMPOSITE = 0x0402, /* exported composite name */
179 TOK_TYPE_DELETE_CONTEXT = 0x0405, /* RFC 2743 delete context */
180 TOK_TYPE_INITIATOR_CONTEXT = 0x0601, /* initiator-sent context token */
181 TOK_TYPE_ACCEPTOR_CONTEXT = 0x0602, /* acceptor-sent context token */
184 /* inner token types and flags */
185 #define ITOK_TYPE_NONE 0x00000000
186 #define ITOK_TYPE_CONTEXT_ERR 0x00000001 /* critical */
187 #define ITOK_TYPE_ACCEPTOR_NAME_REQ 0x00000002 /* TBD */
188 #define ITOK_TYPE_ACCEPTOR_NAME_RESP 0x00000003 /* TBD */
189 #define ITOK_TYPE_EAP_RESP 0x00000004 /* critical, required, if not reauth */
190 #define ITOK_TYPE_EAP_REQ 0x00000005 /* critical, required, if not reauth */
191 #define ITOK_TYPE_GSS_CHANNEL_BINDINGS 0x00000006 /* critical, required, if not reauth */
192 #define ITOK_TYPE_REAUTH_CREDS 0x00000007 /* optional */
193 #define ITOK_TYPE_REAUTH_REQ 0x00000008 /* optional */
194 #define ITOK_TYPE_REAUTH_RESP 0x00000009 /* optional */
195 #define ITOK_TYPE_VERSION_INFO 0x0000000A /* optional */
196 #define ITOK_TYPE_VENDOR_INFO 0x0000000B /* optional */
198 #define ITOK_FLAG_CRITICAL 0x80000000 /* critical, wire flag */
199 #define ITOK_FLAG_VERIFIED 0x40000000 /* verified, API flag */
201 #define ITOK_TYPE_MASK (~(ITOK_FLAG_CRITICAL | ITOK_FLAG_VERIFIED))
203 OM_uint32 gssEapAllocContext(OM_uint32 *minor, gss_ctx_id_t *pCtx);
204 OM_uint32 gssEapReleaseContext(OM_uint32 *minor, gss_ctx_id_t *pCtx);
207 gssEapMakeToken(OM_uint32 *minor,
209 const gss_buffer_t innerToken,
210 enum gss_eap_token_type tokenType,
211 gss_buffer_t outputToken);
214 gssEapVerifyToken(OM_uint32 *minor,
216 const gss_buffer_t inputToken,
217 enum gss_eap_token_type *tokenType,
218 gss_buffer_t innerInputToken);
221 gssEapContextTime(OM_uint32 *minor,
222 gss_ctx_id_t context_handle,
223 OM_uint32 *time_rec);
226 OM_uint32 gssEapAllocCred(OM_uint32 *minor, gss_cred_id_t *pCred);
227 OM_uint32 gssEapReleaseCred(OM_uint32 *minor, gss_cred_id_t *pCred);
230 gssEapAcquireCred(OM_uint32 *minor,
231 const gss_name_t desiredName,
232 const gss_buffer_t password,
234 const gss_OID_set desiredMechs,
236 gss_cred_id_t *pCred,
237 gss_OID_set *pActualMechs,
240 int gssEapCredAvailable(gss_cred_id_t cred, gss_OID mech);
243 gssEapInquireCred(OM_uint32 *minor,
246 OM_uint32 *pLifetime,
247 gss_cred_usage_t *cred_usage,
248 gss_OID_set *mechanisms);
252 gssEapEncrypt(krb5_context context, int dce_style, size_t ec,
254 #ifdef HAVE_HEIMDAL_VERSION
260 gss_iov_buffer_desc *iov, int iov_count);
263 gssEapDecrypt(krb5_context context, int dce_style, size_t ec,
265 #ifdef HAVE_HEIMDAL_VERSION
271 gss_iov_buffer_desc *iov, int iov_count);
274 gssEapMapCryptoFlag(OM_uint32 type);
277 gssEapLocateIov(gss_iov_buffer_desc *iov,
282 gssEapIovMessageLength(gss_iov_buffer_desc *iov,
285 size_t *assoc_data_length);
288 gssEapReleaseIov(gss_iov_buffer_desc *iov, int iov_count);
291 gssEapIsIntegrityOnly(gss_iov_buffer_desc *iov, int iov_count);
294 gssEapAllocIov(gss_iov_buffer_t iov, size_t size);
297 gssEapDeriveRfc3961Key(OM_uint32 *minor,
298 const unsigned char *key,
300 krb5_enctype enctype,
301 krb5_keyblock *pKey);
304 #ifdef HAVE_HEIMDAL_VERSION
306 #define KRB_TIME_FOREVER ((time_t)~0L)
308 #define KRB_KEY_TYPE(key) ((key)->keytype)
309 #define KRB_KEY_DATA(key) ((key)->keyvalue.data)
310 #define KRB_KEY_LENGTH(key) ((key)->keyvalue.length)
312 #define KRB_PRINC_LENGTH(princ) ((princ)->name.name_string.len)
313 #define KRB_PRINC_TYPE(princ) ((princ)->name.name_type)
314 #define KRB_PRINC_NAME(princ) ((princ)->name.name_string.val)
315 #define KRB_PRINC_REALM(princ) ((princ)->realm)
317 #define KRB_KT_ENT_KEYBLOCK(e) (&(e)->keyblock)
318 #define KRB_KT_ENT_FREE(c, e) krb5_kt_free_entry((c), (e))
320 #define KRB_CRYPTO_CONTEXT(ctx) (krbCrypto)
324 #define KRB_TIME_FOREVER KRB5_INT32_MAX
326 #define KRB_KEY_TYPE(key) ((key)->enctype)
327 #define KRB_KEY_DATA(key) ((key)->contents)
328 #define KRB_KEY_LENGTH(key) ((key)->length)
330 #define KRB_PRINC_LENGTH(princ) (krb5_princ_size(NULL, (princ)))
331 #define KRB_PRINC_TYPE(princ) (krb5_princ_type(NULL, (princ)))
332 #define KRB_PRINC_NAME(princ) (krb5_princ_name(NULL, (princ)))
333 #define KRB_PRINC_REALM(princ) (krb5_princ_realm(NULL, (princ)))
335 #define KRB_KT_ENT_KEYBLOCK(e) (&(e)->key)
336 #define KRB_KT_ENT_FREE(c, e) krb5_free_keytab_entry_contents((c), (e))
338 #define KRB_CRYPTO_CONTEXT(ctx) (&(ctx)->rfc3961Key)
340 #endif /* HAVE_HEIMDAL_VERSION */
342 #define KRB_KEY_INIT(key) do { \
343 KRB_KEY_TYPE(key) = ENCTYPE_NULL; \
344 KRB_KEY_DATA(key) = NULL; \
345 KRB_KEY_LENGTH(key) = 0; \
348 #define GSSEAP_KRB_INIT(ctx) do { \
349 OM_uint32 tmpMajor; \
351 tmpMajor = gssEapKerberosInit(minor, ctx); \
352 if (GSS_ERROR(tmpMajor)) { \
358 gssEapKerberosInit(OM_uint32 *minor, krb5_context *context);
361 rfc3961ChecksumTypeForKey(OM_uint32 *minor,
363 krb5_cksumtype *cksumtype);
366 krbCryptoLength(krb5_context krbContext,
367 #ifdef HAVE_HEIMDAL_VERSION
368 krb5_crypto krbCrypto,
376 krbPaddingLength(krb5_context krbContext,
377 #ifdef HAVE_HEIMDAL_VERSION
378 krb5_crypto krbCrypto,
386 krbBlockSize(krb5_context krbContext,
387 #ifdef HAVE_HEIMDAL_VERSION
388 krb5_crypto krbCrypto,
395 krbEnctypeToString(krb5_context krbContext,
396 krb5_enctype enctype,
398 gss_buffer_t string);
401 krbMakeAuthDataKdcIssued(krb5_context context,
402 const krb5_keyblock *key,
403 krb5_const_principal issuer,
404 #ifdef HAVE_HEIMDAL_VERSION
405 const AuthorizationData *authdata,
406 AuthorizationData *adKdcIssued
408 krb5_authdata *const *authdata,
409 krb5_authdata ***adKdcIssued
414 krbMakeCred(krb5_context context,
415 krb5_auth_context authcontext,
421 gssEapExportLucidSecContext(OM_uint32 *minor,
423 const gss_OID desiredObject,
424 gss_buffer_set_t *data_set);
427 extern gss_OID GSS_EAP_MECHANISM;
429 #define OID_FLAG_NULL_VALID 0x00000001
430 #define OID_FLAG_FAMILY_MECH_VALID 0x00000002
431 #define OID_FLAG_MAP_NULL_TO_DEFAULT_MECH 0x00000004
432 #define OID_FLAG_MAP_FAMILY_MECH_TO_NULL 0x00000008
435 gssEapCanonicalizeOid(OM_uint32 *minor,
441 gssEapReleaseOid(OM_uint32 *minor, gss_OID *oid);
444 gssEapDefaultMech(OM_uint32 *minor,
448 gssEapIndicateMechs(OM_uint32 *minor,
452 gssEapEnctypeToOid(OM_uint32 *minor,
453 krb5_enctype enctype,
457 gssEapOidToEnctype(OM_uint32 *minor,
459 krb5_enctype *enctype);
462 gssEapIsMechanismOid(const gss_OID oid);
465 gssEapIsConcreteMechanismOid(const gss_OID oid);
468 gssEapValidateMechs(OM_uint32 *minor,
469 const gss_OID_set mechs);
472 gssEapOidToSaslName(const gss_OID oid);
475 gssEapSaslNameToOid(const gss_buffer_t name);
478 #define EXPORT_NAME_FLAG_OID 0x1
479 #define EXPORT_NAME_FLAG_COMPOSITE 0x2
480 #define EXPORT_NAME_FLAG_ALLOW_COMPOSITE 0x4
482 OM_uint32 gssEapAllocName(OM_uint32 *minor, gss_name_t *pName);
483 OM_uint32 gssEapReleaseName(OM_uint32 *minor, gss_name_t *pName);
484 OM_uint32 gssEapExportName(OM_uint32 *minor,
485 const gss_name_t name,
486 gss_buffer_t exportedName);
487 OM_uint32 gssEapExportNameInternal(OM_uint32 *minor,
488 const gss_name_t name,
489 gss_buffer_t exportedName,
491 OM_uint32 gssEapImportName(OM_uint32 *minor,
492 const gss_buffer_t input_name_buffer,
493 const gss_OID input_name_type,
494 const gss_OID input_mech_type,
495 gss_name_t *output_name);
496 OM_uint32 gssEapImportNameInternal(OM_uint32 *minor,
497 const gss_buffer_t input_name_buffer,
498 gss_name_t *output_name,
501 gssEapDuplicateName(OM_uint32 *minor,
502 const gss_name_t input_name,
503 gss_name_t *dest_name);
506 gssEapCanonicalizeName(OM_uint32 *minor,
507 const gss_name_t input_name,
508 const gss_OID mech_type,
509 gss_name_t *dest_name);
512 gssEapDisplayName(OM_uint32 *minor,
514 gss_buffer_t output_name_buffer,
515 gss_OID *output_name_type);
518 gssEapCompareName(OM_uint32 *minor,
525 composeOid(OM_uint32 *minor_status,
532 decomposeOid(OM_uint32 *minor_status,
539 duplicateOid(OM_uint32 *minor_status,
540 const gss_OID_desc * const oid,
544 duplicateOidSet(OM_uint32 *minor,
545 const gss_OID_set src,
549 oidEqual(const gss_OID_desc *o1, const gss_OID_desc *o2)
551 if (o1 == GSS_C_NO_OID)
552 return (o2 == GSS_C_NO_OID);
553 else if (o2 == GSS_C_NO_OID)
554 return (o1 == GSS_C_NO_OID);
556 return (o1->length == o2->length &&
557 memcmp(o1->elements, o2->elements, o1->length) == 0);
560 /* util_ordering.c */
562 sequenceInternalize(OM_uint32 *minor,
568 sequenceExternalize(OM_uint32 *minor,
574 sequenceSize(void *vqueue);
577 sequenceFree(OM_uint32 *minor, void **vqueue);
580 sequenceCheck(OM_uint32 *minor, void **vqueue, uint64_t seqnum);
583 sequenceInit(OM_uint32 *minor, void **vqueue, uint64_t seqnum,
584 int do_replay, int do_sequence, int wide_nums);
588 GSSEAP_STATE_INITIAL = 0x01, /* initial state */
589 GSSEAP_STATE_AUTHENTICATE = 0x02, /* exchange EAP messages */
590 GSSEAP_STATE_INITIATOR_EXTS = 0x04, /* initiator extensions */
591 GSSEAP_STATE_ACCEPTOR_EXTS = 0x08, /* acceptor extensions */
592 #ifdef GSSEAP_ENABLE_REAUTH
593 GSSEAP_STATE_REAUTHENTICATE = 0x10, /* GSS reauthentication messages */
595 GSSEAP_STATE_ESTABLISHED = 0x20, /* context established */
596 GSSEAP_STATE_ALL = 0x3F
599 #define GSSEAP_STATE_NEXT(s) ((s) << 1)
601 #define GSSEAP_SM_STATE(ctx) ((ctx)->state)
604 void gssEapSmTransition(gss_ctx_id_t ctx, enum gss_eap_state state);
605 #define GSSEAP_SM_TRANSITION(ctx, state) gssEapSmTransition((ctx), (state))
607 #define GSSEAP_SM_TRANSITION(ctx, newstate) do { (ctx)->state = (newstate); } while (0)
610 #define GSSEAP_SM_TRANSITION_NEXT(ctx) GSSEAP_SM_TRANSITION((ctx), GSSEAP_STATE_NEXT(GSSEAP_SM_STATE((ctx))))
612 /* state machine entry */
614 OM_uint32 inputTokenType;
615 OM_uint32 outputTokenType;
616 enum gss_eap_state validStates;
618 OM_uint32 (*processToken)(OM_uint32 *,
625 gss_channel_bindings_t,
631 /* state machine flags, set by handler */
632 #define SM_FLAG_FORCE_SEND_TOKEN 0x00000001 /* send token even if no inner tokens */
633 #define SM_FLAG_OUTPUT_TOKEN_CRITICAL 0x00000002 /* output token is critical */
635 /* state machine flags, set by state machine */
636 #define SM_FLAG_INPUT_TOKEN_CRITICAL 0x10000000 /* input token was critical */
638 #define SM_ITOK_FLAG_REQUIRED 0x00000001 /* received tokens must be present */
641 gssEapSmStep(OM_uint32 *minor,
648 gss_channel_bindings_t chanBindings,
649 gss_buffer_t inputToken,
650 gss_buffer_t outputToken,
651 struct gss_eap_sm *sm,
655 gssEapSmTransition(gss_ctx_id_t ctx, enum gss_eap_state state);
659 gssEapEncodeInnerTokens(OM_uint32 *minor,
660 gss_buffer_set_t extensions,
662 gss_buffer_t buffer);
664 gssEapDecodeInnerTokens(OM_uint32 *minor,
665 const gss_buffer_t buffer,
666 gss_buffer_set_t *pExtensions,
670 tokenSize(const gss_OID_desc *mech, size_t body_size);
673 makeTokenHeader(const gss_OID_desc *mech,
676 enum gss_eap_token_type tok_type);
679 verifyTokenHeader(OM_uint32 *minor,
682 unsigned char **buf_in,
684 enum gss_eap_token_type *ret_tok_type);
688 #define GSSEAP_CALLOC calloc
689 #define GSSEAP_MALLOC malloc
690 #define GSSEAP_FREE free
691 #define GSSEAP_REALLOC realloc
693 #define GSSEAP_NOT_IMPLEMENTED do { \
694 assert(0 && "not implemented"); \
696 return GSS_S_FAILURE; \
701 #define GSSEAP_MUTEX pthread_mutex_t
702 #define GSSEAP_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
704 #define GSSEAP_MUTEX_INIT(m) pthread_mutex_init((m), NULL)
705 #define GSSEAP_MUTEX_DESTROY(m) pthread_mutex_destroy((m))
706 #define GSSEAP_MUTEX_LOCK(m) pthread_mutex_lock((m))
707 #define GSSEAP_MUTEX_UNLOCK(m) pthread_mutex_unlock((m))
709 #define GSSEAP_THREAD_KEY pthread_key_t
710 #define GSSEAP_KEY_CREATE(k, d) pthread_key_create((k), (d))
711 #define GSSEAP_GETSPECIFIC(k) pthread_getspecific((k))
712 #define GSSEAP_SETSPECIFIC(k, d) pthread_setspecific((k), (d))
714 #define GSSEAP_THREAD_ONCE pthread_once_t
715 #define GSSEAP_ONCE(o, i) pthread_once((o), (i))
716 #define GSSEAP_ONCE_INITIALIZER PTHREAD_ONCE_INIT
718 /* Helper functions */
720 store_uint16_be(uint16_t val, void *vp)
722 unsigned char *p = (unsigned char *)vp;
724 p[0] = (val >> 8) & 0xff;
725 p[1] = (val ) & 0xff;
728 static inline uint16_t
729 load_uint16_be(const void *cvp)
731 const unsigned char *p = (const unsigned char *)cvp;
733 return (p[1] | (p[0] << 8));
737 store_uint32_be(uint32_t val, void *vp)
739 unsigned char *p = (unsigned char *)vp;
741 p[0] = (val >> 24) & 0xff;
742 p[1] = (val >> 16) & 0xff;
743 p[2] = (val >> 8) & 0xff;
744 p[3] = (val ) & 0xff;
747 static inline uint32_t
748 load_uint32_be(const void *cvp)
750 const unsigned char *p = (const unsigned char *)cvp;
752 return (p[3] | (p[2] << 8)
753 | ((uint32_t) p[1] << 16)
754 | ((uint32_t) p[0] << 24));
758 store_uint64_be(uint64_t val, void *vp)
760 unsigned char *p = (unsigned char *)vp;
762 p[0] = (unsigned char)((val >> 56) & 0xff);
763 p[1] = (unsigned char)((val >> 48) & 0xff);
764 p[2] = (unsigned char)((val >> 40) & 0xff);
765 p[3] = (unsigned char)((val >> 32) & 0xff);
766 p[4] = (unsigned char)((val >> 24) & 0xff);
767 p[5] = (unsigned char)((val >> 16) & 0xff);
768 p[6] = (unsigned char)((val >> 8) & 0xff);
769 p[7] = (unsigned char)((val ) & 0xff);
772 static inline uint64_t
773 load_uint64_be(const void *cvp)
775 const unsigned char *p = (const unsigned char *)cvp;
777 return ((uint64_t)load_uint32_be(p) << 32) | load_uint32_be(p + 4);
780 static inline unsigned char *
781 store_buffer(gss_buffer_t buffer, void *vp, int wide_nums)
783 unsigned char *p = (unsigned char *)vp;
786 store_uint64_be(buffer->length, p);
789 store_uint32_be(buffer->length, p);
793 if (buffer->value != NULL) {
794 memcpy(p, buffer->value, buffer->length);
801 static inline unsigned char *
802 load_buffer(const void *cvp, size_t length, gss_buffer_t buffer)
805 buffer->value = GSSEAP_MALLOC(length);
806 if (buffer->value == NULL)
808 buffer->length = length;
809 memcpy(buffer->value, cvp, length);
810 return (unsigned char *)cvp + length;
813 static inline unsigned char *
814 store_oid(gss_OID oid, void *vp)
818 if (oid != GSS_C_NO_OID) {
819 buf.length = oid->length;
820 buf.value = oid->elements;
826 return store_buffer(&buf, vp, FALSE);
830 krbDataToGssBuffer(krb5_data *data, gss_buffer_t buffer)
832 buffer->value = (void *)data->data;
833 buffer->length = data->length;
837 krbPrincComponentToGssBuffer(krb5_principal krbPrinc,
838 int index, gss_buffer_t buffer)
840 #ifdef HAVE_HEIMDAL_VERSION
841 buffer->value = (void *)KRB_PRINC_NAME(krbPrinc)[index];
842 buffer->length = strlen((char *)buffer->value);
844 buffer->value = (void *)krb5_princ_component(NULL, krbPrinc, index)->data;
845 buffer->length = krb5_princ_component(NULL, krbPrinc, index)->length;
846 #endif /* HAVE_HEIMDAL_VERSION */
850 krbPrincRealmToGssBuffer(krb5_principal krbPrinc, gss_buffer_t buffer)
852 #ifdef HAVE_HEIMDAL_VERSION
853 buffer->value = (void *)KRB_PRINC_REALM(krbPrinc);
854 buffer->length = strlen((char *)buffer->value);
856 krbDataToGssBuffer(KRB_PRINC_REALM(krbPrinc), buffer);
861 gssBufferToKrbData(gss_buffer_t buffer, krb5_data *data)
863 data->data = (char *)buffer->value;
864 data->length = buffer->length;
871 #ifdef GSSEAP_ENABLE_ACCEPTOR
872 #include "util_json.h"
873 #include "util_attr.h"
875 #include "util_base64.h"
876 #ifdef GSSEAP_ENABLE_REAUTH
877 #include "util_reauth.h"
880 #endif /* _UTIL_H_ */