Add "extern C {...} to header files for C++ builds.
[freeradius.git] / src / include / md4.h
index 06db9d4..348d7bb 100644 (file)
@@ -6,8 +6,8 @@
  *
  */
 
-#ifndef _LRAD_MD4_H
-#define _LRAD_MD4_H
+#ifndef _FR_MD4_H
+#define _FR_MD4_H
 
 #include <freeradius-devel/ident.h>
 RCSIDH(md4_h, "$Id$")
@@ -26,8 +26,17 @@ RCSIDH(md4_h, "$Id$")
 
 #include <string.h>
 
-void md4_calc (unsigned char *, const unsigned char *, unsigned int);
+#ifdef WITH_OPENSSL_MD4
+#include <openssl/md4.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
 
+void fr_md4_calc (unsigned char *, const unsigned char *, unsigned int);
+
+#ifndef WITH_OPENSSL_MD4
 /*  The below was retrieved from
  *  http://www.openbsd.org/cgi-bin/cvsweb/src/include/md4.h?rev=1.12
  *  With the following changes: uint64_t => uint32_t[2]
@@ -59,30 +68,33 @@ void md4_calc (unsigned char *, const unsigned char *, unsigned int);
 #define        MD4_DIGEST_LENGTH               16
 #define        MD4_DIGEST_STRING_LENGTH        (MD4_DIGEST_LENGTH * 2 + 1)
 
-typedef struct MD4Context {
+typedef struct FR_MD4Context {
        uint32_t state[4];                      /* state */
        uint32_t count[2];                      /* number of bits, mod 2^64 */
        uint8_t buffer[MD4_BLOCK_LENGTH];       /* input buffer */
-} MD4_CTX;
-
-/*#include <sys/cdefs.h>*/
+} FR_MD4_CTX;
 
 /*__BEGIN_DECLS*/
-void    MD4Init(MD4_CTX *);
-void    MD4Update(MD4_CTX *, const uint8_t *, size_t)
+void    fr_MD4Init(FR_MD4_CTX *);
+void    fr_MD4Update(FR_MD4_CTX *, const uint8_t *, size_t)
 /*             __attribute__((__bounded__(__string__,2,3)))*/;
-void    MD4Final(uint8_t [MD4_DIGEST_LENGTH], MD4_CTX *)
+void    fr_MD4Final(uint8_t [MD4_DIGEST_LENGTH], FR_MD4_CTX *)
 /*             __attribute__((__bounded__(__minbytes__,1,MD4_DIGEST_LENGTH)))*/;
-void    MD4Transform(uint32_t [4], const uint8_t [MD4_BLOCK_LENGTH])
+void    fr_MD4Transform(uint32_t [4], const uint8_t [MD4_BLOCK_LENGTH])
 /*             __attribute__((__bounded__(__minbytes__,1,4)))
                __attribute__((__bounded__(__minbytes__,2,MD4_BLOCK_LENGTH)))*/;
-/*char *MD4End(MD4_CTX *, char [MD4_DIGEST_STRING_LENGTH])
-               __attribute__((__bounded__(__minbytes__,2,MD4_DIGEST_STRING_LENGTH)));
-char   *MD4File(char *, char [MD4_DIGEST_STRING_LENGTH])
-               __attribute__((__bounded__(__minbytes__,2,MD4_DIGEST_STRING_LENGTH)));
-char   *MD4Data(const uint8_t *, size_t, char [MD4_DIGEST_STRING_LENGTH])
-               __attribute__((__bounded__(__string__,1,2)))
-               __attribute__((__bounded__(__minbytes__,3,MD4_DIGEST_STRING_LENGTH)));*/
 /*__END_DECLS*/
+#else  /* WITH_OPENSSL_MD4 */
+
+#define FR_MD4_CTX     MD4_CTX
+#define fr_MD4Init     MD4_Init
+#define fr_MD4Update   MD4_Update
+#define fr_MD4Final    MD4_Final
+#define fr_MD4Transform MD4_Transform
+#endif
+
+#ifdef __cplusplus
+}
+#endif
 
-#endif /* _LRAD_MD4_H */
+#endif /* _FR_MD4_H */