git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/3] Makefile: fix default regex settings on Darwin
@ 2013-05-11  8:22 David Aguilar
  2013-05-11  8:22 ` [PATCH v2 2/3] imap-send: eliminate HMAC warnings on OS X 10.8 David Aguilar
  0 siblings, 1 reply; 8+ messages in thread
From: David Aguilar @ 2013-05-11  8:22 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Jonathan Nieder

t0070-fundamental.sh fails on Mac OS X 10.8:

	$ uname -a
	Darwin lustrous 12.2.0 Darwin Kernel Version 12.2.0:
	Sat Aug 25 00:48:52 PDT 2012;
	root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64

	$ ./t0070-fundamental.sh -v
	fatal: regex bug confirmed: re-build git with NO_REGEX=1

Fix it by using Git's regex library.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
---
Added uname output and Jonathan's review tag.

 Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile b/Makefile
index 0f931a2..f698c1a 100644
--- a/Makefile
+++ b/Makefile
@@ -1054,6 +1054,7 @@ ifeq ($(uname_S),Darwin)
 			BASIC_LDFLAGS += -L/opt/local/lib
 		endif
 	endif
+	NO_REGEX = YesPlease
 	PTHREAD_LIBS =
 endif
 
-- 
1.8.3.rc1.47.g41936fa

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 2/3] imap-send: eliminate HMAC warnings on OS X 10.8
  2013-05-11  8:22 [PATCH v2 1/3] Makefile: fix default regex settings on Darwin David Aguilar
@ 2013-05-11  8:22 ` David Aguilar
  2013-05-11  8:22   ` [PATCH v2 3/3] cache.h: eliminate SHA-1 deprecation " David Aguilar
  0 siblings, 1 reply; 8+ messages in thread
From: David Aguilar @ 2013-05-11  8:22 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Jonathan Nieder

Mac OS X Mountain Lion warns that HMAC_Init() and friends are
deprecated.  Use CommonCrypto's HMAC to eliminate the warnings.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
---
Rebased to 2/3.

 Makefile    |  5 +++++
 imap-send.c | 10 ++++++++++
 2 files changed, 15 insertions(+)

diff --git a/Makefile b/Makefile
index f698c1a..25282b4 100644
--- a/Makefile
+++ b/Makefile
@@ -1054,6 +1054,7 @@ ifeq ($(uname_S),Darwin)
 			BASIC_LDFLAGS += -L/opt/local/lib
 		endif
 	endif
+	COMMON_DIGEST_HMAC = YesPlease
 	NO_REGEX = YesPlease
 	PTHREAD_LIBS =
 endif
@@ -1393,6 +1394,10 @@ else
 	EXTLIBS += $(LIB_4_CRYPTO)
 endif
 endif
+
+ifdef COMMON_DIGEST_HMAC
+	BASIC_CFLAGS += -DCOMMON_DIGEST_FOR_HMAC=1
+endif
 ifdef NO_PERL_MAKEMAKER
 	export NO_PERL_MAKEMAKER
 endif
diff --git a/imap-send.c b/imap-send.c
index d9bcfb4..1b2e69c 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -29,8 +29,18 @@
 #ifdef NO_OPENSSL
 typedef void *SSL;
 #else
+#ifdef COMMON_DIGEST_FOR_HMAC
+#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
+#define EVP_md5() kCCHmacAlgMD5
+#else
 #include <openssl/evp.h>
 #include <openssl/hmac.h>
+#endif
 #include <openssl/x509v3.h>
 #endif
 
-- 
1.8.3.rc1.47.g41936fa

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 3/3] cache.h: eliminate SHA-1 deprecation warnings on OS X 10.8
  2013-05-11  8:22 ` [PATCH v2 2/3] imap-send: eliminate HMAC warnings on OS X 10.8 David Aguilar
@ 2013-05-11  8:22   ` David Aguilar
  2013-05-12 18:37     ` Eric Sunshine
  0 siblings, 1 reply; 8+ messages in thread
From: David Aguilar @ 2013-05-11  8:22 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Jonathan Nieder

Mac OS X Mountain Lion prints warnings when building git:

	warning: 'SHA1_Init' is deprecated
	(declared at /usr/include/openssl/sha.h:121)

Silence the warnings by using the Common Digest SHA-1
functions for SHA1_Init(), SHA1_Update(), and SHA1_Final().

