changeset 3287:5e2851e5d048

* src/msvc-nettle-1.patch: Update to nettle 2.7.
author Michael Goffioul <michael.goffioul@gmail.com>
date Tue, 05 Nov 2013 20:03:44 -0500
parents 29e227f8bef6
children 55c51f5ec98d
files src/msvc-nettle-1.patch
diffstat 1 files changed, 138 insertions(+), 81 deletions(-) [+]
line wrap: on
line diff
--- a/src/msvc-nettle-1.patch	Tue Nov 05 09:05:23 2013 -0500
+++ b/src/msvc-nettle-1.patch	Tue Nov 05 20:03:44 2013 -0500
@@ -1,8 +1,17 @@
-diff -ur nettle-2.5-orig/Makefile.in nettle-2.5/Makefile.in
---- nettle-2.5-orig/Makefile.in	2012-07-07 09:27:54 -0400
-+++ nettle-2.5/Makefile.in	2013-06-22 13:11:19 -0400
-@@ -161,6 +161,9 @@
- hogweed_OBJS = $(hogweed_SOURCES:.c=.$(OBJEXT))
+diff -ur nettle-2.7-orig/Makefile.in nettle-2.7/Makefile.in
+--- nettle-2.7-orig/Makefile.in	2013-11-05 14:51:27 -0500
++++ nettle-2.7/Makefile.in	2013-11-05 18:04:21 -0500
+@@ -16,7 +16,7 @@
+ 
+ OPT_ASM_SOURCES = @OPT_ASM_SOURCES@
+ 
+-SUBDIRS = tools testsuite examples
++SUBDIRS = tools #testsuite examples
+ 
+ include config.make
+ 
+@@ -197,6 +197,9 @@
+ hogweed_OBJS = $(hogweed_SOURCES:.c=.$(OBJEXT)) $(OPT_ASM_SOURCES:.asm=.$(OBJEXT))
  hogweed_PURE_OBJS = $(hogweed_OBJS:.$(OBJEXT)=.p$(OBJEXT))
  
 +$(nettle_OBJS): PRE_CPPFLAGS += -DBUILDING_NETTLE
@@ -11,34 +20,31 @@
  libnettle.a: $(nettle_OBJS)
  	-rm -f $@
  	$(AR) $(ARFLAGS) $@ $(nettle_OBJS)
-@@ -211,7 +214,7 @@
- 	$(LINK) twofishdata.$(OBJEXT) $(LIBS) -o twofishdata$(EXEEXT)
+@@ -252,7 +255,7 @@
+ 	-o twofishdata$(EXEEXT_FOR_BUILD)
  
- shadata$(EXEEXT): shadata.$(OBJEXT)
--	$(LINK) shadata.$(OBJEXT) $(LIBS) -lm -o shadata$(EXEEXT)
-+	$(LINK) shadata.$(OBJEXT) $(LIBS) -o shadata$(EXEEXT)
+ shadata$(EXEEXT_FOR_BUILD): shadata.c
+-	$(CC_FOR_BUILD) `test -f shadata.c || echo '$(srcdir)/'`shadata.c -lm \
++	$(CC_FOR_BUILD) `test -f shadata.c || echo '$(srcdir)/'`shadata.c \
+ 	-o shadata$(EXEEXT_FOR_BUILD)
  
- gcmdata$(EXEEXT): gcmdata.$(OBJEXT)
- 	$(LINK) gcmdata.$(OBJEXT) $(LIBS) -o gcmdata$(EXEEXT)
-@@ -236,13 +239,13 @@
- .asm.$(OBJEXT):
- 	$(M4) $(srcdir)/asm.m4 machine.m4 config.m4 \
- 		$< >$*.s
--	$(COMPILE) $(CCPIC_MAYBE) -c $*.s
-+	$(COMPILE_AS) $(CCPIC_MAYBE) -c $*.s
- 	echo "$@ : $< $(srcdir)/asm.m4 machine.m4 config.m4" >$@.d 
+ gcmdata$(EXEEXT_FOR_BUILD): gcmdata.c
+@@ -340,10 +343,10 @@
+ 	&& test -s $@T && mv -f $@T $@
  
