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.
65 #include <sys/param.h>
73 #define INLINE __inline
74 typedef unsigned __int16 uint16_t;
75 typedef unsigned __int32 uint32_t;
85 #define MIN(_a,_b) ((_a)<(_b)?(_a):(_b))
88 #if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
89 #define GSSEAP_UNUSED __attribute__ ((__unused__))
96 makeStringBuffer(OM_uint32 *minor,
101 bufferToString(OM_uint32 *minor,
102 const gss_buffer_t buffer,
106 duplicateBuffer(OM_uint32 *minor,
107 const gss_buffer_t src,
111 bufferEqual(const gss_buffer_t b1, const gss_buffer_t b2)
113 return (b1->length == b2->length &&
114 memcmp(b1->value, b2->value, b2->length) == 0);
118 bufferEqualString(const gss_buffer_t b1, const char *s)
122 b2.length = strlen(s);
123 b2.value = (char *)s;
125 return bufferEqual(b1, &b2);
130 gssEapSign(krb5_context context,
133 #ifdef HAVE_HEIMDAL_VERSION
138 krb5_keyusage sign_usage,
139 gss_iov_buffer_desc *iov,
143 gssEapVerify(krb5_context context,
146 #ifdef HAVE_HEIMDAL_VERSION
151 krb5_keyusage sign_usage,
152 gss_iov_buffer_desc *iov,
158 gssEapEncodeGssChannelBindings(OM_uint32 *minor,
159 gss_channel_bindings_t chanBindings,
160 gss_buffer_t encodedBindings);
164 #define EAP_EXPORT_CONTEXT_V1 1
166 enum gss_eap_token_type {
167 TOK_TYPE_NONE = 0x0000, /* no token */
168 TOK_TYPE_MIC = 0x0404, /* RFC 4121 MIC token */
169 TOK_TYPE_WRAP = 0x0504, /* RFC 4121 wrap token */
170 TOK_TYPE_EXPORT_NAME = 0x0401, /* RFC 2743 exported name */
171 TOK_TYPE_EXPORT_NAME_COMPOSITE = 0x0402, /* exported composite name */
172 TOK_TYPE_DELETE_CONTEXT = 0x0405, /* RFC 2743 delete context */
173 TOK_TYPE_INITIATOR_CONTEXT = 0x0601, /* initiator-sent context token */
174 TOK_TYPE_ACCEPTOR_CONTEXT = 0x0602, /* acceptor-sent context token */
177 /* inner token types and flags */
178 #define ITOK_TYPE_NONE 0x00000000
179 #define ITOK_TYPE_CONTEXT_ERR 0x00000001 /* critical */
180 #define ITOK_TYPE_ACCEPTOR_NAME_REQ 0x00000002 /* TBD */
181 #define ITOK_TYPE_ACCEPTOR_NAME_RESP 0x00000003 /* TBD */
182 #define ITOK_TYPE_EAP_RESP 0x00000004 /* critical, required, if not reauth */
183 #define ITOK_TYPE_EAP_REQ 0x00000005 /* critical, required, if not reauth */
184 #define ITOK_TYPE_GSS_CHANNEL_BINDINGS 0x00000006 /* critical, required, if not reauth */
185 #define ITOK_TYPE_REAUTH_CREDS 0x00000007 /* optional */
186 #define ITOK_TYPE_REAUTH_REQ 0x00000008 /* optional */
187 #define ITOK_TYPE_REAUTH_RESP 0x00000009 /* optional */
188 #define ITOK_TYPE_VERSION_INFO 0x0000000A /* optional */
189 #define ITOK_TYPE_VENDOR_INFO 0x0000000B /* optional */
191 #define ITOK_FLAG_CRITICAL 0x80000000 /* critical, wire flag */
192 #define ITOK_FLAG_VERIFIED 0x40000000 /* verified, API flag */
194 #define ITOK_TYPE_MASK (~(ITOK_FLAG_CRITICAL | ITOK_FLAG_VERIFIED))
196 OM_uint32 gssEapAllocContext(OM_uint32 *minor, gss_ctx_id_t *pCtx);
197 OM_uint32 gssEapReleaseContext(OM_uint32 *minor, gss_ctx_id_t *pCtx);
200 gssEapMakeToken(OM_uint32 *minor,
202 const gss_buffer_t innerToken,
203 enum gss_eap_token_type tokenType,
204 gss_buffer_t outputToken);
207 gssEapVerifyToken(OM_uint32 *minor,
209 const gss_buffer_t inputToken,
210 enum gss_eap_token_type *tokenType,
211 gss_buffer_t innerInputToken);
214 gssEapContextTime(OM_uint32 *minor,
215 gss_ctx_id_t context_handle,
216 OM_uint32 *time_rec);
219 OM_uint32 gssEapAllocCred(OM_uint32 *minor, gss_cred_id_t *pCred);
220 OM_uint32 gssEapReleaseCred(OM_uint32 *minor, gss_cred_id_t *pCred);
223 gssEapAcquireCred(OM_uint32 *minor,
224 const gss_name_t desiredName,
225 const gss_buffer_t password,
227 const gss_OID_set desiredMechs,
229 gss_cred_id_t *pCred,
230 gss_OID_set *pActualMechs,
233 int gssEapCredAvailable(gss_cred_id_t cred, gss_OID mech);
236 gssEapInquireCred(OM_uint32 *minor,
239 OM_uint32 *pLifetime,
240 gss_cred_usage_t *cred_usage,
241 gss_OID_set *mechanisms);
245 gssEapEncrypt(krb5_context context, int dce_style, size_t ec,
247 #ifdef HAVE_HEIMDAL_VERSION
253 gss_iov_buffer_desc *iov, int iov_count);
256 gssEapDecrypt(krb5_context context, int dce_style, size_t ec,
258 #ifdef HAVE_HEIMDAL_VERSION
264 gss_iov_buffer_desc *iov, int iov_count);
267 gssEapMapCryptoFlag(OM_uint32 type);
270 gssEapLocateIov(gss_iov_buffer_desc *iov,
275 gssEapIovMessageLength(gss_iov_buffer_desc *iov,
278 size_t *assoc_data_length);
281 gssEapReleaseIov(gss_iov_buffer_desc *iov, int iov_count);
284 gssEapIsIntegrityOnly(gss_iov_buffer_desc *iov, int iov_count);
287 gssEapAllocIov(gss_iov_buffer_t iov, size_t size);
290 gssEapDeriveRfc3961Key(OM_uint32 *minor,
291 const unsigned char *key,
293 krb5_enctype enctype,
294 krb5_keyblock *pKey);
297 #ifdef HAVE_HEIMDAL_VERSION
299 #define KRB_TIME_FOREVER ((time_t)~0L)
301 #define KRB_KEY_TYPE(key) ((key)->keytype)
302 #define KRB_KEY_DATA(key) ((key)->keyvalue.data)
303 #define KRB_KEY_LENGTH(key) ((key)->keyvalue.length)
305 #define KRB_PRINC_LENGTH(princ) ((princ)->name.name_string.len)
306 #define KRB_PRINC_TYPE(princ) ((princ)->name.name_type)
307 #define KRB_PRINC_NAME(princ) ((princ)->name.name_string.val)
308 #define KRB_PRINC_REALM(princ) ((princ)->realm)
310 #define KRB_KT_ENT_KEYBLOCK(e) (&(e)->keyblock)
311 #define KRB_KT_ENT_FREE(c, e) krb5_kt_free_entry((c), (e))
313 #define KRB_CRYPTO_CONTEXT(ctx) (krbCrypto)
317 #define KRB_TIME_FOREVER KRB5_INT32_MAX
319 #define KRB_KEY_TYPE(key) ((key)->enctype)
320 #define KRB_KEY_DATA(key) ((key)->contents)
321 #define KRB_KEY_LENGTH(key) ((key)->length)
323 #define KRB_PRINC_LENGTH(princ) (krb5_princ_size(NULL, (princ)))
324 #define KRB_PRINC_TYPE(princ) (krb5_princ_type(NULL, (princ)))
325 #define KRB_PRINC_NAME(princ) (krb5_princ_name(NULL, (princ)))
326 #define KRB_PRINC_REALM(princ) (krb5_princ_realm(NULL, (princ)))
328 #define KRB_KT_ENT_KEYBLOCK(e) (&(e)->key)
329 #define KRB_KT_ENT_FREE(c, e) krb5_free_keytab_entry_contents((c), (e))
331 #define KRB_CRYPTO_CONTEXT(ctx) (&(ctx)->rfc3961Key)
333 #endif /* HAVE_HEIMDAL_VERSION */
335 #define KRB_KEY_INIT(key) do { \
336 KRB_KEY_TYPE(key) = ENCTYPE_NULL; \
337 KRB_KEY_DATA(key) = NULL; \
338 KRB_KEY_LENGTH(key) = 0; \
341 #define GSSEAP_KRB_INIT(ctx) do { \
342 OM_uint32 tmpMajor; \
344 tmpMajor = gssEapKerberosInit(minor, ctx); \
345 if (GSS_ERROR(tmpMajor)) { \
351 gssEapKerberosInit(OM_uint32 *minor, krb5_context *context);
354 rfc3961ChecksumTypeForKey(OM_uint32 *minor,
356 krb5_cksumtype *cksumtype);
359 krbCryptoLength(krb5_context krbContext,
360 #ifdef HAVE_HEIMDAL_VERSION
361 krb5_crypto krbCrypto,
369 krbPaddingLength(krb5_context krbContext,
370 #ifdef HAVE_HEIMDAL_VERSION
371 krb5_crypto krbCrypto,
379 krbBlockSize(krb5_context krbContext,
380 #ifdef HAVE_HEIMDAL_VERSION
381 krb5_crypto krbCrypto,
388 krbEnctypeToString(krb5_context krbContext,
389 krb5_enctype enctype,
391 gss_buffer_t string);
394 krbMakeAuthDataKdcIssued(krb5_context context,
395 const krb5_keyblock *key,
396 krb5_const_principal issuer,
397 #ifdef HAVE_HEIMDAL_VERSION
398 const AuthorizationData *authdata,
399 AuthorizationData *adKdcIssued
401 krb5_authdata *const *authdata,
402 krb5_authdata ***adKdcIssued
407 krbMakeCred(krb5_context context,
408 krb5_auth_context authcontext,
414 gssEapExportLucidSecContext(OM_uint32 *minor,
416 const gss_OID desiredObject,
417 gss_buffer_set_t *data_set);
420 extern gss_OID GSS_EAP_MECHANISM;
422 #define OID_FLAG_NULL_VALID 0x00000001
423 #define OID_FLAG_FAMILY_MECH_VALID 0x00000002
424 #define OID_FLAG_MAP_NULL_TO_DEFAULT_MECH 0x00000004
425 #define OID_FLAG_MAP_FAMILY_MECH_TO_NULL 0x00000008
428 gssEapCanonicalizeOid(OM_uint32 *minor,
434 gssEapReleaseOid(OM_uint32 *minor, gss_OID *oid);
437 gssEapDefaultMech(OM_uint32 *minor,
441 gssEapIndicateMechs(OM_uint32 *minor,
445 gssEapEnctypeToOid(OM_uint32 *minor,
446 krb5_enctype enctype,
450 gssEapOidToEnctype(OM_uint32 *minor,
452 krb5_enctype *enctype);
455 gssEapIsMechanismOid(const gss_OID oid);
458 gssEapIsConcreteMechanismOid(const gss_OID oid);
461 gssEapValidateMechs(OM_uint32 *minor,
462 const gss_OID_set mechs);
465 gssEapOidToSaslName(const gss_OID oid);
468 gssEapSaslNameToOid(const gss_buffer_t name);
471 #define EXPORT_NAME_FLAG_OID 0x1
472 #define EXPORT_NAME_FLAG_COMPOSITE 0x2
473 #define EXPORT_NAME_FLAG_ALLOW_COMPOSITE 0x4
475 OM_uint32 gssEapAllocName(OM_uint32 *minor, gss_name_t *pName);
476 OM_uint32 gssEapReleaseName(OM_uint32 *minor, gss_name_t *pName);
477 OM_uint32 gssEapExportName(OM_uint32 *minor,
478 const gss_name_t name,
479 gss_buffer_t exportedName);
480 OM_uint32 gssEapExportNameInternal(OM_uint32 *minor,
481 const gss_name_t name,
482 gss_buffer_t exportedName,
484 OM_uint32 gssEapImportName(OM_uint32 *minor,
485 const gss_buffer_t input_name_buffer,
486 const gss_OID input_name_type,
487 const gss_OID input_mech_type,
488 gss_name_t *output_name);
489 OM_uint32 gssEapImportNameInternal(OM_uint32 *minor,
490 const gss_buffer_t input_name_buffer,
491 gss_name_t *output_name,
494 gssEapDuplicateName(OM_uint32 *minor,
495 const gss_name_t input_name,
496 gss_name_t *dest_name);
499 gssEapCanonicalizeName(OM_uint32 *minor,
500 const gss_name_t input_name,
501 const gss_OID mech_type,
502 gss_name_t *dest_name);
505 gssEapDisplayName(OM_uint32 *minor,
507 gss_buffer_t output_name_buffer,
508 gss_OID *output_name_type);
511 gssEapCompareName(OM_uint32 *minor,
518 composeOid(OM_uint32 *minor_status,
525 decomposeOid(OM_uint32 *minor_status,
532 duplicateOid(OM_uint32 *minor_status,
533 const gss_OID_desc * const oid,
537 duplicateOidSet(OM_uint32 *minor,
538 const gss_OID_set src,
542 oidEqual(const gss_OID_desc *o1, const gss_OID_desc *o2)
544 if (o1 == GSS_C_NO_OID)
545 return (o2 == GSS_C_NO_OID);
546 else if (o2 == GSS_C_NO_OID)
547 return (o1 == GSS_C_NO_OID);
549 return (o1->length == o2->length &&
550 memcmp(o1->elements, o2->elements, o1->length) == 0);
553 /* util_ordering.c */
555 sequenceInternalize(OM_uint32 *minor,
561 sequenceExternalize(OM_uint32 *minor,
567 sequenceSize(void *vqueue);
570 sequenceFree(OM_uint32 *minor, void **vqueue);
573 sequenceCheck(OM_uint32 *minor, void **vqueue, uint64_t seqnum);
576 sequenceInit(OM_uint32 *minor, void **vqueue, uint64_t seqnum,
577 int do_replay, int do_sequence, int wide_nums);
581 GSSEAP_STATE_INITIAL = 0x01, /* initial state */
582 GSSEAP_STATE_AUTHENTICATE = 0x02, /* exchange EAP messages */
583 GSSEAP_STATE_INITIATOR_EXTS = 0x04, /* initiator extensions */
584 GSSEAP_STATE_ACCEPTOR_EXTS = 0x08, /* acceptor extensions */
585 #ifdef GSSEAP_ENABLE_REAUTH
586 GSSEAP_STATE_REAUTHENTICATE = 0x10, /* GSS reauthentication messages */
588 GSSEAP_STATE_ESTABLISHED = 0x20, /* context established */
589 GSSEAP_STATE_ALL = 0x3F
592 #define GSSEAP_STATE_NEXT(s) ((s) << 1)
594 #define GSSEAP_SM_STATE(ctx) ((ctx)->state)
597 void gssEapSmTransition(gss_ctx_id_t ctx, enum gss_eap_state state);
598 #define GSSEAP_SM_TRANSITION(ctx, state) gssEapSmTransition((ctx), (state))
600 #define GSSEAP_SM_TRANSITION(ctx, newstate) do { (ctx)->state = (newstate); } while (0)
603 #define GSSEAP_SM_TRANSITION_NEXT(ctx) GSSEAP_SM_TRANSITION((ctx), GSSEAP_STATE_NEXT(GSSEAP_SM_STATE((ctx))))
605 /* state machine entry */
607 OM_uint32 inputTokenType;
608 OM_uint32 outputTokenType;
609 enum gss_eap_state validStates;
611 OM_uint32 (*processToken)(OM_uint32 *,
618 gss_channel_bindings_t,
624 /* state machine flags, set by handler */
625 #define SM_FLAG_FORCE_SEND_TOKEN 0x00000001 /* send token even if no inner tokens */
626 #define SM_FLAG_OUTPUT_TOKEN_CRITICAL 0x00000002 /* output token is critical */
628 /* state machine flags, set by state machine */
629 #define SM_FLAG_INPUT_TOKEN_CRITICAL 0x10000000 /* input token was critical */
631 #define SM_ITOK_FLAG_REQUIRED 0x00000001 /* received tokens must be present */
634 gssEapSmStep(OM_uint32 *minor,
641 gss_channel_bindings_t chanBindings,
642 gss_buffer_t inputToken,
643 gss_buffer_t outputToken,
644 struct gss_eap_sm *sm,
648 gssEapSmTransition(gss_ctx_id_t ctx, enum gss_eap_state state);
652 gssEapEncodeInnerTokens(OM_uint32 *minor,
653 gss_buffer_set_t extensions,
655 gss_buffer_t buffer);
657 gssEapDecodeInnerTokens(OM_uint32 *minor,
658 const gss_buffer_t buffer,
659 gss_buffer_set_t *pExtensions,
663 tokenSize(const gss_OID_desc *mech, size_t body_size);
666 makeTokenHeader(const gss_OID_desc *mech,
669 enum gss_eap_token_type tok_type);
672 verifyTokenHeader(OM_uint32 *minor,
675 unsigned char **buf_in,
677 enum gss_eap_token_type *ret_tok_type);
681 #define GSSEAP_CALLOC calloc
682 #define GSSEAP_MALLOC malloc
683 #define GSSEAP_FREE free
684 #define GSSEAP_REALLOC realloc
686 #define GSSEAP_NOT_IMPLEMENTED do { \
687 assert(0 && "not implemented"); \
689 return GSS_S_FAILURE; \
694 #define GSSEAP_MUTEX pthread_mutex_t
695 #define GSSEAP_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
697 #define GSSEAP_MUTEX_INIT(m) pthread_mutex_init((m), NULL)
698 #define GSSEAP_MUTEX_DESTROY(m) pthread_mutex_destroy((m))
699 #define GSSEAP_MUTEX_LOCK(m) pthread_mutex_lock((m))
700 #define GSSEAP_MUTEX_UNLOCK(m) pthread_mutex_unlock((m))
702 #define GSSEAP_THREAD_KEY pthread_key_t
703 #define GSSEAP_KEY_CREATE(k, d) pthread_key_create((k), (d))
704 #define GSSEAP_GETSPECIFIC(k) pthread_getspecific((k))
705 #define GSSEAP_SETSPECIFIC(k, d) pthread_setspecific((k), (d))
707 #define GSSEAP_THREAD_ONCE pthread_once_t
708 #define GSSEAP_ONCE(o, i) pthread_once((o), (i))
709 #define GSSEAP_ONCE_INITIALIZER PTHREAD_ONCE_INIT
711 /* Helper functions */
713 store_uint16_be(uint16_t val, void *vp)
715 unsigned char *p = (unsigned char *)vp;
717 p[0] = (val >> 8) & 0xff;
718 p[1] = (val ) & 0xff;
721 static INLINE uint16_t
722 load_uint16_be(const void *cvp)
724 const unsigned char *p = (const unsigned char *)cvp;
726 return (p[1] | (p[0] << 8));
730 store_uint32_be(uint32_t val, void *vp)
732 unsigned char *p = (unsigned char *)vp;
734 p[0] = (val >> 24) & 0xff;
735 p[1] = (val >> 16) & 0xff;
736 p[2] = (val >> 8) & 0xff;
737 p[3] = (val ) & 0xff;
740 static INLINE uint32_t
741 load_uint32_be(const void *cvp)
743 const unsigned char *p = (const unsigned char *)cvp;
745 return (p[3] | (p[2] << 8)
746 | ((uint32_t) p[1] << 16)
747 | ((uint32_t) p[0] << 24));
751 store_uint64_be(uint64_t val, void *vp)
753 unsigned char *p = (unsigned char *)vp;
755 p[0] = (unsigned char)((val >> 56) & 0xff);
756 p[1] = (unsigned char)((val >> 48) & 0xff);
757 p[2] = (unsigned char)((val >> 40) & 0xff);
758 p[3] = (unsigned char)((val >> 32) & 0xff);
759 p[4] = (unsigned char)((val >> 24) & 0xff);
760 p[5] = (unsigned char)((val >> 16) & 0xff);
761 p[6] = (unsigned char)((val >> 8) & 0xff);
762 p[7] = (unsigned char)((val ) & 0xff);
765 static INLINE uint64_t
766 load_uint64_be(const void *cvp)
768 const unsigned char *p = (const unsigned char *)cvp;
770 return ((uint64_t)load_uint32_be(p) << 32) | load_uint32_be(p + 4);
773 static INLINE unsigned char *
774 store_buffer(gss_buffer_t buffer, void *vp, int wide_nums)
776 unsigned char *p = (unsigned char *)vp;
779 store_uint64_be(buffer->length, p);
782 store_uint32_be(buffer->length, p);
786 if (buffer->value != NULL) {
787 memcpy(p, buffer->value, buffer->length);
794 static INLINE unsigned char *
795 load_buffer(const void *cvp, size_t length, gss_buffer_t buffer)
798 buffer->value = GSSEAP_MALLOC(length);
799 if (buffer->value == NULL)
801 buffer->length = length;
802 memcpy(buffer->value, cvp, length);
803 return (unsigned char *)cvp + length;
806 static INLINE unsigned char *
807 store_oid(gss_OID oid, void *vp)
811 if (oid != GSS_C_NO_OID) {
812 buf.length = oid->length;
813 buf.value = oid->elements;
819 return store_buffer(&buf, vp, FALSE);
823 krbDataToGssBuffer(krb5_data *data, gss_buffer_t buffer)
825 buffer->value = (void *)data->data;
826 buffer->length = data->length;
830 krbPrincComponentToGssBuffer(krb5_principal krbPrinc,
831 int index, gss_buffer_t buffer)
833 #ifdef HAVE_HEIMDAL_VERSION
834 buffer->value = (void *)KRB_PRINC_NAME(krbPrinc)[index];
835 buffer->length = strlen((char *)buffer->value);
837 buffer->value = (void *)krb5_princ_component(NULL, krbPrinc, index)->data;
838 buffer->length = krb5_princ_component(NULL, krbPrinc, index)->length;
839 #endif /* HAVE_HEIMDAL_VERSION */
843 krbPrincRealmToGssBuffer(krb5_principal krbPrinc, gss_buffer_t buffer)
845 #ifdef HAVE_HEIMDAL_VERSION
846 buffer->value = (void *)KRB_PRINC_REALM(krbPrinc);
847 buffer->length = strlen((char *)buffer->value);
849 krbDataToGssBuffer(KRB_PRINC_REALM(krbPrinc), buffer);
854 gssBufferToKrbData(gss_buffer_t buffer, krb5_data *data)
856 data->data = (char *)buffer->value;
857 data->length = buffer->length;
864 #ifdef GSSEAP_ENABLE_ACCEPTOR
865 #include "util_json.h"
866 #include "util_attr.h"
868 #include "util_base64.h"
869 #ifdef GSSEAP_ENABLE_REAUTH
870 #include "util_reauth.h"
873 #endif /* _UTIL_H_ */