Add a COMMON_DIGEST_SHA1 knob to the Makefile to allow
choosing this implementation and define it by default on Darwin.

Signed-off-by: David Aguilar <davvid@gmail.com>
---
Unchanged since last time; rebased to 3/3.

 Makefile | 7 +++++++
 cache.h  | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/Makefile b/Makefile
index 25282b4..8b2f9cc 100644
--- a/Makefile
+++ b/Makefile
@@ -1055,6 +1055,7 @@ ifeq ($(uname_S),Darwin)
 		endif
 	endif
 	COMMON_DIGEST_HMAC = YesPlease
+	COMMON_DIGEST_SHA1 = YesPlease
 	NO_REGEX = YesPlease
 	PTHREAD_LIBS =
 endif
@@ -1390,10 +1391,16 @@ ifdef PPC_SHA1
 	LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
 	LIB_H += ppc/sha1.h
 else
+ifdef COMMON_DIGEST_SHA1
+	BASIC_CFLAGS += -DCOMMON_DIGEST_FOR_SHA1=1
+	SHA1_HEADER = <CommonCrypto/CommonDigest.h>
+	EXTLIBS += $(LIB_4_CRYPTO)
+else
 	SHA1_HEADER = <openssl/sha.h>
 	EXTLIBS += $(LIB_4_CRYPTO)
 endif
 endif
+endif
 
 ifdef COMMON_DIGEST_HMAC
 	BASIC_CFLAGS += -DCOMMON_DIGEST_FOR_HMAC=1
diff --git a/cache.h b/cache.h
index 94ca1ac..e2b24c6 100644
--- a/cache.h
+++ b/cache.h
@@ -10,11 +10,18 @@
 
 #include SHA1_HEADER
 #ifndef git_SHA_CTX
+#ifdef COMMON_DIGEST_FOR_SHA1
+#define git_SHA_CTX	CC_SHA1_CTX
+#define git_SHA1_Init	CC_SHA1_Init
+#define git_SHA1_Update	CC_SHA1_Update
+#define git_SHA1_Final	CC_SHA1_Final
+#else
 #define git_SHA_CTX	SHA_CTX
 #define git_SHA1_Init	SHA1_Init
 #define git_SHA1_Update	SHA1_Update
 #define git_SHA1_Final	SHA1_Final
 #endif
+#endif
 
 #include <zlib.h>
 typedef struct git_zstream {
-- 
1.8.3.rc1.47.g41936fa

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 3/3] cache.h: eliminate SHA-1 deprecation warnings on OS X 10.8
  2013-05-11  8:22   ` [PATCH v2 3/3] cache.h: eliminate SHA-1 deprecation " David Aguilar
@ 2013-05-12 18:37     ` Eric Sunshine
  2013-05-12 20:57       ` David Aguilar
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Sunshine @ 2013-05-12 18:37 UTC (permalink / raw)
  To: David Aguilar; +Cc: Junio C Hamano, Git List, Jonathan Nieder

On Sat, May 11, 2013 at 4:22 AM, David Aguilar <davvid@gmail.com> wrote:
> Mac OS X Mountain Lion prints warnings when building git:
>
>         warning: 'SHA1_Init' is deprecated
>         (declared at /usr/include/openssl/sha.h:121)
>
> Silence the warnings by using the Common Digest SHA-1
> functions for SHA1_Init(), SHA1_Update(), and SHA1_Final().
>
> Add a COMMON_DIGEST_SHA1 knob to the Makefile to allow
> choosing this implementation and define it by default on Darwin.
>
> Signed-off-by: David Aguilar <davvid@gmail.com>
> ---
> Unchanged since last time; rebased to 3/3.

Ignore my earlier response. I had not seen your revised patches. With
this patch series, the SHA1_Foo() warnings are indeed resolved,
however, there are still a bunch of remaining deprecation warnings
regarding ERR_error_string, SSL_get_error, X509_get_ext_d2i, and so
forth.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 3/3] cache.h: eliminate SHA-1 deprecation warnings on OS X 10.8
  2013-05-12 18:37     ` Eric Sunshine
