{"thread":{"id":"33830","subject":"[PATCH v6 1/2] cache.h: eliminate SHA-1 deprecation warnings on Mac OS X","startedAt":"2013-05-16T00:11:59Z","lastAt":"2013-05-16T04:53:06Z","messageCount":7,"participants":["David Aguilar","Junio C Hamano"],"isPatch":true,"patchVersion":6,"patchTotal":2},"messages":[{"id":"217487","messageId":"1368663120-47102-1-git-send-email-davvid@gmail.com","threadId":"33830","inReplyTo":null,"subject":"[PATCH v6 1/2] cache.h: eliminate SHA-1 deprecation warnings on Mac OS X","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2013-05-16T00:11:59Z","receivedAt":"2013-05-16T00:11:59Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"Mac OS X 10.8 Mountain Lion prints warnings when building git:\n\n\twarning: 'SHA1_Init' is deprecated\n\t(declared at /usr/include/openssl/sha.h:121)\n\nSilence the warnings by using the CommonCrytpo SHA-1\nfunctions for SHA1_Init(), SHA1_Update(), and SHA1_Final().\n\nAdd a NO_COMMON_DIGEST_FOR_OPENSSL option to the Makefile to allow\nusers to opt out of using this library.  When defined, Git will\nuse OpenSSL instead.\n\nCOMMON_DIGEST_FOR_OPENSSL is defined to enable the OpenSSL\ncompatibility macros in CommonDigest.h.\n\nHelped-by: Eric Sunshine <sunshine@sunshineco.com>\nHelped-by: Torsten Bögershausen <tboegi@web.de>\nSigned-off-by: David Aguilar <davvid@gmail.com>\n---\nChanges since last time:\n\nName the Makefile variable after the #define for consistency.\n\n Makefile | 13 +++++++++++++\n 1 file changed, 13 insertions(+)\n\ndiff --git a/Makefile b/Makefile\nindex f698c1a..b0eb949 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_COMMON_DIGEST_FOR_OPENSSL if you are building on Darwin/Mac OS X\n+# and do not want to use Apple's CommonCrypto library.  This allows you to\n+# 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,9 @@ ifeq ($(uname_S),Darwin)\n \t\t\tBASIC_LDFLAGS += -L/opt/local/lib\n \t\tendif\n \tendif\n+\tifndef NO_COMMON_DIGEST_FOR_OPENSSL\n+\t\tCOMMON_DIGEST_FOR_OPENSSL = YesPlease\n+\tendif\n \tNO_REGEX = YesPlease\n \tPTHREAD_LIBS =\n endif\n@@ -1389,10 +1396,16 @@ ifdef PPC_SHA1\n \tLIB_OBJS += ppc/sha1.o ppc/sha1ppc.o\n \tLIB_H += ppc/sha1.h\n else\n+ifdef COMMON_DIGEST_FOR_OPENSSL\n+\tBASIC_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.3.rc2.3.g81576a6\n"},{"id":"217488","messageId":"1368663120-47102-2-git-send-email-davvid@gmail.com","threadId":"33830","inReplyTo":"1368663120-47102-1-git-send-email-davvid@gmail.com","subject":"[PATCH v6 2/2] imap-send: eliminate HMAC deprecation warnings on Mac OS X","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2013-05-16T00:12:00Z","receivedAt":"2013-05-16T00:12:00Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"Mac OS X 10.8 Mountain Lion warns that HMAC_Init() and friends\nare deprecated.  Detect the COMMON_CRYPTO_FOR_OPENSSL definition\nand use CommonCrypto's HMAC functions to eliminate the warnings.\n\nSigned-off-by: David Aguilar <davvid@gmail.com>\n---\nChanges since last time: None.\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..96012b1 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 COMMON_DIGEST_FOR_OPENSSL\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.3.rc2.3.g81576a6\n"},{"id":"217491","messageId":"7vbo8bahh7.fsf@alter.siamese.dyndns.org","threadId":"33830","inReplyTo":"1368663120-47102-1-git-send-email-davvid@gmail.com","subject":"Re: [PATCH v6 1/2] cache.h: eliminate SHA-1 deprecation warnings on Mac OS X","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-05-16T00:36:20Z","receivedAt":"2013-05-16T00:36:20Z","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> Mac OS X 10.8 Mountain Lion prints warnings when building git:\n>\n> \twarning: 'SHA1_Init' is deprecated\n> \t(declared at /usr/include/openssl/sha.h:121)\n>\n> Silence the warnings by using the CommonCrytpo SHA-1\n> functions for SHA1_Init(), SHA1_Update(), and SHA1_Final().\n>\n> Add a NO_COMMON_DIGEST_FOR_OPENSSL option to the Makefile to allow\n> users to opt out of using this library.  When defined, Git will\n> use OpenSSL instead.\n>\n> COMMON_DIGEST_FOR_OPENSSL is defined to enable the OpenSSL\n> compatibility macros in CommonDigest.h.\n\nThis symbol will also cover not just SHA but also HMAC, would it\nmake more sense to call it COMMON_CRYPTO_FOR_OPENSSL?  After all,\nthat is what Apple calls this library, no?\n\n\n>\n> Helped-by: Eric Sunshine <sunshine@sunshineco.com>\n> Helped-by: Torsten Bögershausen <tboegi@web.de>\n> Signed-off-by: David Aguilar <davvid@gmail.com>\n> ---\n> Changes since last time:\n>\n> Name the Makefile variable after the #define for consistency.\n>\n>  Makefile | 13 +++++++++++++\n>  1 file changed, 13 insertions(+)\n>\n> diff --git a/Makefile b/Makefile\n> index f698c1a..b0eb949 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_COMMON_DIGEST_FOR_OPENSSL if you are building on Darwin/Mac OS X\n> +# and do not want to use Apple's CommonCrypto library.  This allows you to\n> +# 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,9 @@ ifeq ($(uname_S),Darwin)\n>  \t\t\tBASIC_LDFLAGS += -L/opt/local/lib\n>  \t\tendif\n>  \tendif\n> +\tifndef NO_COMMON_DIGEST_FOR_OPENSSL\n> +\t\tCOMMON_DIGEST_FOR_OPENSSL = YesPlease\n> +\tendif\n>  \tNO_REGEX = YesPlease\n>  \tPTHREAD_LIBS =\n>  endif\n> @@ -1389,10 +1396,16 @@ ifdef PPC_SHA1\n>  \tLIB_OBJS += ppc/sha1.o ppc/sha1ppc.o\n>  \tLIB_H += ppc/sha1.h\n>  else\n> +ifdef COMMON_DIGEST_FOR_OPENSSL\n> +\tBASIC_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"},{"id":"217492","messageId":"7v7gizahcn.fsf@alter.siamese.dyndns.org","threadId":"33830","inReplyTo":"1368663120-47102-2-git-send-email-davvid@gmail.com","subject":"Re: [PATCH v6 2/2] imap-send: eliminate HMAC deprecation warnings on Mac OS X","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-05-16T00:39:04Z","receivedAt":"2013-05-16T00:39:04Z","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> Mac OS X 10.8 Mountain Lion warns that HMAC_Init() and friends\n> are deprecated.  Detect the COMMON_CRYPTO_FOR_OPENSSL definition\n\nAhh, I think you meant to use that name but forgot to adjust the\nsymbol you use in the patch ;-)\n\nI'll queue with s/COMMON_DIGEST_FOR_OPENSSL/COMMON_CRYPTO_FOR_OPENSSL/;\n\n> and use CommonCrypto's HMAC functions to eliminate the warnings.\n>\n> Signed-off-by: David Aguilar <davvid@gmail.com>\n> ---\n> Changes since last time: None.\n>\n>  imap-send.c | 10 ++++++++++\n>  1 file changed, 10 insertions(+)\n>\n> diff --git a/imap-send.c b/imap-send.c\n> index d9bcfb4..96012b1 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 COMMON_DIGEST_FOR_OPENSSL\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"},{"id":"217495","messageId":"CAJDDKr7N8xbUxDDzy+BijiJet6C3KV1O-B4tmWRFuZ5odQUuEQ@mail.gmail.com","threadId":"33830","inReplyTo":"7v7gizahcn.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v6 2/2] imap-send: eliminate HMAC deprecation warnings on Mac OS X","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2013-05-16T03:28:33Z","receivedAt":"2013-05-16T03:28:33Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"On Wed, May 15, 2013 at 5:39 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> David Aguilar <davvid@gmail.com> writes:\n>\n>> Mac OS X 10.8 Mountain Lion warns that HMAC_Init() and friends\n>> are deprecated.  Detect the COMMON_CRYPTO_FOR_OPENSSL definition\n>\n> Ahh, I think you meant to use that name but forgot to adjust the\n> symbol you use in the patch ;-)\n>\n> I'll queue with s/COMMON_DIGEST_FOR_OPENSSL/COMMON_CRYPTO_FOR_OPENSSL/;\n\nThe symbol in Apple's header is COMMON_DIGEST_FOR_OPENSSL.\n\nI rebased this patch for so many bikesheds I was bound to screw up the\ncommit message ;-)\n\n>> diff --git a/imap-send.c b/imap-send.c\n>> index d9bcfb4..96012b1 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 COMMON_DIGEST_FOR_OPENSSL\n\nYup, the symbol is fine.\n\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\n\n--\nDavid\n"},{"id":"217496","messageId":"CAJDDKr7VavpBhE_w6NKP+ZxB2YBmwW6mQ-Po763p7v5GmHzoPg@mail.gmail.com","threadId":"33830","inReplyTo":"7vbo8bahh7.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v6 1/2] cache.h: eliminate SHA-1 deprecation warnings on Mac OS X","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2013-05-16T03:31:42Z","receivedAt":"2013-05-16T03:31:42Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"On Wed, May 15, 2013 at 5:36 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> David Aguilar <davvid@gmail.com> writes:\n>\n>> Mac OS X 10.8 Mountain Lion prints warnings when building git:\n>>\n>>       warning: 'SHA1_Init' is deprecated\n>>       (declared at /usr/include/openssl/sha.h:121)\n>>\n>> Silence the warnings by using the CommonCrytpo SHA-1\n>> functions for SHA1_Init(), SHA1_Update(), and SHA1_Final().\n>>\n>> Add a NO_COMMON_DIGEST_FOR_OPENSSL option to the Makefile to allow\n>> users to opt out of using this library.  When defined, Git will\n>> use OpenSSL instead.\n>>\n>> COMMON_DIGEST_FOR_OPENSSL is defined to enable the OpenSSL\n>> compatibility macros in CommonDigest.h.\n>\n> This symbol will also cover not just SHA but also HMAC, would it\n> make more sense to call it COMMON_CRYPTO_FOR_OPENSSL?  After all,\n> that is what Apple calls this library, no?\n\nThey call it COMMON_DIGEST_FOR_OPENSSL.  weirdos,\nbut I guess they mean it's for the digest functions.\n\nThanks for catching the commit message typo.\n\n>>\n>> Helped-by: Eric Sunshine <sunshine@sunshineco.com>\n>> Helped-by: Torsten Bögershausen <tboegi@web.de>\n>> Signed-off-by: David Aguilar <davvid@gmail.com>\n>> ---\n>> Changes since last time:\n>>\n>> Name the Makefile variable after the #define for consistency.\n>>\n>>  Makefile | 13 +++++++++++++\n>>  1 file changed, 13 insertions(+)\n>>\n>> diff --git a/Makefile b/Makefile\n>> index f698c1a..b0eb949 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_COMMON_DIGEST_FOR_OPENSSL if you are building on Darwin/Mac OS X\n>> +# and do not want to use Apple's CommonCrypto library.  This allows you to\n>> +# 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,9 @@ ifeq ($(uname_S),Darwin)\n>>                       BASIC_LDFLAGS += -L/opt/local/lib\n>>               endif\n>>       endif\n>> +     ifndef NO_COMMON_DIGEST_FOR_OPENSSL\n>> +             COMMON_DIGEST_FOR_OPENSSL = YesPlease\n>> +     endif\n>>       NO_REGEX = YesPlease\n>>       PTHREAD_LIBS =\n>>  endif\n>> @@ -1389,10 +1396,16 @@ ifdef PPC_SHA1\n>>       LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o\n>>       LIB_H += ppc/sha1.h\n>>  else\n>> +ifdef COMMON_DIGEST_FOR_OPENSSL\n>> +     BASIC_CFLAGS += -DCOMMON_DIGEST_FOR_OPENSSL\n>> +     SHA1_HEADER = <CommonCrypto/CommonDigest.h>\n>> +else\n>>       SHA1_HEADER = <openssl/sha.h>\n>>       EXTLIBS += $(LIB_4_CRYPTO)\n>>  endif\n>>  endif\n>> +endif\n>> +\n>>  ifdef NO_PERL_MAKEMAKER\n>>       export NO_PERL_MAKEMAKER\n>>  endif\n\n\n\n--\nDavid\n"},{"id":"217506","messageId":"7vwqqz8r0t.fsf@alter.siamese.dyndns.org","threadId":"33830","inReplyTo":"CAJDDKr7N8xbUxDDzy+BijiJet6C3KV1O-B4tmWRFuZ5odQUuEQ@mail.gmail.com","subject":"Re: [PATCH v6 2/2] imap-send: eliminate HMAC deprecation warnings on Mac OS X","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-05-16T04:53:06Z","receivedAt":"2013-05-16T04:53:06Z","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> On Wed, May 15, 2013 at 5:39 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>> David Aguilar <davvid@gmail.com> writes:\n>>\n>>> Mac OS X 10.8 Mountain Lion warns that HMAC_Init() and friends\n>>> are deprecated.  Detect the COMMON_CRYPTO_FOR_OPENSSL definition\n>>\n>> Ahh, I think you meant to use that name but forgot to adjust the\n>> symbol you use in the patch ;-)\n>>\n>> I'll queue with s/COMMON_DIGEST_FOR_OPENSSL/COMMON_CRYPTO_FOR_OPENSSL/;\n>\n> The symbol in Apple's header is COMMON_DIGEST_FOR_OPENSSL.\n\nSigh.\n"}]}