summaryrefslogtreecommitdiff
path: root/compat/apple-common-crypto.h
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2016-05-06 14:53:24 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2016-05-06 14:53:24 -0700
commita0c9cf51c0ba6ca30f7325bc035200010f2c50f7 (patch)
treebf0c43cc8490b45e7cd753f1ec1254265f9506ff /compat/apple-common-crypto.h
parentMerge branch 'js/replace-edit-use-editor-configuration' into maint (diff)
parentconfigure: remove checking for HMAC_CTX_cleanup (diff)
downloadtgif-a0c9cf51c0ba6ca30f7325bc035200010f2c50f7.tar.xz
Merge branch 'ky/imap-send-openssl-1.1.0' into maint
Upcoming OpenSSL 1.1.0 will break compilation b updating a few APIs we use in imap-send, which has been adjusted for the change. * ky/imap-send-openssl-1.1.0: configure: remove checking for HMAC_CTX_cleanup imap-send: avoid deprecated TLSv1_method() imap-send: check NULL return of SSL_CTX_new() imap-send: use HMAC() function provided by OpenSSL
Diffstat (limited to 'compat/apple-common-crypto.h')
-rw-r--r--compat/apple-common-crypto.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/compat/apple-common-crypto.h b/compat/apple-common-crypto.h
index d3fb264181..11727f3e1e 100644
--- a/compat/apple-common-crypto.h
+++ b/compat/apple-common-crypto.h
@@ -3,12 +3,18 @@
#define HEADER_HMAC_H
#define HEADER_SHA_H
#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
+/* CCHmac doesn't take md_len and the return type is void */
+#define HMAC git_CC_HMAC
+static inline unsigned char *git_CC_HMAC(CCHmacAlgorithm alg,
+ const void *key, int key_len,
+ const unsigned char *data, size_t data_len,
+ unsigned char *md, unsigned int *md_len)
+{
+ CCHmac(alg, key, key_len, data, data_len, md);
+ return md;
+}
+
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
#define APPLE_LION_OR_NEWER
#include <Security/Security.h>