move alloc stuff into a separate file
[mech_eap.git] / util.h
diff --git a/util.h b/util.h
index 74641c7..7d47e98 100644 (file)
--- a/util.h
+++ b/util.h
@@ -88,11 +88,26 @@ enum gss_eap_token_type {
     TOK_TYPE_DELETE_CONTEXT          = 0x0405,  /* RFC 2743 delete context */
     TOK_TYPE_EAP_RESP                = 0x0601,  /* draft-howlett-eap-gss */
     TOK_TYPE_EAP_REQ                 = 0x0602,  /* draft-howlett-eap-gss */
-    TOK_TYPE_GSS_CB                  = 0x0603,  /* draft-howlett-eap-gss */
+    TOK_TYPE_EXT_REQ                 = 0x0603,  /* draft-howlett-eap-gss */
+    TOK_TYPE_EXT_RESP                = 0x0604,  /* to be specified */
+    TOK_TYPE_GSS_REAUTH              = 0x0605,  /* to be specified */
 };
 
 #define EAP_EXPORT_CONTEXT_V1           1
 
+/* util_alloc.c */
+void *
+gssEapCalloc(size_t nmemb, size_t size);
+
+void *
+gssEapMalloc(size_t size);
+
+void
+gssEapFree(void *ptr);
+
+void *
+gssEapRealloc(void *ptr, size_t size);
+
 /* util_buffer.c */
 OM_uint32
 makeStringBuffer(OM_uint32 *minor,
@@ -169,7 +184,7 @@ OM_uint32
 gssEapVerifyToken(OM_uint32 *minor,
                   gss_ctx_id_t ctx,
                   const gss_buffer_t inputToken,
-                  enum gss_eap_token_type tokenType,
+                  enum gss_eap_token_type *tokenType,
                   gss_buffer_t innerInputToken);
 
 OM_uint32
@@ -258,7 +273,16 @@ rfc3961ChecksumTypeForKey(OM_uint32 *minor,
         }                                           \
     } while (0)
 
+/* util_lucid.c */
+OM_uint32
+gssEapExportLucidSecContext(OM_uint32 *minor,
+                            gss_ctx_id_t ctx,
+                            const gss_OID desiredObject,
+                            gss_buffer_set_t *data_set);
+
 /* util_mech.c */
+extern gss_OID GSS_EAP_MECHANISM;
+
 int
 gssEapInternalizeOid(const gss_OID oid,
                      gss_OID *const pInternalizedOid);
@@ -291,6 +315,12 @@ OM_uint32
 gssEapValidateMechs(OM_uint32 *minor,
                    const gss_OID_set mechs);
 
+gss_buffer_t
+gssEapOidToSaslName(const gss_OID oid);
+
+gss_OID
+gssEapSaslNameToOid(const gss_buffer_t name);
+
 /* util_name.c */
 #define EXPORT_NAME_FLAG_OID        0x1
 #define EXPORT_NAME_FLAG_COMPOSITE  0x2
@@ -396,13 +426,14 @@ verifyTokenHeader(OM_uint32 *minor,
                   size_t *body_size,
                   unsigned char **buf_in,
                   size_t toksize_in,
-                  enum gss_eap_token_type tok_type);
+                  enum gss_eap_token_type *ret_tok_type);
 
 /* Helper macros */
-#define GSSEAP_CALLOC(count, size)      (calloc((count), (size)))
-#define GSSEAP_FREE(ptr)                (free((ptr)))
-#define GSSEAP_MALLOC(size)             (malloc((size)))
-#define GSSEAP_REALLOC(ptr, size)       (realloc((ptr), (size)))
+
+#define GSSEAP_CALLOC(count, size)      (gssEapCalloc((count), (size)))
+#define GSSEAP_MALLOC(size)             (gssEapMalloc((size)))
+#define GSSEAP_FREE(ptr)                (gssEapFree((ptr)))
+#define GSSEAP_REALLOC(ptr, size)       (gssEapRealloc((ptr), (size)))
 
 #define GSSEAP_NOT_IMPLEMENTED          do {            \
         assert(0 && "not implemented");                 \
@@ -547,10 +578,20 @@ krbDataToGssBuffer(krb5_data *data, gss_buffer_t buffer)
     buffer->length = data->length;
 }
 
+static inline void
+gssBufferToKrbData(gss_buffer_t buffer, krb5_data *data)
+{
+    data->data = (char *)buffer->value;
+    data->length = buffer->length;
+}
+
 #ifdef __cplusplus
 }
 #endif
 
 #include "util_attr.h"
+#ifdef GSSEAP_ENABLE_REAUTH
+#include "util_reauth.h"
+#endif
 
 #endif /* _UTIL_H_ */