@ 2013-05-12 20:57       ` David Aguilar
  2013-05-12 21:25         ` Junio C Hamano
  2013-05-13  1:22         ` Eric Sunshine
  0 siblings, 2 replies; 8+ messages in thread
From: David Aguilar @ 2013-05-12 20:57 UTC (permalink / raw)
  To: Eric Sunshine; +Cc: Junio C Hamano, Git List, Jonathan Nieder

On Sun, May 12, 2013 at 11:37 AM, Eric Sunshine <sunshine@sunshineco.com> wrote:
> On Sat, May 11, 2013 at 4:22 AM, David Aguilar <davvid@gmail.com> wrote:
>> Mac OS X Mountain Lion prints warnings when building git:
>>
>>         warning: 'SHA1_Init' is deprecated
>>         (declared at /usr/include/openssl/sha.h:121)
>>
>> Silence the warnings by using the Common Digest SHA-1
>> functions for SHA1_Init(), SHA1_Update(), and SHA1_Final().
>>
>> Add a COMMON_DIGEST_SHA1 knob to the Makefile to allow
>> choosing this implementation and define it by default on Darwin.
>>
>> Signed-off-by: David Aguilar <davvid@gmail.com>
>> ---
>> Unchanged since last time; rebased to 3/3.
>
> Ignore my earlier response. I had not seen your revised patches. With
> this patch series, the SHA1_Foo() warnings are indeed resolved,
> however, there are still a bunch of remaining deprecation warnings
> regarding ERR_error_string, SSL_get_error, X509_get_ext_d2i, and so
> forth.

Yup, warnings still remain, but only in imap-send.c.  All the SHA1
ones are gone.  Those were particularly bothersome since they affected
several files.

I haven't dug to deeply into how to fix these.  In case anyone has any
pointers, the warnings look like this:

imap-send.c: In function ‘ssl_socket_perror’:
imap-send.c:185: warning: ‘ERR_error_string’ is deprecated (declared
at /usr/include/openssl/err.h:279)
imap-send.c:185: warning: ‘ERR_get_error’ is deprecated (declared at
/usr/include/openssl/err.h:266)
imap-send.c: In function ‘socket_perror’:
imap-send.c:193: warning: ‘SSL_get_error’ is deprecated (declared at
/usr/include/openssl/ssl.h:1501)
imap-send.c: In function ‘verify_hostname’:
imap-send.c:245: warning: ‘X509_get_ext_d2i’ is deprecated (declared
at /usr/include/openssl/x509.h:1151)
imap-send.c:246: warning: ‘sk_num’ is deprecated (declared at
/usr/include/openssl/stack.h:81)
imap-send.c:248: warning: ‘sk_value’ is deprecated (declared at
/usr/include/openssl/stack.h:82)
imap-send.c:254: warning: ‘sk_pop_free’ is deprecated (declared at
/usr/include/openssl/stack.h:89)
imap-send.c:260: warning: ‘X509_get_subject_name’ is deprecated
(declared at /usr/include/openssl/x509.h:1013)
imap-send.c:262: warning: ‘X509_NAME_get_text_by_NID’ is deprecated
(declared at /usr/include/openssl/x509.h:1099)
imap-send.c: In function ‘ssl_socket_connect’:
imap-send.c:281: warning: ‘SSL_library_init’ is deprecated (declared
at /usr/include/openssl/ssl.h:1553)
imap-send.c:282: warning: ‘SSL_load_error_strings’ is deprecated
(declared at /usr/include/openssl/ssl.h:1416)
imap-send.c:285: warning: ‘TLSv1_method’ is deprecated (declared at
/usr/include/openssl/ssl.h:1519)
imap-send.c:287: warning: ‘SSLv23_method’ is deprecated (declared at
/usr/include/openssl/ssl.h:1515)
imap-send.c:294: warning: ‘SSL_CTX_new’ is deprecated (declared at
/usr/include/openssl/ssl.h:1346)
imap-send.c:297: warning: ‘SSL_CTX_set_verify’ is deprecated (declared
at /usr/include/openssl/ssl.h:1459)
imap-send.c:299: warning: ‘SSL_CTX_set_default_verify_paths’ is
deprecated (declared at /usr/include/openssl/ssl.h:1570)
imap-send.c:303: warning: ‘SSL_new’ is deprecated (declared at
/usr/include/openssl/ssl.h:1481)
imap-send.c:308: warning: ‘SSL_set_rfd’ is deprecated (declared at
/usr/include/openssl/ssl.h:1371)
imap-send.c:312: warning: ‘SSL_set_wfd’ is deprecated (declared at
/usr/include/openssl/ssl.h:1372)
imap-send.c:323: warning: ‘SSL_ctrl’ is deprecated (declared at
/usr/include/openssl/ssl.h:1496)
imap-send.c:328: warning: ‘SSL_connect’ is deprecated (declared at
/usr/include/openssl/ssl.h:1492)
imap-send.c:336: warning: ‘SSL_get_peer_certificate’ is deprecated
(declared at /usr/include/openssl/ssl.h:1450)
imap-send.c: In function ‘socket_read’:
imap-send.c:352: warning: ‘SSL_read’ is deprecated (declared at
/usr/include/openssl/ssl.h:1493)
imap-send.c: In function ‘socket_write’:
imap-send.c:370: warning: ‘SSL_write’ is deprecated (declared at
/usr/include/openssl/ssl.h:1495)
imap-send.c: In function ‘socket_shutdown’:
imap-send.c:387: warning: ‘SSL_shutdown’ is deprecated (declared at
/usr/include/openssl/ssl.h:1532)
imap-send.c:388: warning: ‘SSL_free’ is deprecated (declared at
/usr/include/openssl/ssl.h:1490)
imap-send.c: In function ‘cram’:
imap-send.c:906: warning: ‘EVP_DecodeBlock’ is deprecated (declared at
/usr/include/openssl/evp.h:634)
imap-send.c:913: warning: statement with no effect
imap-send.c:927: warning: ‘EVP_EncodeBlock’ is deprecated (declared at
/usr/include/openssl/evp.h:627)

Cheers,
--
David

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 3/3] cache.h: eliminate SHA-1 deprecation warnings on OS X 10.8
  2013-05-12 20:57       ` David Aguilar
