Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 9186375

Browse files
committed
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
2 parents 5a87e92 + be4c828 commit 9186375

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@ all::
137137
# specify your own (or DarwinPort's) include directories and
138138
# library directories by defining CFLAGS and LDFLAGS appropriately.
139139
#
140+
# Define NO_APPLE_COMMON_CRYPTO if you are building on Darwin/Mac OS X
141+
# and do not want to use Apple's CommonCrypto library. This allows you
142+
# to provide your own OpenSSL library, for example from MacPorts.
143+
#
140144
# Define BLK_SHA1 environment variable to make use of the bundled
141145
# optimized C SHA1 routine.
142146
#
@@ -1054,6 +1058,11 @@ ifeq ($(uname_S),Darwin)
10541058
BASIC_LDFLAGS += -L/opt/local/lib
10551059
endif
10561060
endif
1061+
ifndef NO_APPLE_COMMON_CRYPTO
1062+
APPLE_COMMON_CRYPTO = YesPlease
1063+
COMPAT_CFLAGS += -DAPPLE_COMMON_CRYPTO
1064+
endif
1065+
NO_REGEX = YesPlease
10571066
PTHREAD_LIBS =
10581067
endif
10591068

@@ -1387,11 +1396,17 @@ ifdef PPC_SHA1
13871396
SHA1_HEADER = "ppc/sha1.h"
13881397
LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
13891398
LIB_H += ppc/sha1.h
1399+
else
1400+
ifdef APPLE_COMMON_CRYPTO
1401+
COMPAT_CFLAGS += -DCOMMON_DIGEST_FOR_OPENSSL
1402+
SHA1_HEADER = <CommonCrypto/CommonDigest.h>
13901403
else
13911404
SHA1_HEADER = <openssl/sha.h>
13921405
EXTLIBS += $(LIB_4_CRYPTO)
13931406
endif
13941407
endif
1408+
endif
1409+
13951410
ifdef NO_PERL_MAKEMAKER
13961411
export NO_PERL_MAKEMAKER
13971412
endif

imap-send.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,18 @@
2929
#ifdef NO_OPENSSL
3030
typedef void *SSL;
3131
#else
32+
#ifdef APPLE_COMMON_CRYPTO
33+
#include <CommonCrypto/CommonHMAC.h>
34+
#define HMAC_CTX CCHmacContext
35+
#define HMAC_Init(hmac, key, len, algo) CCHmacInit(hmac, algo, key, len)
36+
#define HMAC_Update CCHmacUpdate
37+
#define HMAC_Final(hmac, hash, ptr) CCHmacFinal(hmac, hash)
38+
#define HMAC_CTX_cleanup(ignore)
39+
#define EVP_md5() kCCHmacAlgMD5
40+
#else
3241
#include <openssl/evp.h>
3342
#include <openssl/hmac.h>
43+
#endif
3444
#include <openssl/x509v3.h>
3545
#endif
3646

0 commit comments

Comments
 (0)