summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-06-30 15:33:13 -0700
committerJunio C Hamano <gitster@pobox.com>2013-06-30 15:33:14 -0700
commit91863750cd09c3da93368d8fc6d3caeaabf1d66a (patch)
treed69a649c02ba516e82197b9f7f2f3330b11aa87a
parent5a87e92232c5468ff8d9a7139dd02a7969c8bbf6 (diff)
parentbe4c828b761a7c65edcff75b008051b6d027e64a (diff)
downloadgit-91863750cd09c3da93368d8fc6d3caeaabf1d66a.tar.gz
Merge branch 'da/darwin' into maint
Newer MacOS X encourages the programs to compile and link with their CommonCrypto, not with OpenSSL. * da/darwin: imap-send: eliminate HMAC deprecation warnings on Mac OS X cache.h: eliminate SHA-1 deprecation warnings on Mac OS X Makefile: add support for Apple CommonCrypto facility Makefile: fix default regex settings on Darwin
-rw-r--r--Makefile15
-rw-r--r--imap-send.c10
2 files changed, 25 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 0f931a2030..5e7cadf017 100644
--- a/Makefile
+++ b/Makefile
@@ -137,6 +137,10 @@ all::
# specify your own (or DarwinPort's) include directories and
# library directories by defining CFLAGS and LDFLAGS appropriately.
#
+# Define NO_APPLE_COMMON_CRYPTO if you are building on Darwin/Mac OS X
+# and do not want to use Apple's CommonCrypto library. This allows you
+# to provide your own OpenSSL library, for example from MacPorts.
+#
# Define BLK_SHA1 environment variable to make use of the bundled
# optimized C SHA1 routine.
#
@@ -1054,6 +1058,11 @@ ifeq ($(uname_S),Darwin)
BASIC_LDFLAGS += -L/opt/local/lib
endif
endif
+ ifndef NO_APPLE_COMMON_CRYPTO
+ APPLE_COMMON_CRYPTO = YesPlease
+ COMPAT_CFLAGS += -DAPPLE_COMMON_CRYPTO
+ endif
+ NO_REGEX = YesPlease
PTHREAD_LIBS =
endif
@@ -1388,10 +1397,16 @@ ifdef PPC_SHA1
LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
LIB_H += ppc/sha1.h
else
+ifdef APPLE_COMMON_CRYPTO
+ COMPAT_CFLAGS += -DCOMMON_DIGEST_FOR_OPENSSL
+ SHA1_HEADER = <CommonCrypto/CommonDigest.h>
+else
SHA1_HEADER = <openssl/sha.h>
EXTLIBS += $(LIB_4_CRYPTO)
endif
endif
+endif
+
ifdef NO_PERL_MAKEMAKER
export NO_PERL_MAKEMAKER
endif
diff --git a/imap-send.c b/imap-send.c
index d9bcfb44dc..d6b65e204c 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -29,8 +29,18 @@
#ifdef NO_OPENSSL
typedef void *SSL;
#else
+#ifdef APPLE_COMMON_CRYPTO
+#include <CommonCrypto/CommonHMAC.h>
+#define HMAC_CTX CCHmacContext
+#define HMAC_Init(hmac, key, len, algo) CCHmacInit(hmac, algo, key, len)
+#define HMAC_Update CCHmacUpdate
+#define HMAC_Final(hmac, hash, ptr) CCHmacFinal(hmac, hash)
+#define HMAC_CTX_cleanup(ignore)
+#define EVP_md5() kCCHmacAlgMD5
+#else
#include <openssl/evp.h>
#include <openssl/hmac.h>
+#endif
#include <openssl/x509v3.h>
#endif