@ 2013-05-12 21:25         ` Junio C Hamano
  2013-05-12 21:47           ` David Aguilar
  2013-05-13  1:22         ` Eric Sunshine
  1 sibling, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2013-05-12 21:25 UTC (permalink / raw)
  To: David Aguilar; +Cc: Eric Sunshine, Git List, Jonathan Nieder

David Aguilar <davvid@gmail.com> writes:

> Yup, warnings still remain, but only in imap-send.c.  All the SHA1
> ones are gone.  Those were particularly bothersome since they affected
> several files.
>
> I haven't dug to deeply into how to fix these.  In case anyone has any
> pointers, the warnings look like this:
>
> imap-send.c: In function ‘ssl_socket_perror’:
> imap-send.c:185: warning: ‘ERR_error_string’ is deprecated (declared
> at /usr/include/openssl/err.h:279)

Hmph.

I thought your separate imap-send patch switched to CommonCrypto.
Why are you still including from /usr/include/openssl/?

By the way, is CommonCrypo anything "common"?  I am geting an
impression that it is an Apple-only thing, and if that is the case
the naming feels somewhat funny.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 3/3] cache.h: eliminate SHA-1 deprecation warnings on OS X 10.8
  2013-05-12 21:25         ` Junio C Hamano
@ 2013-05-12 21:47           ` David Aguilar
  0 siblings, 0 replies; 8+ messages in thread
From: David Aguilar @ 2013-05-12 21:47 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Eric Sunshine, Git List, Jonathan Nieder

On Sun, May 12, 2013 at 2:25 PM, Junio C Hamano <gitster@pobox.com> wrote:
> David Aguilar <davvid@gmail.com> writes:
>
>> Yup, warnings still remain, but only in imap-send.c.  All the SHA1
>> ones are gone.  Those were particularly bothersome since they affected
>> several files.
>>
>> I haven't dug to deeply into how to fix these.  In case anyone has any
>> pointers, the warnings look like this:
>>
>> imap-send.c: In function ‘ssl_socket_perror’:
>> imap-send.c:185: warning: ‘ERR_error_string’ is deprecated (declared
>> at /usr/include/openssl/err.h:279)
>
> Hmph.
>
> I thought your separate imap-send patch switched to CommonCrypto.
> Why are you still including from /usr/include/openssl/?
>
> By the way, is CommonCrypo anything "common"?  I am geting an
> impression that it is an Apple-only thing, and if that is the case
> the naming feels somewhat funny.

Far from common -- it's an Apple-ism.

The imap-send patch switches the HMAC parts to CommonCrypto and do
eliminate the HMAC warnings.  It still includes the x509 headers from
SSL.  I haven't figured those out.
--
David

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 3/3] cache.h: eliminate SHA-1 deprecation warnings on OS X 10.8
  2013-05-12 20:57       ` David Aguilar
  2013-05-12 21:25         ` Junio C Hamano
@ 2013-05-13  1:22         ` Eric Sunshine
  1 sibling, 0 replies; 8+ messages in thread
