don't allow undefined symbols when linking
[mech_eap.git] / util.h
diff --git a/util.h b/util.h
index 6f420d2..f2c992a 100644 (file)
--- a/util.h
+++ b/util.h
 #ifndef _UTIL_H_
 #define _UTIL_H_ 1
 
+#include <string.h>
+#include <errno.h>
+
 #include <krb5.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "util_saml.h"
-#include "util_radius.h"
 
 #define KRB_KEY_TYPE(key)       ((key)->enctype)
 #define KRB_KEY_DATA(key)       ((key)->contents)
@@ -101,6 +107,24 @@ duplicateBuffer(OM_uint32 *minor,
                 const gss_buffer_t src,
                 gss_buffer_t dst);
 
+static inline int
+bufferEqual(const gss_buffer_t b1, const gss_buffer_t b2)
+{
+    return (b1->length == b2->length &&
+            memcmp(b1->value, b2->value, b2->length) == 0);
+}
+
+static inline int
+bufferEqualString(const gss_buffer_t b1, const char *s)
+{
+    gss_buffer_desc b2;
+
+    b2.length = strlen(s);
+    b2.value = (char *)s;
+
+    return bufferEqual(b1, &b2);
+}
+
 /* util_cksum.c */
 int
 gssEapSign(krb5_context context,
@@ -198,7 +222,7 @@ int
 gssEapAllocIov(gss_iov_buffer_t iov, size_t size);
 
 OM_uint32
-gssEapDeriveRFC3961Key(OM_uint32 *minor,
+gssEapDeriveRfc3961Key(OM_uint32 *minor,
                        const unsigned char *key,
                        size_t keyLength,
                        krb5_enctype enctype,
@@ -208,6 +232,11 @@ gssEapDeriveRFC3961Key(OM_uint32 *minor,
 OM_uint32
 gssEapKerberosInit(OM_uint32 *minor, krb5_context *context);
 
+OM_uint32
+rfc3961ChecksumTypeForKey(OM_uint32 *minor,
+                          krb5_keyblock *key,
+                          krb5_cksumtype *cksumtype);
+
 #define GSSEAP_KRB_INIT(ctx) do {                   \
         OM_uint32 tmpMajor;                         \
         tmpMajor  = gssEapKerberosInit(minor, ctx); \
@@ -499,4 +528,9 @@ store_oid(gss_OID oid, void *vp)
 
     return store_buffer(&buf, vp, FALSE);
 }
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _UTIL_H_ */