]> granicus.if.org Git - curl/commitdiff
metalink/md5: Use CommonCrypto on Apple operating systems
authorNick Zitzmann <nick@chronosnet.com>
Tue, 16 Oct 2012 17:48:55 +0000 (11:48 -0600)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 22 Oct 2012 21:32:59 +0000 (23:32 +0200)
Previously the Metalink code used Apple's CommonCrypto library only if
curl was built using the --with-darwinssl option. Now we use CommonCrypto
on all Apple operating systems including Tiger or later, or iOS 5 or
later, so you don't need to build --with-darwinssl anymore. Also rolled
out this change to libcurl's md5 code.

lib/md5.c
src/tool_metalink.c

index ada2d37e6ffca58750768a340c0e907192960f03..8e580d8e436d1f0a7c5f46c213e8da9dfcc18cca 100644 (file)
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -84,6 +84,17 @@ static void MD5_Final(unsigned char digest[16], MD5_CTX * ctx)
 #    include <md5.h>
 #  endif
 
+#elif defined(__MAC_10_4) || defined(__IPHONE_5_0)
+
+/* 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 5.0
+   and later. If you're building for an older cat, well, sorry. */
+#  define COMMON_DIGEST_FOR_OPENSSL
+#  include <CommonCrypto/CommonDigest.h>
+
 #elif defined(_WIN32)
 
 #include <wincrypt.h>
index cafa63fdfb9e81c8c8e59914d0c5c1b6f423b1f8..16689a3c2414c839c0cd8b3d910f46d8eae4d077 100644 (file)
 #  define MD5_CTX    gcry_md_hd_t
 #  define SHA_CTX    gcry_md_hd_t
 #  define SHA256_CTX gcry_md_hd_t
-#elif defined(USE_DARWINSSL)
-/* For darwinssl: 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.
+#elif defined(__MAC_10_4) || defined(__IPHONE_5_0)
+/* 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 5.0
    and later. If you're building for an older cat, well, sorry. */