summaryrefslogtreecommitdiff
path: root/include/my_md5.h
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2012-08-01 17:27:34 +0300
committerMichael Widenius <monty@askmonty.org>2012-08-01 17:27:34 +0300
commit1d0f70c2f894b27e98773a282871d32802f67964 (patch)
tree833e683e0ced29c4323c29a9d845703d4dfcd81b /include/my_md5.h
parent5a86a61219826aadf8d08cbc447fe438f2bf50c3 (diff)
downloadmariadb-git-1d0f70c2f894b27e98773a282871d32802f67964.tar.gz
Temporary commit of merge of MariaDB 10.0-base and MySQL 5.6
Diffstat (limited to 'include/my_md5.h')
-rw-r--r--include/my_md5.h49
1 files changed, 42 insertions, 7 deletions
diff --git a/include/my_md5.h b/include/my_md5.h
index 782bef8a27a..4f90541067b 100644
--- a/include/my_md5.h
+++ b/include/my_md5.h
@@ -22,6 +22,36 @@
* $FreeBSD: src/contrib/cvs/lib/md5.h,v 1.2 1999/12/11 15:10:02 peter Exp $
*/
+#if defined(HAVE_YASSL) || defined(HAVE_OPENSSL)
+/*
+ Use MD5 implementation provided by the SSL libraries.
+*/
+
+#if defined(HAVE_YASSL)
+
+C_MODE_START
+
+void my_md5_hash(char *digest, const char *buf, int len);
+
+C_MODE_END
+
+#else /* HAVE_YASSL */
+
+#include <openssl/md5.h>
+
+#define MY_MD5_HASH(digest, buf, len) \
+do { \
+ MD5_CTX ctx; \
+ MD5_Init (&ctx); \
+ MD5_Update (&ctx, buf, len); \
+ MD5_Final (digest, &ctx); \
+} while (0)
+
+#endif /* HAVE_YASSL */
+
+#else /* HAVE_YASSL || HAVE_OPENSSL */
+/* Fallback to the MySQL's implementation. */
+
/* Unlike previous versions of this code, uint32 need not be exactly
32 bits, merely 32 bits or more. Choosing a data type which is 32
bits instead of 64 is not important; speed is considerably more
@@ -35,18 +65,15 @@ typedef struct {
unsigned char in[64];
} my_MD5Context;
-#ifdef __cplusplus
-extern "C" {
-#endif
+C_MODE_START
+
void my_MD5Init (my_MD5Context *context);
void my_MD5Update (my_MD5Context *context,
unsigned char const *buf, unsigned len);
void my_MD5Final (unsigned char digest[16],
my_MD5Context *context);
-#ifdef __cplusplus
-}
-#endif
+C_MODE_END
#define MY_MD5_HASH(digest,buf,len) \
do { \
@@ -56,4 +83,12 @@ do { \
my_MD5Final (digest, &ctx); \
} while (0)
-#endif /* MY_MD__INCLUDED */
+#endif /* defined(HAVE_YASSL) || defined(HAVE_OPENSSL) */
+
+C_MODE_START
+
+void compute_md5_hash(char *digest, const char *buf, int len);
+
+C_MODE_END
+
+#endif /* MY_MD5_INCLUDED */