- .asm.p$(OBJEXT):
- 	$(M4) $(srcdir)/asm.m4 machine.m4 config.m4 \
- 		$< >$*.s
--	$(COMPILE) $(SHLIBCFLAGS) -c $*.s -o $@
-+	$(COMPILE_AS) $(SHLIBCFLAGS) -c $*.s -o $@
- 	echo "$@ : $< $(srcdir)/asm.m4 machine.m4 config.m4" >$@.d 
+ .s.$(OBJEXT):
+-	$(COMPILE) $(CCPIC_MAYBE) -c $<
++	$(COMPILE_AS) $(CCPIC_MAYBE) -c $<
+ 
+ .s.p$(OBJEXT):
+-	$(COMPILE) $(SHLIBCFLAGS) -c $< -o $@
++	$(COMPILE_AS) $(SHLIBCFLAGS) -c $< -o $@
  
  # Texinfo rules
-diff -ur nettle-2.5-orig/config.make.in nettle-2.5/config.make.in
---- nettle-2.5-orig/config.make.in	2012-07-07 09:27:54 -0400
-+++ nettle-2.5/config.make.in	2013-06-22 13:11:19 -0400
+ .texinfo.info:
+diff -ur nettle-2.7-orig/config.make.in nettle-2.7/config.make.in
+--- nettle-2.7-orig/config.make.in	2013-04-24 09:26:53 -0400
++++ nettle-2.7/config.make.in	2013-11-05 14:56:57 -0500
 @@ -1,6 +1,7 @@
  # Makefile settings shared between Makefiles.
  
@@ -47,18 +53,18 @@
  CXX = @CXX@
  CFLAGS = @CFLAGS@
  CXXFLAGS = @CXXFLAGS@
-@@ -68,6 +69,7 @@
+@@ -72,6 +73,7 @@
+ # flags before CPPFLAGS and LDFLAGS.
  
  COMPILE = $(CC) $(PRE_CPPFLAGS) $(CPPFLAGS) $(DEFS) $(CFLAGS) $(CCPIC) $(DEP_FLAGS)
++COMPILE_AS = $(CCAS) $(PRE_CPPFLAGS) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) $(CCPIC) $(DEP_FLAGS)
  COMPILE_CXX = $(CXX) $(PRE_CPPFLAGS) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) $(CCPIC) $(DEP_FLAGS)
-+COMPILE_AS = $(CCAS) $(PRE_CPPFLAGS) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) $(CCPIC) $(DEP_FLAGS)
  LINK = $(CC) $(CFLAGS) $(PRE_LDFLAGS) $(LDFLAGS)
  LINK_CXX = $(CXX) $(CXXFLAGS) $(PRE_LDFLAGS) $(LDFLAGS)
- 
-diff -ur nettle-2.5-orig/configure nettle-2.5/configure
---- nettle-2.5-orig/configure	2012-07-07 09:27:54 -0400
-+++ nettle-2.5/configure	2013-06-22 13:11:19 -0400
-@@ -656,6 +656,7 @@
+diff -ur nettle-2.7-orig/configure nettle-2.7/configure
+--- nettle-2.7-orig/configure	2013-04-24 09:26:53 -0400
++++ nettle-2.7/configure	2013-11-05 14:59:15 -0500
+@@ -693,6 +693,7 @@
  LDFLAGS
  CFLAGS
  CC
@@ -66,7 +72,16 @@
  host_os
  host_vendor
  host_cpu
-@@ -4718,7 +4719,7 @@
+@@ -4764,7 +4765,7 @@
+ 	vmlal.u32	q1, d0, d1
+ 
+ EOF
+-gmp_assemble="$CC $CFLAGS $CPPFLAGS -c conftest.s >conftest.out 2>&1"
++gmp_assemble="$CCAS $CFLAGS $CPPFLAGS -c conftest.s >conftest.out 2>&1"
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_assemble\""; } >&5
+   (eval $gmp_assemble) 2>&5
+   ac_status=$?
+@@ -5106,7 +5107,7 @@
  .size foo, .Lend - foo
  
  EOF
@@ -75,7 +90,7 @@
  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_assemble\""; } >&5
    (eval $gmp_assemble) 2>&5
    ac_status=$?
-@@ -4754,7 +4755,7 @@
+@@ -5142,7 +5143,7 @@
  .size foo, .Lend - foo
  
  EOF
@@ -84,7 +99,7 @@
  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_assemble\""; } >&5
    (eval $gmp_assemble) 2>&5
    ac_status=$?
-@@ -4793,7 +4794,7 @@
+@@ -5217,7 +5218,7 @@
  .align 3
  
  EOF
@@ -93,51 +108,80 @@
  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_assemble\""; } >&5
    (eval $gmp_assemble) 2>&5
    ac_status=$?
