summaryrefslogtreecommitdiff
path: root/lib/md5.c
diff options
context:
space:
mode:
authorNick Zitzmann <nickzman@gmail.com>2013-08-05 19:47:56 -0600
committerNick Zitzmann <nickzman@gmail.com>2013-08-05 19:47:56 -0600
commit230e16dc033a05ad9b2ed8a499f74b69886e0865 (patch)
tree0b90864b3bf208580b6df6e47af56de8f8f807fd /lib/md5.c
parent0ce410a62970237823902b30fd851778f09dc089 (diff)
downloadcurl-230e16dc033a05ad9b2ed8a499f74b69886e0865.tar.gz
md5: remove use of CommonCrypto-to-OpenSSL macros for the benefit of Leopard
For some reason, OS X 10.5's GCC suddenly stopped working correctly with macros that change MD5_Init etc. in the code to CC_MD5_Init etc., so I worked around this by removing use of the macros and inserting static functions that just call CommonCrypto's implementations of the functions instead.
Diffstat (limited to 'lib/md5.c')
-rw-r--r--lib/md5.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/lib/md5.c b/lib/md5.c
index 1c201f321..d8344dbe4 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -96,13 +96,30 @@ static void MD5_Final(unsigned char digest[16], MD5_CTX * ctx)
(__IPHONE_OS_VERSION_MAX_ALLOWED >= 20000))
/* For Apple operating systems: CommonCrypto has the functions we need.
- The library's headers are even backward-compatible with OpenSSL's
- headers as long as we define COMMON_DIGEST_FOR_OPENSSL first.
-
These functions are available on Tiger and later, as well as iOS 2.0
- and later. If you're building for an older cat, well, sorry. */
-# define COMMON_DIGEST_FOR_OPENSSL
+ and later. If you're building for an older cat, well, sorry.
+
+ Declaring the functions as static like this seems to be a bit more
+ reliable than defining COMMON_DIGEST_FOR_OPENSSL on older cats. */
# include <CommonCrypto/CommonDigest.h>
+# define MD5_CTX CC_MD5_CTX
+
+static void MD5_Init(MD5_CTX *ctx)
+{
+ CC_MD5_Init(ctx);
+}
+
+static void MD5_Update(MD5_CTX *ctx,
+ const unsigned char *input,
+ unsigned int inputLen)
+{
+ CC_MD5_Update(ctx, input, inputLen);
+}
+
+static void MD5_Final(unsigned char digest[16], MD5_CTX *ctx)
+{
+ CC_MD5_Final(digest, ctx);
+}
#elif defined(_WIN32)