{"thread":{"id":"33867","subject":"[PATCH v8 0/3] Begin replacing OpenSSL with CommonCrypto","startedAt":"2013-05-19T10:23:33Z","lastAt":"2013-05-21T22:39:15Z","messageCount":8,"participants":["Eric Sunshine","Junio C Hamano","Torsten Bögershausen","Jonathan Nieder","David Aguilar"],"isPatch":true,"patchVersion":8,"patchTotal":3},"messages":[{"id":"217855","messageId":"1368959016-23146-1-git-send-email-sunshine@sunshineco.com","threadId":"33867","inReplyTo":null,"subject":"[PATCH v8 0/3] Begin replacing OpenSSL with CommonCrypto","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2013-05-19T10:23:33Z","receivedAt":"2013-05-19T10:23:33Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"This is a re-roll of David Aguilar's patch series [1] which eliminates some\nof the OpenSSL deprecation warnings on Mac OS X.\n\nChanges since v7:\n- Avoid double-negation (#ifndef NO_APPLE_COMMON_CRYPTO)\n- Don't break imap-send.c for platforms other than Apple\n\n[1]: http://thread.gmane.org/gmane.comp.version-control.git/224744\n\nDavid Aguilar (3):\n  Makefile: add support for Apple CommonCrypto facility\n  cache.h: eliminate SHA-1 deprecation warnings on Mac OS X\n  imap-send: eliminate HMAC deprecation warnings on Mac OS X\n\n Makefile    | 14 ++++++++++++++\n imap-send.c | 10 ++++++++++\n 2 files changed, 24 insertions(+)\n\n-- \n1.8.2.3\n"},{"id":"217857","messageId":"1368959016-23146-2-git-send-email-sunshine@sunshineco.com","threadId":"33867","inReplyTo":"1368959016-23146-1-git-send-email-sunshine@sunshineco.com","subject":"[PATCH v8 1/3] Makefile: add support for Apple CommonCrypto facility","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2013-05-19T10:23:34Z","receivedAt":"2013-05-19T10:23:34Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"From: David Aguilar <davvid@gmail.com>\n\nAs of Mac OS X 10.7, Apple deprecated all OpenSSL functions due to\nOpenSSL ABI instability, thus leading to build warnings.  As a\nreplacement, Apple encourages developers to migrate to its own (stable)\nCommonCrypto facility.\n\nIntroduce boilerplate which controls whether Apple's CommonCrypto\nfacility is employed (enabled by default).  Also add a\nNO_APPLE_COMMON_CRYPTO build flag with which the user can opt out to\nuse OpenSSL instead.\n\n[es: extracted CommonCrypto-related Makefile boilerplate into separate\nintroductory patch]\n\nSigned-off-by: David Aguilar <davvid@gmail.com>\nSigned-off-by: Eric Sunshine <sunshine@sunshineco.com>\n---\n Makefile | 8 ++++++++\n 1 file changed, 8 insertions(+)\n\ndiff --git a/Makefile b/Makefile\nindex f698c1a..cd24c94 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -137,6 +137,10 @@ all::\n # specify your own (or DarwinPort's) include directories and\n # library directories by defining CFLAGS and LDFLAGS appropriately.\n #\n+# Define NO_APPLE_COMMON_CRYPTO if you are building on Darwin/Mac OS X\n+# and do not want to use Apple's CommonCrypto library.  This allows you\n+# to provide your own OpenSSL library, for example from MacPorts.\n+#\n # Define BLK_SHA1 environment variable to make use of the bundled\n # optimized C SHA1 routine.\n #\n@@ -1054,6 +1058,10 @@ ifeq ($(uname_S),Darwin)\n \t\t\tBASIC_LDFLAGS += -L/opt/local/lib\n \t\tendif\n \tendif\n+\tifndef NO_APPLE_COMMON_CRYPTO\n+\t\tAPPLE_COMMON_CRYPTO = YesPlease\n+\t\tCOMPAT_CFLAGS += -DAPPLE_COMMON_CRYPTO\n+\tendif\n \tNO_REGEX = YesPlease\n \tPTHREAD_LIBS =\n endif\n-- \n1.8.2.3\n"},{"id":"217856","messageId":"1368959016-23146-3-git-send-email-sunshine@sunshineco.com","threadId":"33867","inReplyTo":"1368959016-23146-1-git-send-email-sunshine@sunshineco.com","subject":"[PATCH v8 2/3] cache.h: eliminate SHA-1 deprecation warnings on Mac OS X","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2013-05-19T10:23:35Z","receivedAt":"2013-05-19T10:23:35Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"From: David Aguilar <davvid@gmail.com>\n\nAs of Mac OS X 10.7, Apple deprecated all OpenSSL functions due to\nOpenSSL ABI instability, thus leading to build diagnostics such as:\n\n\twarning: 'SHA1_Init' is deprecated\n\t(declared at /usr/include/openssl/sha.h:121)\n\nSilence the warnings by using Apple's CommonCrypto SHA-1 replacement\nfunctions for SHA1_Init(), SHA1_Update(), and SHA1_Final().\n\nCOMMON_DIGEST_FOR_OPENSSL is defined to instruct\n<CommonCrypto/CommonDigest.h> to provide compatibility macros\nassociating OpenSSL SHA-1 functions with their CommonCrypto\ncounterparts.\n\n[es: reworded commit message]\n\nSigned-off-by: David Aguilar <davvid@gmail.com>\nSigned-off-by: Eric Sunshine <sunshine@sunshineco.com>\n---\n Makefile | 6 ++++++\n 1 file changed, 6 insertions(+)\n\ndiff --git a/Makefile b/Makefile\nindex cd24c94..5e7cadf 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1397,10 +1397,16 @@ ifdef PPC_SHA1\n \tLIB_OBJS += ppc/sha1.o ppc/sha1ppc.o\n \tLIB_H += ppc/sha1.h\n else\n+ifdef APPLE_COMMON_CRYPTO\n+\tCOMPAT_CFLAGS += -DCOMMON_DIGEST_FOR_OPENSSL\n+\tSHA1_HEADER = <CommonCrypto/CommonDigest.h>\n+else\n \tSHA1_HEADER = <openssl/sha.h>\n \tEXTLIBS += $(LIB_4_CRYPTO)\n endif\n endif\n+endif\n+\n ifdef NO_PERL_MAKEMAKER\n \texport NO_PERL_MAKEMAKER\n endif\n-- \n1.8.2.3\n"},{"id":"217858","messageId":"1368959016-23146-4-git-send-email-sunshine@sunshineco.com","threadId":"33867","inReplyTo":"1368959016-23146-1-git-send-email-sunshine@sunshineco.com","subject":"[PATCH v8 3/3] imap-send: eliminate HMAC deprecation warnings on Mac OS X","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2013-05-19T10:23:36Z","receivedAt":"2013-05-19T10:23:36Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"From: David Aguilar <davvid@gmail.com>\n\nAs of Mac OS X 10.7, Apple deprecated all OpenSSL functions due to\nOpenSSL ABI instability.  Silence the warnings by using Apple's\nCommonCrypto HMAC replacement functions.\n\n[es: reworded commit message; check APPLE_COMMON_CRYPTO instead of\nabusing COMMON_DIGEST_FOR_OPENSSL]\n\nSigned-off-by: David Aguilar <davvid@gmail.com>\nSigned-off-by: Eric Sunshine <sunshine@sunshineco.com>\n---\nJunio Hamano writes:\n> Doesn't this mean people on platforms that do not care what Apple\n> does have to define NO_APPLE_COMMON_CRYPTO?\n\nIt certainly does break other platforms. Thanks for catching.\n\n> How about stopping this double-negation and do it more like this?\n\nDouble-negation begone.\n\n imap-send.c | 10 ++++++++++\n 1 file changed, 10 insertions(+)\n\ndiff --git a/imap-send.c b/imap-send.c\nindex d9bcfb4..8ea180f 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -29,8 +29,18 @@\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\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-- \n1.8.2.3\n"},{"id":"218017","messageId":"7vfvxhs1pz.fsf@alter.siamese.dyndns.org","threadId":"33867","inReplyTo":"1368959016-23146-1-git-send-email-sunshine@sunshineco.com","subject":"Re: [PATCH v8 0/3] Begin replacing OpenSSL with CommonCrypto","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-05-20T22:52:56Z","receivedAt":"2013-05-20T22:52:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks, will replace da/darwin with this round.\n"},{"id":"218083","messageId":"519BC8B0.5050100@web.de","threadId":"33867","inReplyTo":"7vfvxhs1pz.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v8 0/3] Begin replacing OpenSSL with CommonCrypto","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2013-05-21T19:19:12Z","receivedAt":"2013-05-21T19:19:12Z","isPatch":true,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On 2013-05-21 00.52, Junio C Hamano wrote:\n> Thanks, will replace da/darwin with this round.\n(May be late response, not sure if this is the right email thread.\nI eventually managed to compile under 10.6, what we have on pu)\n\nOne minor nit, or 2:\nimap-send.c: In function ‘cram’:\nimap-send.c:913: warning: statement with no effect\n\nThis fixes it:\n\ndiff --git a/imap-send.c b/imap-send.c\nindex 8ea180f..11577c9 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -35,7 +35,7 @@ typedef void *SSL;\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\n+#define HMAC_CTX_cleanup(c)\n#define EVP_md5() kCCHmacAlgMD5\n#else\n#include <openssl/evp.h>\n\n\n(And I think there are more minor nits:\n#define HMAC_Final(hmac, hash, ptr) CCHmacFinal(hmac, hash)\ncould be written as\n#define HMAC_Final(hmac, hash, ptr) CCHmacFinal((hmac), (hash))\n(Use paranthese around each parameter)\nSimilar change for HMAC_Init()\n\n/Torsten\n"},{"id":"218085","messageId":"20130521193616.GU3657@google.com","threadId":"33867","inReplyTo":"519BC8B0.5050100@web.de","subject":"Re: [PATCH v8 0/3] Begin replacing OpenSSL with CommonCrypto","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2013-05-21T19:36:16Z","receivedAt":"2013-05-21T19:36:16Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Torsten Bögershausen wrote:\n\n> One minor nit, or 2:\n> imap-send.c: In function ‘cram’:\n> imap-send.c:913: warning: statement with no effect\n>\n> This fixes it:\n>\n> diff --git a/imap-send.c b/imap-send.c\n> index 8ea180f..11577c9 100644\n> --- a/imap-send.c\n> +++ b/imap-send.c\n> @@ -35,7 +35,7 @@ typedef void *SSL;\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\n> +#define HMAC_CTX_cleanup(c)\n> #define EVP_md5() kCCHmacAlgMD5\n> #else\n> #include <openssl/evp.h>\n\nGood catch.  Thanks.\n\n> (And I think there are more minor nits:\n> #define HMAC_Final(hmac, hash, ptr) CCHmacFinal(hmac, hash)\n> could be written as\n> #define HMAC_Final(hmac, hash, ptr) CCHmacFinal((hmac), (hash))\n> (Use paranthese around each parameter)\n> Similar change for HMAC_Init()\n\nNot needed --- the comma operator has lower precedence than any other,\nand any expression containing commas would have to already be\nsurrounded by parentheses to be an argument to this function-like\nmacro.\n\nJonathan\n"},{"id":"218106","messageId":"CAJDDKr61R0aPFWT=vNz3nSvR-1azTG3Zox=wAO7rB_iCvxhdZg@mail.gmail.com","threadId":"33867","inReplyTo":"519BC8B0.5050100@web.de","subject":"Re: [PATCH v8 0/3] Begin replacing OpenSSL with CommonCrypto","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2013-05-21T22:39:15Z","receivedAt":"2013-05-21T22:39:15Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"On Tue, May 21, 2013 at 12:19 PM, Torsten Bögershausen <tboegi@web.de> wrote:\n> On 2013-05-21 00.52, Junio C Hamano wrote:\n>> Thanks, will replace da/darwin with this round.\n> (May be late response, not sure if this is the right email thread.\n> I eventually managed to compile under 10.6, what we have on pu)\n>\n> One minor nit, or 2:\n> imap-send.c: In function ‘cram’:\n> imap-send.c:913: warning: statement with no effect\n>\n> This fixes it:\n>\n> diff --git a/imap-send.c b/imap-send.c\n> index 8ea180f..11577c9 100644\n> --- a/imap-send.c\n> +++ b/imap-send.c\n> @@ -35,7 +35,7 @@ typedef void *SSL;\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\n> +#define HMAC_CTX_cleanup(c)\n> #define EVP_md5() kCCHmacAlgMD5\n> #else\n> #include <openssl/evp.h>\n\nThanks.  This change compiles fine on Mountain Lion (10.8) as well.\n--\nDavid\n"}]}