Skip to content

Commit be4c828

Browse files
davvidgitster
authored andcommitted
imap-send: eliminate HMAC deprecation warnings on Mac OS X
As of Mac OS X 10.7, Apple deprecated all OpenSSL functions due to OpenSSL ABI instability. Silence the warnings by using Apple's CommonCrypto HMAC replacement functions. [es: reworded commit message; check APPLE_COMMON_CRYPTO instead of abusing COMMON_DIGEST_FOR_OPENSSL] Signed-off-by: David Aguilar <[email protected]> Signed-off-by: Eric Sunshine <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6106795 commit be4c828

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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)