Compile-time flag of WITH_OPENSSL_MD5 causes us to NOT use
authoraland <aland>
Thu, 5 Jun 2008 11:48:25 +0000 (11:48 +0000)
committeraland <aland>
Thu, 5 Jun 2008 11:48:25 +0000 (11:48 +0000)
the MD5 code here.

src/include/md5.h
src/lib/md5.c

index 4a20c93..27767e6 100644 (file)
@@ -26,6 +26,7 @@ RCSIDH(md5_h, "$Id$")
 
 #include <string.h>
 
+#ifndef WITH_OPENSSL_MD5
 /*  The below was retrieved from
  *  http://www.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/crypto/md5.h?rev=1.1
  *  With the following changes: uint64_t => uint32_t[2]
@@ -67,4 +68,15 @@ void  fr_MD5Transform(uint32_t [4], const uint8_t [MD5_BLOCK_LENGTH])
 /*             __attribute__((__bounded__(__minbytes__,2,MD5_BLOCK_LENGTH)))*/;
 /* __END_DECLS */
 
+#else  /* WITH_OPENSSL_HASH */
+
+#include <openssl/md5.h>
+
+#define FR_MD5_CTX     MD5_CTX
+#define fr_MD5Init     MD5_Init
+#define fr_MD5Update   MD5_Update
+#define fr_MD5Final    MD5_Final
+#define fr_MD5Transform MD5_Transform
+#endif
+
 #endif /* _FR_MD5_H */
index 7f1b561..8ce3ee6 100644 (file)
@@ -28,6 +28,8 @@ void fr_md5_calc(uint8_t *output, const uint8_t *input,
        fr_MD5Final(output, &context);
 }
 
+
+#ifndef WITH_OPENSSL_MD5
 /*     The below was retrieved from
  *     http://www.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/crypto/md5.c?rev=1.1
  *     with the following changes:
@@ -275,3 +277,4 @@ fr_MD5Transform(uint32_t state[4], const uint8_t block[MD5_BLOCK_LENGTH])
        state[2] += c;
        state[3] += d;
 }
+#endif