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 #include <sys/param.h>
75 #define MIN(_a,_b) ((_a)<(_b)?(_a):(_b))
78 #if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
79 #define GSSEAP_UNUSED __attribute__ ((__unused__))
86 makeStringBuffer(OM_uint32 *minor,
91 bufferToString(OM_uint32 *minor,
92 const gss_buffer_t buffer,
96 duplicateBuffer(OM_uint32 *minor,
97 const gss_buffer_t src,
101 bufferEqual(const gss_buffer_t b1, const gss_buffer_t b2)
103 return (b1->length == b2->length &&
104 memcmp(b1->value, b2->value, b2->length) == 0);
108 bufferEqualString(const gss_buffer_t b1, const char *s)
112 b2.length = strlen(s);
113 b2.value = (char *)s;
115 return bufferEqual(b1, &b2);
120 gssEapSign(krb5_context context,
123 #ifdef HAVE_HEIMDAL_VERSION
128 krb5_keyusage sign_usage,
129 gss_iov_buffer_desc *iov,
133 gssEapVerify(krb5_context context,
136 #ifdef HAVE_HEIMDAL_VERSION
141 krb5_keyusage sign_usage,
142 gss_iov_buffer_desc *iov,
148 gssEapEncodeGssChannelBindings(OM_uint32 *minor,
149 gss_channel_bindings_t chanBindings,
150 gss_buffer_t encodedBindings);
154 #define EAP_EXPORT_CONTEXT_V1 1
156 enum gss_eap_token_type {
157 TOK_TYPE_NONE = 0x0000, /* no token */
158 TOK_TYPE_MIC = 0x0404, /* RFC 4121 MIC token */
159 TOK_TYPE_WRAP = 0x0504, /* RFC 4121 wrap token */
160 TOK_TYPE_EXPORT_NAME = 0x0401, /* RFC 2743 exported name */
161 TOK_TYPE_EXPORT_NAME_COMPOSITE = 0x0402, /* exported composite name */
162 TOK_TYPE_DELETE_CONTEXT = 0x0405, /* RFC 2743 delete context */
163 TOK_TYPE_INITIATOR_CONTEXT = 0x0601, /* initiator-sent context token */
164 TOK_TYPE_ACCEPTOR_CONTEXT = 0x0602, /* acceptor-sent context token */
167 /* inner token types and flags */
168 #define ITOK_TYPE_NONE 0x00000000
169 #define ITOK_TYPE_CONTEXT_ERR 0x00000001 /* critical */
170 #define ITOK_TYPE_ACCEPTOR_NAME_REQ 0x00000002 /* TBD */
171 #define ITOK_TYPE_ACCEPTOR_NAME_RESP 0x00000003 /* TBD */
172 #define ITOK_TYPE_EAP_RESP 0x00000004 /* critical, required, if not reauth */
173 #define ITOK_TYPE_EAP_REQ 0x00000005 /* critical, required, if not reauth */
174 #define ITOK_TYPE_GSS_CHANNEL_BINDINGS 0x00000006 /* critical, required, if not reauth */
175 #define ITOK_TYPE_REAUTH_CREDS 0x00000007 /* optional */
176 #define ITOK_TYPE_REAUTH_REQ 0x00000008 /* optional */
177 #define ITOK_TYPE_REAUTH_RESP 0x00000009 /* optional */
178 #define ITOK_TYPE_VERSION_INFO 0x0000000A /* optional */
179 #define ITOK_TYPE_VENDOR_INFO 0x0000000B /* optional */
181 #define ITOK_FLAG_CRITICAL 0x80000000 /* critical, wire flag */
182 #define ITOK_FLAG_VERIFIED 0x40000000 /* verified, API flag */
184 #define ITOK_TYPE_MASK (~(ITOK_FLAG_CRITICAL | ITOK_FLAG_VERIFIED))
186 OM_uint32 gssEapAllocContext(OM_uint32 *minor, gss_ctx_id_t *pCtx);
187 OM_uint32 gssEapReleaseContext(OM_uint32 *minor, gss_ctx_id_t *pCtx);
190 gssEapMakeToken(OM_uint32 *minor,
192 const gss_buffer_t innerToken,
193 enum gss_eap_token_type tokenType,
194 gss_buffer_t outputToken);
197 gssEapVerifyToken(OM_uint32 *minor,
199 const gss_buffer_t inputToken,
200 enum gss_eap_token_type *tokenType,
201 gss_buffer_t innerInputToken);
204 gssEapContextTime(OM_uint32 *minor,
205 gss_ctx_id_t context_handle,
206 OM_uint32 *time_rec);
209 extern const gss_OID_desc gssEapPasswordCredType;
211 OM_uint32 gssEapAllocCred(OM_uint32 *minor, gss_cred_id_t *pCred);
212 OM_uint32 gssEapReleaseCred(OM_uint32 *minor, gss_cred_id_t *pCred);
215 gssEapAcquireCred(OM_uint32 *minor,
216 const gss_name_t desiredName,
217 gss_const_OID credType,
218 const void *credData,
220 const gss_OID_set desiredMechs,
222 gss_cred_id_t *pCred,
223 gss_OID_set *pActualMechs,
226 int gssEapCredAvailable(gss_cred_id_t cred, gss_OID mech);
229 gssEapInquireCred(OM_uint32 *minor,
232 OM_uint32 *pLifetime,
233 gss_cred_usage_t *cred_usage,
234 gss_OID_set *mechanisms);
238 gssEapEncrypt(krb5_context context, int dce_style, size_t ec,
240 #ifdef HAVE_HEIMDAL_VERSION
246 gss_iov_buffer_desc *iov, int iov_count);
249 gssEapDecrypt(krb5_context context, int dce_style, size_t ec,
251 #ifdef HAVE_HEIMDAL_VERSION
257 gss_iov_buffer_desc *iov, int iov_count);
260 gssEapMapCryptoFlag(OM_uint32 type);
263 gssEapLocateIov(gss_iov_buffer_desc *iov,
268 gssEapIovMessageLength(gss_iov_buffer_desc *iov,
271 size_t *assoc_data_length);
274 gssEapReleaseIov(gss_iov_buffer_desc *iov, int iov_count);
277 gssEapIsIntegrityOnly(gss_iov_buffer_desc *iov, int iov_count);
280 gssEapAllocIov(gss_iov_buffer_t iov, size_t size);
283 gssEapDeriveRfc3961Key(OM_uint32 *minor,
284 const unsigned char *key,
286 krb5_enctype enctype,
287 krb5_keyblock *pKey);
290 #ifdef HAVE_HEIMDAL_VERSION
292 #define KRB_TIME_FOREVER ((time_t)~0L)
294 #define KRB_KEY_TYPE(key) ((key)->keytype)
295 #define KRB_KEY_DATA(key) ((key)->keyvalue.data)
296 #define KRB_KEY_LENGTH(key) ((key)->keyvalue.length)
298 #define KRB_PRINC_LENGTH(princ) ((princ)->name.name_string.len)
299 #define KRB_PRINC_TYPE(princ) ((princ)->name.name_type)
300 #define KRB_PRINC_NAME(princ) ((princ)->name.name_string.val)
301 #define KRB_PRINC_REALM(princ) ((princ)->realm)
303 #define KRB_KT_ENT_KEYBLOCK(e) (&(e)->keyblock)
304 #define KRB_KT_ENT_FREE(c, e) krb5_kt_free_entry((c), (e))
306 #define KRB_CRYPTO_CONTEXT(ctx) (krbCrypto)
310 #define KRB_TIME_FOREVER KRB5_INT32_MAX
312 #define KRB_KEY_TYPE(key) ((key)->enctype)
313 #define KRB_KEY_DATA(key) ((key)->contents)
314 #define KRB_KEY_LENGTH(key) ((key)->length)
316 #define KRB_PRINC_LENGTH(princ) (krb5_princ_size(NULL, (princ)))
317 #define KRB_PRINC_TYPE(princ) (krb5_princ_type(NULL, (princ)))
318 #define KRB_PRINC_NAME(princ) (krb5_princ_name(NULL, (princ)))
319 #define KRB_PRINC_REALM(princ) (krb5_princ_realm(NULL, (princ)))
321 #define KRB_KT_ENT_KEYBLOCK(e) (&(e)->key)
322 #define KRB_KT_ENT_FREE(c, e) krb5_free_keytab_entry_contents((c), (e))
324 #define KRB_CRYPTO_CONTEXT(ctx) (&(ctx)->rfc3961Key)
326 #endif /* HAVE_HEIMDAL_VERSION */
328 #define KRB_KEY_INIT(key) do { \
329 KRB_KEY_TYPE(key) = ENCTYPE_NULL; \
330 KRB_KEY_DATA(key) = NULL; \
331 KRB_KEY_LENGTH(key) = 0; \
334 #define GSSEAP_KRB_INIT(ctx) do { \
335 OM_uint32 tmpMajor; \
337 tmpMajor = gssEapKerberosInit(minor, ctx); \
338 if (GSS_ERROR(tmpMajor)) { \
344 gssEapKerberosInit(OM_uint32 *minor, krb5_context *context);
347 rfc3961ChecksumTypeForKey(OM_uint32 *minor,
349 krb5_cksumtype *cksumtype);
352 krbCryptoLength(krb5_context krbContext,
353 #ifdef HAVE_HEIMDAL_VERSION
354 krb5_crypto krbCrypto,
362 krbPaddingLength(krb5_context krbContext,
363 #ifdef HAVE_HEIMDAL_VERSION
364 krb5_crypto krbCrypto,
372 krbBlockSize(krb5_context krbContext,
373 #ifdef HAVE_HEIMDAL_VERSION
374 krb5_crypto krbCrypto,
381 krbEnctypeToString(krb5_context krbContext,
382 krb5_enctype enctype,
384 gss_buffer_t string);
387 krbMakeAuthDataKdcIssued(krb5_context context,
388 const krb5_keyblock *key,
389 krb5_const_principal issuer,
390 #ifdef HAVE_HEIMDAL_VERSION
391 const AuthorizationData *authdata,
392 AuthorizationData *adKdcIssued
394 krb5_authdata *const *authdata,
395 krb5_authdata ***adKdcIssued
400 krbMakeCred(krb5_context context,
401 krb5_auth_context authcontext,
407 gssEapExportLucidSecContext(OM_uint32 *minor,
409 const gss_OID desiredObject,
410 gss_buffer_set_t *data_set);
413 extern gss_OID GSS_EAP_MECHANISM;
415 #define OID_FLAG_NULL_VALID 0x00000001
416 #define OID_FLAG_FAMILY_MECH_VALID 0x00000002
417 #define OID_FLAG_MAP_NULL_TO_DEFAULT_MECH 0x00000004
418 #define OID_FLAG_MAP_FAMILY_MECH_TO_NULL 0x00000008
421 gssEapCanonicalizeOid(OM_uint32 *minor,
427 gssEapReleaseOid(OM_uint32 *minor, gss_OID *oid);
430 gssEapDefaultMech(OM_uint32 *minor,
434 gssEapIndicateMechs(OM_uint32 *minor,
438 gssEapEnctypeToOid(OM_uint32 *minor,
439 krb5_enctype enctype,
443 gssEapOidToEnctype(OM_uint32 *minor,
445 krb5_enctype *enctype);
448 gssEapIsMechanismOid(const gss_OID oid);
451 gssEapIsConcreteMechanismOid(const gss_OID oid);
454 gssEapValidateMechs(OM_uint32 *minor,
455 const gss_OID_set mechs);
458 gssEapOidToSaslName(const gss_OID oid);
461 gssEapSaslNameToOid(const gss_buffer_t name);
464 #define EXPORT_NAME_FLAG_OID 0x1
465 #define EXPORT_NAME_FLAG_COMPOSITE 0x2
466 #define EXPORT_NAME_FLAG_ALLOW_COMPOSITE 0x4
468 OM_uint32 gssEapAllocName(OM_uint32 *minor, gss_name_t *pName);
469 OM_uint32 gssEapReleaseName(OM_uint32 *minor, gss_name_t *pName);
470 OM_uint32 gssEapExportName(OM_uint32 *minor,
471 const gss_name_t name,
472 gss_buffer_t exportedName);
473 OM_uint32 gssEapExportNameInternal(OM_uint32 *minor,
474 const gss_name_t name,
475 gss_buffer_t exportedName,
477 OM_uint32 gssEapImportName(OM_uint32 *minor,
478 const gss_buffer_t input_name_buffer,
479 const gss_OID input_name_type,
480 const gss_OID input_mech_type,
481 gss_name_t *output_name);
482 OM_uint32 gssEapImportNameInternal(OM_uint32 *minor,
483 const gss_buffer_t input_name_buffer,
484 gss_name_t *output_name,
487 gssEapDuplicateName(OM_uint32 *minor,
488 const gss_name_t input_name,
489 gss_name_t *dest_name);
492 gssEapCanonicalizeName(OM_uint32 *minor,
493 const gss_name_t input_name,
494 const gss_OID mech_type,
495 gss_name_t *dest_name);
498 gssEapDisplayName(OM_uint32 *minor,
500 gss_buffer_t output_name_buffer,
501 gss_OID *output_name_type);
504 gssEapCompareName(OM_uint32 *minor,
511 composeOid(OM_uint32 *minor_status,
518 decomposeOid(OM_uint32 *minor_status,
525 duplicateOid(OM_uint32 *minor_status,
526 const gss_OID_desc * const oid,
530 duplicateOidSet(OM_uint32 *minor,
531 const gss_OID_set src,
535 oidEqual(const gss_OID_desc *o1, const gss_OID_desc *o2)
537 if (o1 == GSS_C_NO_OID)
538 return (o2 == GSS_C_NO_OID);
539 else if (o2 == GSS_C_NO_OID)
540 return (o1 == GSS_C_NO_OID);
542 return (o1->length == o2->length &&
543 memcmp(o1->elements, o2->elements, o1->length) == 0);
546 /* util_ordering.c */
548 sequenceInternalize(OM_uint32 *minor,
554 sequenceExternalize(OM_uint32 *minor,
560 sequenceSize(void *vqueue);
563 sequenceFree(OM_uint32 *minor, void **vqueue);
566 sequenceCheck(OM_uint32 *minor, void **vqueue, uint64_t seqnum);
569 sequenceInit(OM_uint32 *minor, void **vqueue, uint64_t seqnum,
570 int do_replay, int do_sequence, int wide_nums);
574 GSSEAP_STATE_INITIAL = 0x01, /* initial state */
575 GSSEAP_STATE_AUTHENTICATE = 0x02, /* exchange EAP messages */
576 GSSEAP_STATE_INITIATOR_EXTS = 0x04, /* initiator extensions */
577 GSSEAP_STATE_ACCEPTOR_EXTS = 0x08, /* acceptor extensions */
578 #ifdef GSSEAP_ENABLE_REAUTH
579 GSSEAP_STATE_REAUTHENTICATE = 0x10, /* GSS reauthentication messages */
581 GSSEAP_STATE_ESTABLISHED = 0x20, /* context established */
582 GSSEAP_STATE_ALL = 0x3F
585 #define GSSEAP_STATE_NEXT(s) ((s) << 1)
587 #define GSSEAP_SM_STATE(ctx) ((ctx)->state)
590 void gssEapSmTransition(gss_ctx_id_t ctx, enum gss_eap_state state);
591 #define GSSEAP_SM_TRANSITION(ctx, state) gssEapSmTransition((ctx), (state))
593 #define GSSEAP_SM_TRANSITION(ctx, newstate) do { (ctx)->state = (newstate); } while (0)
596 #define GSSEAP_SM_TRANSITION_NEXT(ctx) GSSEAP_SM_TRANSITION((ctx), GSSEAP_STATE_NEXT(GSSEAP_SM_STATE((ctx))))
598 /* state machine entry */
600 OM_uint32 inputTokenType;
601 OM_uint32 outputTokenType;
602 enum gss_eap_state validStates;
604 OM_uint32 (*processToken)(OM_uint32 *,
611 gss_channel_bindings_t,
617 /* state machine flags, set by handler */
618 #define SM_FLAG_FORCE_SEND_TOKEN 0x00000001 /* send token even if no inner tokens */
619 #define SM_FLAG_OUTPUT_TOKEN_CRITICAL 0x00000002 /* output token is critical */
621 /* state machine flags, set by state machine */
622 #define SM_FLAG_INPUT_TOKEN_CRITICAL 0x10000000 /* input token was critical */
624 #define SM_ITOK_FLAG_REQUIRED 0x00000001 /* received tokens must be present */
627 gssEapSmStep(OM_uint32 *minor,
634 gss_channel_bindings_t chanBindings,
635 gss_buffer_t inputToken,
636 gss_buffer_t outputToken,
637 struct gss_eap_sm *sm,
641 gssEapSmTransition(gss_ctx_id_t ctx, enum gss_eap_state state);
645 gssEapEncodeInnerTokens(OM_uint32 *minor,
646 gss_buffer_set_t extensions,
648 gss_buffer_t buffer);
650 gssEapDecodeInnerTokens(OM_uint32 *minor,
651 const gss_buffer_t buffer,
652 gss_buffer_set_t *pExtensions,
656 tokenSize(const gss_OID_desc *mech, size_t body_size);
659 makeTokenHeader(const gss_OID_desc *mech,
662 enum gss_eap_token_type tok_type);
665 verifyTokenHeader(OM_uint32 *minor,
668 unsigned char **buf_in,
670 enum gss_eap_token_type *ret_tok_type);
674 #define GSSEAP_CALLOC calloc
675 #define GSSEAP_MALLOC malloc
676 #define GSSEAP_FREE free
677 #define GSSEAP_REALLOC realloc
679 #define GSSEAP_NOT_IMPLEMENTED do { \
680 assert(0 && "not implemented"); \
682 return GSS_S_FAILURE; \
687 #define GSSEAP_MUTEX pthread_mutex_t
688 #define GSSEAP_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
690 #define GSSEAP_MUTEX_INIT(m) pthread_mutex_init((m), NULL)
691 #define GSSEAP_MUTEX_DESTROY(m) pthread_mutex_destroy((m))
692 #define GSSEAP_MUTEX_LOCK(m) pthread_mutex_lock((m))
693 #define GSSEAP_MUTEX_UNLOCK(m) pthread_mutex_unlock((m))
695 #define GSSEAP_THREAD_KEY pthread_key_t
696 #define GSSEAP_KEY_CREATE(k, d) pthread_key_create((k), (d))
697 #define GSSEAP_GETSPECIFIC(k) pthread_getspecific((k))
698 #define GSSEAP_SETSPECIFIC(k, d) pthread_setspecific((k), (d))
700 #define GSSEAP_THREAD_ONCE pthread_once_t
701 #define GSSEAP_ONCE(o, i) pthread_once((o), (i))
702 #define GSSEAP_ONCE_INITIALIZER PTHREAD_ONCE_INIT
704 /* Helper functions */
706 store_uint16_be(uint16_t val, void *vp)
708 unsigned char *p = (unsigned char *)vp;
710 p[0] = (val >> 8) & 0xff;
711 p[1] = (val ) & 0xff;
714 static inline uint16_t
715 load_uint16_be(const void *cvp)
717 const unsigned char *p = (const unsigned char *)cvp;
719 return (p[1] | (p[0] << 8));
723 store_uint32_be(uint32_t val, void *vp)
725 unsigned char *p = (unsigned char *)vp;
727 p[0] = (val >> 24) & 0xff;
728 p[1] = (val >> 16) & 0xff;
729 p[2] = (val >> 8) & 0xff;
730 p[3] = (val ) & 0xff;
733 static inline uint32_t
734 load_uint32_be(const void *cvp)
736 const unsigned char *p = (const unsigned char *)cvp;
738 return (p[3] | (p[2] << 8)
739 | ((uint32_t) p[1] << 16)
740 | ((uint32_t) p[0] << 24));
744 store_uint64_be(uint64_t val, void *vp)
746 unsigned char *p = (unsigned char *)vp;
748 p[0] = (unsigned char)((val >> 56) & 0xff);
749 p[1] = (unsigned char)((val >> 48) & 0xff);
750 p[2] = (unsigned char)((val >> 40) & 0xff);
751 p[3] = (unsigned char)((val >> 32) & 0xff);
752 p[4] = (unsigned char)((val >> 24) & 0xff);
753 p[5] = (unsigned char)((val >> 16) & 0xff);
754 p[6] = (unsigned char)((val >> 8) & 0xff);
755 p[7] = (unsigned char)((val ) & 0xff);
758 static inline uint64_t
759 load_uint64_be(const void *cvp)
761 const unsigned char *p = (const unsigned char *)cvp;
763 return ((uint64_t)load_uint32_be(p) << 32) | load_uint32_be(p + 4);
766 static inline unsigned char *
767 store_buffer(gss_buffer_t buffer, void *vp, int wide_nums)
769 unsigned char *p = (unsigned char *)vp;
772 store_uint64_be(buffer->length, p);
775 store_uint32_be(buffer->length, p);
779 if (buffer->value != NULL) {
780 memcpy(p, buffer->value, buffer->length);
787 static inline unsigned char *
788 load_buffer(const void *cvp, size_t length, gss_buffer_t buffer)
791 buffer->value = GSSEAP_MALLOC(length);
792 if (buffer->value == NULL)
794 buffer->length = length;
795 memcpy(buffer->value, cvp, length);
796 return (unsigned char *)cvp + length;
799 static inline unsigned char *
800 store_oid(gss_OID oid, void *vp)
804 if (oid != GSS_C_NO_OID) {
805 buf.length = oid->length;
806 buf.value = oid->elements;
812 return store_buffer(&buf, vp, FALSE);
816 krbDataToGssBuffer(krb5_data *data, gss_buffer_t buffer)
818 buffer->value = (void *)data->data;
819 buffer->length = data->length;
823 krbPrincComponentToGssBuffer(krb5_principal krbPrinc,
824 int index, gss_buffer_t buffer)
826 #ifdef HAVE_HEIMDAL_VERSION
827 buffer->value = (void *)KRB_PRINC_NAME(krbPrinc)[index];
828 buffer->length = strlen((char *)buffer->value);
830 buffer->value = (void *)krb5_princ_component(NULL, krbPrinc, index)->data;
831 buffer->length = krb5_princ_component(NULL, krbPrinc, index)->length;
832 #endif /* HAVE_HEIMDAL_VERSION */
836 krbPrincRealmToGssBuffer(krb5_principal krbPrinc, gss_buffer_t buffer)
838 #ifdef HAVE_HEIMDAL_VERSION
839 buffer->value = (void *)KRB_PRINC_REALM(krbPrinc);
840 buffer->length = strlen((char *)buffer->value);
842 krbDataToGssBuffer(KRB_PRINC_REALM(krbPrinc), buffer);
847 gssBufferToKrbData(gss_buffer_t buffer, krb5_data *data)
849 data->data = (char *)buffer->value;
850 data->length = buffer->length;
857 #include "util_json.h"
858 #include "util_attr.h"
859 #include "util_base64.h"
860 #ifdef GSSEAP_ENABLE_REAUTH
861 #include "util_reauth.h"
864 #endif /* _UTIL_H_ */