From: Eric Sunshine @ 2013-05-13  1:22 UTC (permalink / raw)
  To: David Aguilar; +Cc: Junio C Hamano, Git List, Jonathan Nieder

On Sat, May 11, 2013 at 4:22 AM, David Aguilar <davvid@gmail.com> wrote:
> Mac OS X Mountain Lion prints warnings when building git:
>
>         warning: 'SHA1_Init' is deprecated
>         (declared at /usr/include/openssl/sha.h:121)
>
> Silence the warnings by using the Common Digest SHA-1
> functions for SHA1_Init(), SHA1_Update(), and SHA1_Final().
>
> Add a COMMON_DIGEST_SHA1 knob to the Makefile to allow
> choosing this implementation and define it by default on Darwin.
>
> Signed-off-by: David Aguilar <davvid@gmail.com>
> ---
> Unchanged since last time; rebased to 3/3.
>
> diff --git a/cache.h b/cache.h
> index 94ca1ac..e2b24c6 100644
> --- a/cache.h
> +++ b/cache.h
>  @@ -10,11 +10,18 @@
>
>  #include SHA1_HEADER
>  #ifndef git_SHA_CTX
> +#ifdef COMMON_DIGEST_FOR_SHA1
> +#define git_SHA_CTX CC_SHA1_CTX
> +#define git_SHA1_Init CC_SHA1_Init
> +#define git_SHA1_Update CC_SHA1_Update
> +#define git_SHA1_Final CC_SHA1_Final
> +#else
>  #define git_SHA_CTX SHA_CTX
>  #define git_SHA1_Init SHA1_Init
>  #define git_SHA1_Update SHA1_Update
>  #define git_SHA1_Final SHA1_Final
>  #endif
> +#endif

Reading [*1*], it appears that you can get these defines for free by
#defining COMMON_DIGEST_FOR_OPENSSL before including
<CommonCrypto/CommonDigest.h>, so this patch hunk can be eliminated,
which is nice since you don't have to pollute cache.h with any
Apple-specific ugliness. Also, according to [*1*], you need only link
against libSystem (or System.framework), so you can drop the
$(LIB_4_CRYPTO) reference too. The entire patch therefore reduces to
(excuse whitespace corruption):

-->8--
diff --git a/Makefile b/Makefile
index 25282b4..a080d20 100644
--- a/Makefile
+++ b/Makefile
@@ -1055,6 +1055,7 @@ ifeq ($(uname_S),Darwin)
                endif
        endif
        COMMON_DIGEST_HMAC = YesPlease
+       COMMON_DIGEST_SHA1 = YesPlease
        NO_REGEX = YesPlease
        PTHREAD_LIBS =
 endif
@@ -1390,10 +1391,15 @@ ifdef PPC_SHA1
        LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
        LIB_H += ppc/sha1.h
 else
+ifdef COMMON_DIGEST_SHA1
+       BASIC_CFLAGS += -DCOMMON_DIGEST_FOR_OPENSSL
+       SHA1_HEADER = <CommonCrypto/CommonDigest.h>
+else
        SHA1_HEADER = <openssl/sha.h>
        EXTLIBS += $(LIB_4_CRYPTO)
 endif
 endif
+endif

 ifdef COMMON_DIGEST_HMAC
        BASIC_CFLAGS += -DCOMMON_DIGEST_FOR_HMAC=1
-->8--

[*1*] /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/CommonCrypto/CommonDigest.h

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-05-13  1:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-11  8:22 [PATCH v2 1/3] Makefile: fix default regex settings on Darwin David Aguilar
2013-05-11  8:22 ` [PATCH v2 2/3] imap-send: eliminate HMAC warnings on OS X 10.8 David Aguilar
2013-05-11  8:22   ` [PATCH v2 3/3] cache.h: eliminate SHA-1 deprecation " David Aguilar
2013-05-12 18:37     ` Eric Sunshine
2013-05-12 20:57       ` David Aguilar
2013-05-12 21:25         ` Junio C Hamano
2013-05-12 21:47           ` David Aguilar
2013-05-13  1:22         ` Eric Sunshine

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).