-diff -ur nettle-2.5-orig/examples/base16enc.c nettle-2.5/examples/base16enc.c
---- nettle-2.5-orig/examples/base16enc.c	2012-07-07 09:27:55 -0400
-+++ nettle-2.5/examples/base16enc.c	2013-06-22 13:11:50 -0400
-@@ -47,16 +47,18 @@
- int
- main(int argc UNUSED, char **argv UNUSED)
- {
-+  uint8_t * buffer;
-+  uint8_t * result;
- 
-   /* "buffer" will hold the bytes from disk: */
--  uint8_t * buffer = (uint8_t *) malloc (CHUNK_SIZE * sizeof(uint8_t));
-+  buffer = (uint8_t *) malloc (CHUNK_SIZE * sizeof(uint8_t));
-   if (buffer == NULL) {
-     fprintf (stderr, "Cannot allocate read buffer.\n");
-     return EXIT_FAILURE;
-   }
+diff -ur nettle-2.7-orig/ecc-curve.h nettle-2.7/ecc-curve.h
+--- nettle-2.7-orig/ecc-curve.h	2013-04-24 09:26:52 -0400
++++ nettle-2.7/ecc-curve.h	2013-11-05 15:27:46 -0500
+@@ -25,6 +25,18 @@
+ #ifndef NETTLE_ECC_CURVE_H_INCLUDED
+ #define NETTLE_ECC_CURVE_H_INCLUDED
  
-   /* "result" will hold bytes before output: */
--  uint8_t * result = (uint8_t *) malloc (ENCODED_SIZE * sizeof(uint8_t));
-+  result = (uint8_t *) malloc (ENCODED_SIZE * sizeof(uint8_t));
-   if (result == NULL) {
-     fprintf (stderr, "Cannot allocate write buffer.\n");
-     return EXIT_FAILURE;
-diff -ur nettle-2.5-orig/nettle-meta.h nettle-2.5/nettle-meta.h
---- nettle-2.5-orig/nettle-meta.h	2012-07-07 09:27:54 -0400
-+++ nettle-2.5/nettle-meta.h	2013-06-22 13:11:19 -0400
-@@ -28,6 +28,16 @@
- 
- #include "nettle-types.h"
- 
-+#ifdef _MSC_VER
-+# ifdef BUILDING_NETTLE
-+#  define NETTLE_EXPORTED __declspec(dllexport)
++#ifndef HOGWEED_EXPORTED
++# ifdef _MSC_VER
++#  ifdef BUILDING_HOGWEED
++#   define HOGWEED_EXPORTED __declspec(dllexport)
++#  else
++#   define HOGWEED_EXPORTED __declspec(dllimport)
++#  endif
 +# else
-+#  define NETTLE_EXPORTED __declspec(dllimport)
++#  define HOGWEED_EXPORTED
 +# endif
-+#else
-+# define NETTLE_EXPORTED
 +#endif
 +
  #ifdef __cplusplus
  extern "C" {
  #endif
-@@ -97,32 +107,32 @@
+@@ -32,11 +44,11 @@
+ /* The contets of this struct is internal. */
+ struct ecc_curve;
+ 
+-extern const struct ecc_curve nettle_secp_192r1;
+-extern const struct ecc_curve nettle_secp_224r1;
+-extern const struct ecc_curve nettle_secp_256r1;
+-extern const struct ecc_curve nettle_secp_384r1;
+-extern const struct ecc_curve nettle_secp_521r1;
++extern HOGWEED_EXPORTED const struct ecc_curve nettle_secp_192r1;
++extern HOGWEED_EXPORTED const struct ecc_curve nettle_secp_224r1;
++extern HOGWEED_EXPORTED const struct ecc_curve nettle_secp_256r1;
++extern HOGWEED_EXPORTED const struct ecc_curve nettle_secp_384r1;
++extern HOGWEED_EXPORTED const struct ecc_curve nettle_secp_521r1;
+ 
+ #ifdef __cplusplus
+ }
+diff -ur nettle-2.7-orig/examples/Makefile.in nettle-2.7/examples/Makefile.in
+--- nettle-2.7-orig/examples/Makefile.in	2013-11-05 14:51:27 -0500
++++ nettle-2.7/examples/Makefile.in	2013-11-05 15:19:45 -0500
+@@ -11,7 +11,7 @@
+ PRE_LDFLAGS = -L..
+ 
+ OPENSSL_LIBFLAGS = @OPENSSL_LIBFLAGS@
+-BENCH_LIBS = @BENCH_LIBS@ -lm
++BENCH_LIBS = @BENCH_LIBS@
+ 
+ HOGWEED_TARGETS = rsa-keygen$(EXEEXT) rsa-sign$(EXEEXT) \
+ 	      rsa-verify$(EXEEXT) rsa-encrypt$(EXEEXT) rsa-decrypt$(EXEEXT) \
+diff -ur nettle-2.7-orig/nettle-meta.h nettle-2.7/nettle-meta.h
+--- nettle-2.7-orig/nettle-meta.h	2013-04-24 09:26:52 -0400
++++ nettle-2.7/nettle-meta.h	2013-11-05 15:23:56 -0500
+@@ -28,6 +28,18 @@
+ 
+ #include "nettle-types.h"
+ 
++#ifndef NETTLE_EXPORTED
++# ifdef _MSC_VER
++#  ifdef BUILDING_NETTLE
++#   define NETTLE_EXPORTED __declspec(dllexport)
++#  else
++#   define NETTLE_EXPORTED __declspec(dllimport)
++#  endif
++# else
++#  define NETTLE_EXPORTED
++# endif
++#endif
++
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+@@ -97,32 +109,32 @@
  }
  
  /* null-terminated list of ciphers implemented by this version of nettle */
@@ -189,7 +233,7 @@
  
  struct nettle_hash
  {
-@@ -153,17 +163,17 @@
+@@ -153,22 +165,22 @@
  } 
  
  /* null-terminated list of digests implemented by this version of nettle */
@@ -199,25 +243,35 @@
 -extern const struct nettle_hash nettle_md2;
 -extern const struct nettle_hash nettle_md4;
 -extern const struct nettle_hash nettle_md5;
+-extern const struct nettle_hash nettle_gosthash94;
 -extern const struct nettle_hash nettle_ripemd160;
 -extern const struct nettle_hash nettle_sha1;
 -extern const struct nettle_hash nettle_sha224;
 -extern const struct nettle_hash nettle_sha256;
 -extern const struct nettle_hash nettle_sha384;
 -extern const struct nettle_hash nettle_sha512;
+-extern const struct nettle_hash nettle_sha3_224;
+-extern const struct nettle_hash nettle_sha3_256;
+-extern const struct nettle_hash nettle_sha3_384;
+-extern const struct nettle_hash nettle_sha3_512;
 +extern NETTLE_EXPORTED const struct nettle_hash nettle_md2;
 +extern NETTLE_EXPORTED const struct nettle_hash nettle_md4;
 +extern NETTLE_EXPORTED const struct nettle_hash nettle_md5;
++extern NETTLE_EXPORTED const struct nettle_hash nettle_gosthash94;
 +extern NETTLE_EXPORTED const struct nettle_hash nettle_ripemd160;
 +extern NETTLE_EXPORTED const struct nettle_hash nettle_sha1;
 +extern NETTLE_EXPORTED const struct nettle_hash nettle_sha224;
 +extern NETTLE_EXPORTED const struct nettle_hash nettle_sha256;
 +extern NETTLE_EXPORTED const struct nettle_hash nettle_sha384;
 +extern NETTLE_EXPORTED const struct nettle_hash nettle_sha512;
++extern NETTLE_EXPORTED const struct nettle_hash nettle_sha3_224;
++extern NETTLE_EXPORTED const struct nettle_hash nettle_sha3_256;
++extern NETTLE_EXPORTED const struct nettle_hash nettle_sha3_384;
++extern NETTLE_EXPORTED const struct nettle_hash nettle_sha3_512;
  
  struct nettle_armor
  {
-@@ -215,10 +225,10 @@
+@@ -220,10 +232,10 @@
  }
  
  /* null-terminated list of armor schemes implemented by this version of nettle */
@@ -231,14 +285,17 @@
  
  #ifdef __cplusplus
  }
-diff -ur nettle-2.5-orig/tools/sexp-conv.c nettle-2.5/tools/sexp-conv.c
---- nettle-2.5-orig/tools/sexp-conv.c	2012-07-07 09:27:54 -0400
-+++ nettle-2.5/tools/sexp-conv.c	2013-06-22 13:12:00 -0400
-@@ -225,7 +225,7 @@
+diff -ur nettle-2.7-orig/tools/sexp-conv.c nettle-2.7/tools/sexp-conv.c
+--- nettle-2.7-orig/tools/sexp-conv.c	2013-04-24 09:26:53 -0400
++++ nettle-2.7/tools/sexp-conv.c	2013-11-05 15:04:03 -0500
+@@ -225,7 +225,10 @@
    
    for (;;)
      {
 -      static const struct nettle_hash *hashes[] =
++#ifndef _MSC_VER
++      static
++#endif
 +      const struct nettle_hash *hashes[] =
  	{ &nettle_md5, &nettle_sha1, &nettle_sha256, NULL };