metalink/md5: Use CommonCrypto on Apple operating systems

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.
This commit is contained in:
Nick Zitzmann
2012-10-16 11:48:55 -06:00
committed by Daniel Stenberg
parent 12a40e17a9
commit 94891ff296
2 changed files with 15 additions and 4 deletions

View File

@@ -84,6 +84,17 @@ static void MD5_Final(unsigned char digest[16], MD5_CTX * ctx)
# include <md5.h> # include <md5.h>
# endif # 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) #elif defined(_WIN32)
#include <wincrypt.h> #include <wincrypt.h>

View File

@@ -52,10 +52,10 @@
# define MD5_CTX gcry_md_hd_t # define MD5_CTX gcry_md_hd_t
# define SHA_CTX gcry_md_hd_t # define SHA_CTX gcry_md_hd_t
# define SHA256_CTX gcry_md_hd_t # define SHA256_CTX gcry_md_hd_t
#elif defined(USE_DARWINSSL) #elif defined(__MAC_10_4) || defined(__IPHONE_5_0)
/* For darwinssl: CommonCrypto has the functions we need. The library's /* For Apple operating systems: CommonCrypto has the functions we need.
headers are even backward-compatible with OpenSSL's headers as long as The library's headers are even backward-compatible with OpenSSL's
we define COMMON_DIGEST_FOR_OPENSSL first. 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 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. */ and later. If you're building for an older cat, well, sorry. */