{"thread":{"id":"33804","subject":"[PATCH v3 3/3] cache.h: eliminate SHA-1 deprecation warnings on OS X 10.8","startedAt":"2013-05-13T07:20:35Z","lastAt":"2013-05-13T08:04:30Z","messageCount":3,"participants":["David Aguilar","Eric Sunshine"],"isPatch":true,"patchVersion":3,"patchTotal":3},"messages":[{"id":"217130","messageId":"1368429635-5512-1-git-send-email-davvid@gmail.com","threadId":"33804","inReplyTo":null,"subject":"[PATCH v3 3/3] cache.h: eliminate SHA-1 deprecation warnings on OS X 10.8","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2013-05-13T07:20:35Z","receivedAt":"2013-05-13T07:20:35Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"Mac OS X 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 Common Digest SHA-1\nfunctions for SHA1_Init(), SHA1_Update(), and SHA1_Final().\n\nAdd a COMMON_DIGEST_SHA1 option to the Makefile to allow\nchoosing this implementation and define it by default on Darwin.\n\nDefine COMMON_DIGEST_FOR_SHA1 to enable the OpenSSL compatibility\nmacros in CommonDigest.h.\n\nHelped-by: Eric Sunshine <sunshine@sunshineco.com>\nSigned-off-by: David Aguilar <davvid@gmail.com>\n---\nHere's a replacement patch for what's in pu.\nThis version uses the built-in #defines and can thus avoid\ntouching cache.h.\n\n Makefile | 6 ++++++\n 1 file changed, 6 insertions(+)\n\ndiff --git a/Makefile b/Makefile\nindex 25282b4..9d174b9 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1055,6 +1055,7 @@ ifeq ($(uname_S),Darwin)\n \t\tendif\n \tendif\n \tCOMMON_DIGEST_HMAC = YesPlease\n+\tCOMMON_DIGEST_SHA1 = YesPlease\n \tNO_REGEX = YesPlease\n \tPTHREAD_LIBS =\n endif\n@@ -1390,10 +1391,15 @@ ifdef PPC_SHA1\n \tLIB_OBJS += ppc/sha1.o ppc/sha1ppc.o\n \tLIB_H += ppc/sha1.h\n else\n+ifdef COMMON_DIGEST_SHA1\n+\tBASIC_CFLAGS += -DCOMMON_DIGEST_FOR_SHA1=1\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 COMMON_DIGEST_HMAC\n \tBASIC_CFLAGS += -DCOMMON_DIGEST_FOR_HMAC=1\n-- \n1.8.3.rc1.47.g1b7707e\n"},{"id":"217133","messageId":"CAPig+cRGkhA9xd0d3QG3kGZTV3EXe-_S0j0x1+NkucNg_NU4dQ@mail.gmail.com","threadId":"33804","inReplyTo":"1368429635-5512-1-git-send-email-davvid@gmail.com","subject":"Re: [PATCH v3 3/3] cache.h: eliminate SHA-1 deprecation warnings on OS X 10.8","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2013-05-13T07:55:54Z","receivedAt":"2013-05-13T07:55:54Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Mon, May 13, 2013 at 3:20 AM, David Aguilar <davvid@gmail.com> wrote:\n> Mac OS X 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 Common Digest SHA-1\n> functions for SHA1_Init(), SHA1_Update(), and SHA1_Final().\n>\n> Add a COMMON_DIGEST_SHA1 option to the Makefile to allow\n> choosing this implementation and define it by default on Darwin.\n>\n> Define COMMON_DIGEST_FOR_SHA1 to enable the OpenSSL compatibility\n> macros in CommonDigest.h.\n>\n> Helped-by: Eric Sunshine <sunshine@sunshineco.com>\n> Signed-off-by: David Aguilar <davvid@gmail.com>\n> ---\n> Here's a replacement patch for what's in pu.\n> This version uses the built-in #defines and can thus avoid\n> touching cache.h.\n>\n>  Makefile | 6 ++++++\n>  1 file changed, 6 insertions(+)\n>\n> diff --git a/Makefile b/Makefile\n> index 25282b4..9d174b9 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -1055,6 +1055,7 @@ ifeq ($(uname_S),Darwin)\n>                 endif\n>         endif\n>         COMMON_DIGEST_HMAC = YesPlease\n> +       COMMON_DIGEST_SHA1 = YesPlease\n>         NO_REGEX = YesPlease\n>         PTHREAD_LIBS =\n>  endif\n> @@ -1390,10 +1391,15 @@ ifdef PPC_SHA1\n>         LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o\n>         LIB_H += ppc/sha1.h\n>  else\n> +ifdef COMMON_DIGEST_SHA1\n> +       BASIC_CFLAGS += -DCOMMON_DIGEST_FOR_SHA1=1\n\nThis is incorrect. As noted in my previous email, you need to define\nCOMMON_DIGEST_FOR_OPENSSL, not COMMON_DIGEST_FOR_SHA1, in order for\nCommonDigest.h to provide the OpenSSL defines magically. Thus:\n\ns/COMMON_DIGEST_FOR_SHA1=1/COMMON_DIGEST_FOR_OPENSSL/\n\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 COMMON_DIGEST_HMAC\n>         BASIC_CFLAGS += -DCOMMON_DIGEST_FOR_HMAC=1\n> --\n> 1.8.3.rc1.47.g1b7707e\n>\n"},{"id":"217136","messageId":"CAJDDKr5Y0XZfiV8Xpm0KpbB5_nxAexBMhYnV5ZMwOznNSJ4PbA@mail.gmail.com","threadId":"33804","inReplyTo":"CAPig+cRGkhA9xd0d3QG3kGZTV3EXe-_S0j0x1+NkucNg_NU4dQ@mail.gmail.com","subject":"Re: [PATCH v3 3/3] cache.h: eliminate SHA-1 deprecation warnings on OS X 10.8","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2013-05-13T08:04:30Z","receivedAt":"2013-05-13T08:04:30Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"On Mon, May 13, 2013 at 12:55 AM, Eric Sunshine <sunshine@sunshineco.com> wrote:\n> On Mon, May 13, 2013 at 3:20 AM, David Aguilar <davvid@gmail.com> wrote:\n>> Mac OS X 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 Common Digest SHA-1\n>> functions for SHA1_Init(), SHA1_Update(), and SHA1_Final().\n>>\n>> Add a COMMON_DIGEST_SHA1 option to the Makefile to allow\n>> choosing this implementation and define it by default on Darwin.\n>>\n>> Define COMMON_DIGEST_FOR_SHA1 to enable the OpenSSL compatibility\n>> macros in CommonDigest.h.\n>>\n>> Helped-by: Eric Sunshine <sunshine@sunshineco.com>\n>> Signed-off-by: David Aguilar <davvid@gmail.com>\n>> ---\n>> Here's a replacement patch for what's in pu.\n>> This version uses the built-in #defines and can thus avoid\n>> touching cache.h.\n>>\n>>  Makefile | 6 ++++++\n>>  1 file changed, 6 insertions(+)\n>>\n>> diff --git a/Makefile b/Makefile\n>> index 25282b4..9d174b9 100644\n>> --- a/Makefile\n>> +++ b/Makefile\n>> @@ -1055,6 +1055,7 @@ ifeq ($(uname_S),Darwin)\n>>                 endif\n>>         endif\n>>         COMMON_DIGEST_HMAC = YesPlease\n>> +       COMMON_DIGEST_SHA1 = YesPlease\n>>         NO_REGEX = YesPlease\n>>         PTHREAD_LIBS =\n>>  endif\n>> @@ -1390,10 +1391,15 @@ ifdef PPC_SHA1\n>>         LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o\n>>         LIB_H += ppc/sha1.h\n>>  else\n>> +ifdef COMMON_DIGEST_SHA1\n>> +       BASIC_CFLAGS += -DCOMMON_DIGEST_FOR_SHA1=1\n>\n> This is incorrect. As noted in my previous email, you need to define\n> COMMON_DIGEST_FOR_OPENSSL, not COMMON_DIGEST_FOR_SHA1, in order for\n> CommonDigest.h to provide the OpenSSL defines magically. Thus:\n>\n> s/COMMON_DIGEST_FOR_SHA1=1/COMMON_DIGEST_FOR_OPENSSL/\n\nYes, you're right.  Strangely, it compiled just fine either way which\nis why I hadn't noticed.\n\nI'll resend along w/ a replacement for 2/3 to drop the \"=1\" in the -D\ndefinition.\n--\nDavid\n"}]}