{"thread":{"id":"34564","subject":"[PATCH v2] imap-send: use Apple's Security framework for base64 encoding","startedAt":"2013-07-30T01:28:30Z","lastAt":"2013-07-30T19:21:49Z","messageCount":3,"participants":["David Aguilar","Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"224273","messageId":"1375147710-71226-1-git-send-email-davvid@gmail.com","threadId":"34564","inReplyTo":null,"subject":"[PATCH v2] imap-send: use Apple's Security framework for base64 encoding","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2013-07-30T01:28:30Z","receivedAt":"2013-07-30T01:28:30Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"From: Jeremy Huddleston <jeremyhu@apple.com>\n\nUse Apple's supported functions for base64 encoding instead\nof the deprecated OpenSSL functions.\n\nSigned-off-by: Jeremy Huddleston <jeremyhu@apple.com>\nSigned-off-by: David Aguilar <davvid@gmail.com>\n---\nThis version moves the tricky #ifdefs into git-compat-util.h\n\n Makefile          |  1 +\n git-compat-util.h | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++++\n imap-send.c       | 14 --------\n 3 files changed, 96 insertions(+), 14 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex ef442eb..2b1e936 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1414,6 +1414,7 @@ ifdef PPC_SHA1\n \tLIB_H += ppc/sha1.h\n else\n ifdef APPLE_COMMON_CRYPTO\n+\tLIB_4_CRYPTO += -framework Security -framework CoreFoundation\n \tCOMPAT_CFLAGS += -DCOMMON_DIGEST_FOR_OPENSSL\n \tSHA1_HEADER = <CommonCrypto/CommonDigest.h>\n else\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex cc4ba4d..1ba89f8 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -129,6 +129,32 @@\n #include <poll.h>\n #endif\n \n+#ifndef NO_OPENSSL\n+#ifdef APPLE_COMMON_CRYPTO\n+/* suppress inclusion of conflicting openssl functions */\n+#define OPENSSL_NO_MD5\n+#define HEADER_HMAC_H\n+#define HEADER_SHA_H\n+#include <CommonCrypto/CommonHMAC.h>\n+#define HMAC_CTX CCHmacContext\n+#define HMAC_Init(hmac, key, len, algo) CCHmacInit(hmac, algo, key, len)\n+#define HMAC_Update CCHmacUpdate\n+#define HMAC_Final(hmac, hash, ptr) CCHmacFinal(hmac, hash)\n+#define HMAC_CTX_cleanup(ignore)\n+#define EVP_md5(...) kCCHmacAlgMD5\n+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070\n+#define APPLE_LION_OR_NEWER\n+#include <Security/Security.h>\n+/* Apple's TYPE_BOOL conflicts with config.c */\n+#undef TYPE_BOOL\n+#endif\n+#else\n+#include <openssl/evp.h>\n+#include <openssl/hmac.h>\n+#endif /* APPLE_COMMON_CRYPTO */\n+#include <openssl/x509v3.h>\n+#endif /* NO_OPENSSL */\n+\n extern int get_st_mode_bits(const char *path, int *mode);\n \n #if defined(__MINGW32__)\n@@ -717,4 +743,73 @@ void warn_on_inaccessible(const char *path);\n /* Get the passwd entry for the UID of the current process. */\n struct passwd *xgetpwuid_self(void);\n \n+#ifdef APPLE_LION_OR_NEWER\n+#define git_CC_error_check(pattern, err) \\\n+\tdo { \\\n+\t\tif (err) { \\\n+\t\t\tdie(pattern, (long)CFErrorGetCode(err)); \\\n+\t\t} \\\n+\t} while(0)\n+\n+#define EVP_EncodeBlock git_CC_EVP_EncodeBlock\n+static inline int git_CC_EVP_EncodeBlock(unsigned char *out,\n+\t\tconst unsigned char *in, int inlen)\n+{\n+\tCFErrorRef err;\n+\tSecTransformRef encoder;\n+\tCFDataRef input, output;\n+\tCFIndex length;\n+\n+\tencoder = SecEncodeTransformCreate(kSecBase64Encoding, &err);\n+\tgit_CC_error_check(\"SecEncodeTransformCreate failed: %ld\", err);\n+\n+\tinput = CFDataCreate(kCFAllocatorDefault, in, inlen);\n+\tSecTransformSetAttribute(encoder, kSecTransformInputAttributeName,\n+\t\t\tinput, &err);\n+\tgit_CC_error_check(\"SecTransformSetAttribute failed: %ld\", err);\n+\n+\toutput = SecTransformExecute(encoder, &err);\n+\tgit_CC_error_check(\"SecTransformExecute failed: %ld\", err);\n+\n+\tlength = CFDataGetLength(output);\n+\tCFDataGetBytes(output, CFRangeMake(0, length), out);\n+\n+\tCFRelease(output);\n+\tCFRelease(input);\n+\tCFRelease(encoder);\n+\n+\treturn (int)strlen((const char *)out);\n+}\n+\n+#define EVP_DecodeBlock git_CC_EVP_DecodeBlock\n+static int inline git_CC_EVP_DecodeBlock(unsigned char *out,\n+\t\tconst unsigned char *in, int inlen)\n+{\n+\tCFErrorRef err;\n+\tSecTransformRef decoder;\n+\tCFDataRef input, output;\n+\tCFIndex length;\n+\n+\tdecoder = SecDecodeTransformCreate(kSecBase64Encoding, &err);\n+\tgit_CC_error_check(\"SecEncodeTransformCreate failed: %ld\", err);\n+\n+\tinput = CFDataCreate(kCFAllocatorDefault, in, inlen);\n+\tSecTransformSetAttribute(decoder, kSecTransformInputAttributeName,\n+\t\t\tinput, &err);\n+\tgit_CC_error_check(\"SecTransformSetAttribute failed: %ld\", err);\n+\n+\toutput = SecTransformExecute(decoder, &err);\n+\tgit_CC_error_check(\"SecTransformExecute failed: %ld\", err);\n+\n+\tlength = CFDataGetLength(output);\n+\tCFDataGetBytes(output, CFRangeMake(0, length), out);\n+\n+\tCFRelease(output);\n+\tCFRelease(input);\n+\tCFRelease(decoder);\n+\n+\treturn (int)strlen((const char *)out);\n+}\n+#endif /* APPLE_LION_OR_NEWER */\n+\n #endif\ndiff --git a/imap-send.c b/imap-send.c\nindex d6b65e2..6f5cc4f 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -28,20 +28,6 @@\n #include \"prompt.h\"\n #ifdef NO_OPENSSL\n typedef void *SSL;\n-#else\n-#ifdef APPLE_COMMON_CRYPTO\n-#include <CommonCrypto/CommonHMAC.h>\n-#define HMAC_CTX CCHmacContext\n-#define HMAC_Init(hmac, key, len, algo) CCHmacInit(hmac, algo, key, len)\n-#define HMAC_Update CCHmacUpdate\n-#define HMAC_Final(hmac, hash, ptr) CCHmacFinal(hmac, hash)\n-#define HMAC_CTX_cleanup(ignore)\n-#define EVP_md5() kCCHmacAlgMD5\n-#else\n-#include <openssl/evp.h>\n-#include <openssl/hmac.h>\n-#endif\n-#include <openssl/x509v3.h>\n #endif\n \n static const char imap_send_usage[] = \"git imap-send < <mbox>\";\n-- \n1.8.4.rc0.2.g416d4cd\n"},{"id":"224304","messageId":"7vtxjcvy9s.fsf@alter.siamese.dyndns.org","threadId":"34564","inReplyTo":"1375147710-71226-1-git-send-email-davvid@gmail.com","subject":"Re: [PATCH v2] imap-send: use Apple's Security framework for base64 encoding","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-07-30T15:54:39Z","receivedAt":"2013-07-30T15:54:39Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"David Aguilar <davvid@gmail.com> writes:\n\n> From: Jeremy Huddleston <jeremyhu@apple.com>\n>\n> Use Apple's supported functions for base64 encoding instead\n> of the deprecated OpenSSL functions.\n>\n> Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>\n> Signed-off-by: David Aguilar <davvid@gmail.com>\n> ---\n> This version moves the tricky #ifdefs into git-compat-util.h\n\nNice.  I however wonder if we can kick the inlines that are\nirrelevant to most people out further.  For example, would the\nfollowing be an improvement?\n\n-- >8 --\nFrom: Jeremy Huddleston <jeremyhu@apple.com>\nDate: Mon, 29 Jul 2013 18:28:30 -0700\nSubject: [PATCH] imap-send: use Apple's Security framework for base64 encoding\n\nUse Apple's supported functions for base64 encoding instead\nof the deprecated OpenSSL functions.\n\nSigned-off-by: Jeremy Huddleston <jeremyhu@apple.com>\nSigned-off-by: David Aguilar <davvid@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n Makefile                     |  1 +\n compat/apple-common-crypto.h | 86 ++++++++++++++++++++++++++++++++++++++++++++\n git-compat-util.h            | 11 ++++++\n imap-send.c                  | 14 --------\n 4 files changed, 98 insertions(+), 14 deletions(-)\n create mode 100644 compat/apple-common-crypto.h\n\ndiff --git a/Makefile b/Makefile\nindex 5e7cadf..dddf49b 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1398,6 +1398,7 @@ ifdef PPC_SHA1\n \tLIB_H += ppc/sha1.h\n else\n ifdef APPLE_COMMON_CRYPTO\n+\tLIB_4_CRYPTO += -framework Security -framework CoreFoundation\n \tCOMPAT_CFLAGS += -DCOMMON_DIGEST_FOR_OPENSSL\n \tSHA1_HEADER = <CommonCrypto/CommonDigest.h>\n else\ndiff --git a/compat/apple-common-crypto.h b/compat/apple-common-crypto.h\nnew file mode 100644\nindex 0000000..c8b9b0e\n--- /dev/null\n+++ b/compat/apple-common-crypto.h\n@@ -0,0 +1,86 @@\n+/* suppress inclusion of conflicting openssl functions */\n+#define OPENSSL_NO_MD5\n+#define HEADER_HMAC_H\n+#define HEADER_SHA_H\n+#include <CommonCrypto/CommonHMAC.h>\n+#define HMAC_CTX CCHmacContext\n+#define HMAC_Init(hmac, key, len, algo) CCHmacInit(hmac, algo, key, len)\n+#define HMAC_Update CCHmacUpdate\n+#define HMAC_Final(hmac, hash, ptr) CCHmacFinal(hmac, hash)\n+#define HMAC_CTX_cleanup(ignore)\n+#define EVP_md5(...) kCCHmacAlgMD5\n+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070\n+#define APPLE_LION_OR_NEWER\n+#include <Security/Security.h>\n+/* Apple's TYPE_BOOL conflicts with config.c */\n+#undef TYPE_BOOL\n+#endif\n+\n+#ifdef APPLE_LION_OR_NEWER\n+#define git_CC_error_check(pattern, err) \\\n+\tdo { \\\n+\t\tif (err) { \\\n+\t\t\tdie(pattern, (long)CFErrorGetCode(err)); \\\n+\t\t} \\\n+\t} while(0)\n+\n+#define EVP_EncodeBlock git_CC_EVP_EncodeBlock\n+static inline int git_CC_EVP_EncodeBlock(unsigned char *out,\n+\t\tconst unsigned char *in, int inlen)\n+{\n+\tCFErrorRef err;\n+\tSecTransformRef encoder;\n+\tCFDataRef input, output;\n+\tCFIndex length;\n+\n+\tencoder = SecEncodeTransformCreate(kSecBase64Encoding, &err);\n+\tgit_CC_error_check(\"SecEncodeTransformCreate failed: %ld\", err);\n+\n+\tinput = CFDataCreate(kCFAllocatorDefault, in, inlen);\n+\tSecTransformSetAttribute(encoder, kSecTransformInputAttributeName,\n+\t\t\tinput, &err);\n+\tgit_CC_error_check(\"SecTransformSetAttribute failed: %ld\", err);\n+\n+\toutput = SecTransformExecute(encoder, &err);\n+\tgit_CC_error_check(\"SecTransformExecute failed: %ld\", err);\n+\n+\tlength = CFDataGetLength(output);\n+\tCFDataGetBytes(output, CFRangeMake(0, length), out);\n+\n+\tCFRelease(output);\n+\tCFRelease(input);\n+\tCFRelease(encoder);\n+\n+\treturn (int)strlen((const char *)out);\n+}\n+\n+#define EVP_DecodeBlock git_CC_EVP_DecodeBlock\n+static int inline git_CC_EVP_DecodeBlock(unsigned char *out,\n+\t\tconst unsigned char *in, int inlen)\n+{\n+\tCFErrorRef err;\n+\tSecTransformRef decoder;\n+\tCFDataRef input, output;\n+\tCFIndex length;\n+\n+\tdecoder = SecDecodeTransformCreate(kSecBase64Encoding, &err);\n+\tgit_CC_error_check(\"SecEncodeTransformCreate failed: %ld\", err);\n+\n+\tinput = CFDataCreate(kCFAllocatorDefault, in, inlen);\n+\tSecTransformSetAttribute(decoder, kSecTransformInputAttributeName,\n+\t\t\tinput, &err);\n+\tgit_CC_error_check(\"SecTransformSetAttribute failed: %ld\", err);\n+\n+\toutput = SecTransformExecute(decoder, &err);\n+\tgit_CC_error_check(\"SecTransformExecute failed: %ld\", err);\n+\n+\tlength = CFDataGetLength(output);\n+\tCFDataGetBytes(output, CFRangeMake(0, length), out);\n+\n+\tCFRelease(output);\n+\tCFRelease(input);\n+\tCFRelease(decoder);\n+\n+\treturn (int)strlen((const char *)out);\n+}\n+#endif /* APPLE_LION_OR_NEWER */\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex e955bb5..6ebb029 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -127,6 +127,17 @@\n #else\n #include <poll.h>\n #endif\n+\n+#ifndef NO_OPENSSL\n+#ifdef APPLE_COMMON_CRYPTO\n+#include \"compat/apple-common-crypto.h\"\n+#else\n+#include <openssl/evp.h>\n+#include <openssl/hmac.h>\n+#endif /* APPLE_COMMON_CRYPTO */\n+#include <openssl/x509v3.h>\n+#endif /* NO_OPENSSL */\n+\n #if defined(__MINGW32__)\n /* pull in Windows compatibility stuff */\n #include \"compat/mingw.h\"\ndiff --git a/imap-send.c b/imap-send.c\nindex d6b65e2..6f5cc4f 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -28,20 +28,6 @@\n #include \"prompt.h\"\n #ifdef NO_OPENSSL\n typedef void *SSL;\n-#else\n-#ifdef APPLE_COMMON_CRYPTO\n-#include <CommonCrypto/CommonHMAC.h>\n-#define HMAC_CTX CCHmacContext\n-#define HMAC_Init(hmac, key, len, algo) CCHmacInit(hmac, algo, key, len)\n-#define HMAC_Update CCHmacUpdate\n-#define HMAC_Final(hmac, hash, ptr) CCHmacFinal(hmac, hash)\n-#define HMAC_CTX_cleanup(ignore)\n-#define EVP_md5() kCCHmacAlgMD5\n-#else\n-#include <openssl/evp.h>\n-#include <openssl/hmac.h>\n-#endif\n-#include <openssl/x509v3.h>\n #endif\n \n static const char imap_send_usage[] = \"git imap-send < <mbox>\";\n-- \n1.8.4-rc0-137-g17832d4\n"},{"id":"224311","messageId":"CAJDDKr5EFt+X91L6YqKz4HED+52z2TDGrre_LdKCeRK+yvUT_w@mail.gmail.com","threadId":"34564","inReplyTo":"7vtxjcvy9s.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v2] imap-send: use Apple's Security framework for base64 encoding","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2013-07-30T19:21:49Z","receivedAt":"2013-07-30T19:21:49Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"On Tue, Jul 30, 2013 at 8:54 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> David Aguilar <davvid@gmail.com> writes:\n>\n>> From: Jeremy Huddleston <jeremyhu@apple.com>\n>>\n>> Use Apple's supported functions for base64 encoding instead\n>> of the deprecated OpenSSL functions.\n>>\n>> Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>\n>> Signed-off-by: David Aguilar <davvid@gmail.com>\n>> ---\n>> This version moves the tricky #ifdefs into git-compat-util.h\n>\n> Nice.  I however wonder if we can kick the inlines that are\n> irrelevant to most people out further.  For example, would the\n> following be an improvement?\n\nYes, IMO that is nicer.  It keeps all of the Apple specifics neatly tucked away.\nThanks\n\n>\n> -- >8 --\n> From: Jeremy Huddleston <jeremyhu@apple.com>\n> Date: Mon, 29 Jul 2013 18:28:30 -0700\n> Subject: [PATCH] imap-send: use Apple's Security framework for base64 encoding\n>\n> Use Apple's supported functions for base64 encoding instead\n> of the deprecated OpenSSL functions.\n>\n> Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>\n> Signed-off-by: David Aguilar <davvid@gmail.com>\n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n> ---\n>  Makefile                     |  1 +\n>  compat/apple-common-crypto.h | 86 ++++++++++++++++++++++++++++++++++++++++++++\n>  git-compat-util.h            | 11 ++++++\n>  imap-send.c                  | 14 --------\n>  4 files changed, 98 insertions(+), 14 deletions(-)\n>  create mode 100644 compat/apple-common-crypto.h\n>\n> diff --git a/Makefile b/Makefile\n> index 5e7cadf..dddf49b 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -1398,6 +1398,7 @@ ifdef PPC_SHA1\n>         LIB_H += ppc/sha1.h\n>  else\n>  ifdef APPLE_COMMON_CRYPTO\n> +       LIB_4_CRYPTO += -framework Security -framework CoreFoundation\n>         COMPAT_CFLAGS += -DCOMMON_DIGEST_FOR_OPENSSL\n>         SHA1_HEADER = <CommonCrypto/CommonDigest.h>\n>  else\n> diff --git a/compat/apple-common-crypto.h b/compat/apple-common-crypto.h\n> new file mode 100644\n> index 0000000..c8b9b0e\n> --- /dev/null\n> +++ b/compat/apple-common-crypto.h\n> @@ -0,0 +1,86 @@\n> +/* suppress inclusion of conflicting openssl functions */\n> +#define OPENSSL_NO_MD5\n> +#define HEADER_HMAC_H\n> +#define HEADER_SHA_H\n> +#include <CommonCrypto/CommonHMAC.h>\n> +#define HMAC_CTX CCHmacContext\n> +#define HMAC_Init(hmac, key, len, algo) CCHmacInit(hmac, algo, key, len)\n> +#define HMAC_Update CCHmacUpdate\n> +#define HMAC_Final(hmac, hash, ptr) CCHmacFinal(hmac, hash)\n> +#define HMAC_CTX_cleanup(ignore)\n> +#define EVP_md5(...) kCCHmacAlgMD5\n> +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070\n> +#define APPLE_LION_OR_NEWER\n> +#include <Security/Security.h>\n> +/* Apple's TYPE_BOOL conflicts with config.c */\n> +#undef TYPE_BOOL\n> +#endif\n> +\n> +#ifdef APPLE_LION_OR_NEWER\n> +#define git_CC_error_check(pattern, err) \\\n> +       do { \\\n> +               if (err) { \\\n> +                       die(pattern, (long)CFErrorGetCode(err)); \\\n> +               } \\\n> +       } while(0)\n> +\n> +#define EVP_EncodeBlock git_CC_EVP_EncodeBlock\n> +static inline int git_CC_EVP_EncodeBlock(unsigned char *out,\n> +               const unsigned char *in, int inlen)\n> +{\n> +       CFErrorRef err;\n> +       SecTransformRef encoder;\n> +       CFDataRef input, output;\n> +       CFIndex length;\n> +\n> +       encoder = SecEncodeTransformCreate(kSecBase64Encoding, &err);\n> +       git_CC_error_check(\"SecEncodeTransformCreate failed: %ld\", err);\n> +\n> +       input = CFDataCreate(kCFAllocatorDefault, in, inlen);\n> +       SecTransformSetAttribute(encoder, kSecTransformInputAttributeName,\n> +                       input, &err);\n> +       git_CC_error_check(\"SecTransformSetAttribute failed: %ld\", err);\n> +\n> +       output = SecTransformExecute(encoder, &err);\n> +       git_CC_error_check(\"SecTransformExecute failed: %ld\", err);\n> +\n> +       length = CFDataGetLength(output);\n> +       CFDataGetBytes(output, CFRangeMake(0, length), out);\n> +\n> +       CFRelease(output);\n> +       CFRelease(input);\n> +       CFRelease(encoder);\n> +\n> +       return (int)strlen((const char *)out);\n> +}\n> +\n> +#define EVP_DecodeBlock git_CC_EVP_DecodeBlock\n> +static int inline git_CC_EVP_DecodeBlock(unsigned char *out,\n> +               const unsigned char *in, int inlen)\n> +{\n> +       CFErrorRef err;\n> +       SecTransformRef decoder;\n> +       CFDataRef input, output;\n> +       CFIndex length;\n> +\n> +       decoder = SecDecodeTransformCreate(kSecBase64Encoding, &err);\n> +       git_CC_error_check(\"SecEncodeTransformCreate failed: %ld\", err);\n> +\n> +       input = CFDataCreate(kCFAllocatorDefault, in, inlen);\n> +       SecTransformSetAttribute(decoder, kSecTransformInputAttributeName,\n> +                       input, &err);\n> +       git_CC_error_check(\"SecTransformSetAttribute failed: %ld\", err);\n> +\n> +       output = SecTransformExecute(decoder, &err);\n> +       git_CC_error_check(\"SecTransformExecute failed: %ld\", err);\n> +\n> +       length = CFDataGetLength(output);\n> +       CFDataGetBytes(output, CFRangeMake(0, length), out);\n> +\n> +       CFRelease(output);\n> +       CFRelease(input);\n> +       CFRelease(decoder);\n> +\n> +       return (int)strlen((const char *)out);\n> +}\n> +#endif /* APPLE_LION_OR_NEWER */\n> diff --git a/git-compat-util.h b/git-compat-util.h\n> index e955bb5..6ebb029 100644\n> --- a/git-compat-util.h\n> +++ b/git-compat-util.h\n> @@ -127,6 +127,17 @@\n>  #else\n>  #include <poll.h>\n>  #endif\n> +\n> +#ifndef NO_OPENSSL\n> +#ifdef APPLE_COMMON_CRYPTO\n> +#include \"compat/apple-common-crypto.h\"\n> +#else\n> +#include <openssl/evp.h>\n> +#include <openssl/hmac.h>\n> +#endif /* APPLE_COMMON_CRYPTO */\n> +#include <openssl/x509v3.h>\n> +#endif /* NO_OPENSSL */\n> +\n>  #if defined(__MINGW32__)\n>  /* pull in Windows compatibility stuff */\n>  #include \"compat/mingw.h\"\n> diff --git a/imap-send.c b/imap-send.c\n> index d6b65e2..6f5cc4f 100644\n> --- a/imap-send.c\n> +++ b/imap-send.c\n> @@ -28,20 +28,6 @@\n>  #include \"prompt.h\"\n>  #ifdef NO_OPENSSL\n>  typedef void *SSL;\n> -#else\n> -#ifdef APPLE_COMMON_CRYPTO\n> -#include <CommonCrypto/CommonHMAC.h>\n> -#define HMAC_CTX CCHmacContext\n> -#define HMAC_Init(hmac, key, len, algo) CCHmacInit(hmac, algo, key, len)\n> -#define HMAC_Update CCHmacUpdate\n> -#define HMAC_Final(hmac, hash, ptr) CCHmacFinal(hmac, hash)\n> -#define HMAC_CTX_cleanup(ignore)\n> -#define EVP_md5() kCCHmacAlgMD5\n> -#else\n> -#include <openssl/evp.h>\n> -#include <openssl/hmac.h>\n> -#endif\n> -#include <openssl/x509v3.h>\n>  #endif\n>\n>  static const char imap_send_usage[] = \"git imap-send < <mbox>\";\n> --\n> 1.8.4-rc0-137-g17832d4\n>\n>\n>\n\n\n\n-- \nDavid\n"}]}