[svn] gcry - r1391 - in trunk: . cipher mpi src tests

svn author wk cvs at cvs.gnupg.org
Mon Feb 16 22:05:37 CET 2009


Author: wk
Date: 2009-02-16 22:05:37 +0100 (Mon, 16 Feb 2009)
New Revision: 1391

Modified:
   trunk/THANKS
   trunk/cipher/ChangeLog
   trunk/cipher/crc.c
   trunk/cipher/md4.c
   trunk/cipher/md5.c
   trunk/cipher/rmd160.c
   trunk/cipher/rsa.c
   trunk/cipher/sha1.c
   trunk/cipher/sha256.c
   trunk/cipher/tiger.c
   trunk/cipher/whirlpool.c
   trunk/mpi/ChangeLog
   trunk/mpi/mpicoder.c
   trunk/mpi/mpiutil.c
   trunk/src/ChangeLog
   trunk/src/ath.h
   trunk/src/mpi.h
   trunk/src/sexp.c
   trunk/tests/ChangeLog
   trunk/tests/fipsdrv.c
Log:
Portability fixes.


Modified: trunk/cipher/ChangeLog
===================================================================
--- trunk/cipher/ChangeLog	2009-02-13 18:47:56 UTC (rev 1390)
+++ trunk/cipher/ChangeLog	2009-02-16 21:05:37 UTC (rev 1391)
@@ -1,3 +1,11 @@
+2009-02-16  Werner Koch  <wk at g10code.com>
+
+	* rsa.c (generate_x931): Do not initialize TBL with automatic
+	variables.
+	* whirlpool.c, tiger.c, sha256.c, sha1.c, rmd160.c, md5.c
+	* md4.c, crc.c: Remove memory.h.  This is garbage from gnupg.
+	Reported by Dan Fandrich.
+
 2009-01-22  Werner Koch  <wk at g10code.com>
 
 	* ecc.c (compute_keygrip): Remove superfluous const.

Modified: trunk/mpi/ChangeLog
===================================================================
--- trunk/mpi/ChangeLog	2009-02-13 18:47:56 UTC (rev 1390)
+++ trunk/mpi/ChangeLog	2009-02-16 21:05:37 UTC (rev 1391)
@@ -1,3 +1,7 @@
+2009-02-16  Werner Koch  <wk at g10code.com>
+
+	* mpiutil.c: Remove memory.h.
+
 2008-12-05  Werner Koch  <wk at g10code.com>
 
 	* mpicoder.c (mpi_read_from_buffer): Do not bail out if the mpi is

Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2009-02-13 18:47:56 UTC (rev 1390)
+++ trunk/src/ChangeLog	2009-02-16 21:05:37 UTC (rev 1391)
@@ -1,3 +1,13 @@
+2009-02-16  Werner Koch  <wk at g10code.com>
+
+	* ath.h [HAVE_SYS_SELECT_H]: Include <sys/select.h> for fd_set.
+	[!HAVE_SYS_SELECT_H]: Include <sys/time.h>.  Move inclusion of
+	config.h to the top.  The actual configure check was already
+	there.
+
+	* sexp.c: Remove memory.h.
+	* mpi.h: Remove memory.h.  Add string.h.
+
 2009-02-02  Werner Koch  <wk at g10code.com>
 
 	* ath.h: Include sys/time.h.  Fixes bug#993.

Modified: trunk/tests/ChangeLog
===================================================================
--- trunk/tests/ChangeLog	2009-02-13 18:47:56 UTC (rev 1390)
+++ trunk/tests/ChangeLog	2009-02-16 21:05:37 UTC (rev 1391)
@@ -1,3 +1,8 @@
+2009-02-16  Werner Koch  <wk at g10code.com>
+
+	* fipsdrv.c (print_buffer): Remove parens from initializer for
+	better portability.  Reported by Dan Fandrich.
+
 2009-02-13  Werner Koch  <wk at g10code.com>
 
 	* rsacvt.c (compute_missing): Fix dqm1 computation.  Take care of

Modified: trunk/THANKS
===================================================================
--- trunk/THANKS	2009-02-13 18:47:56 UTC (rev 1390)
+++ trunk/THANKS	2009-02-16 21:05:37 UTC (rev 1391)
@@ -21,6 +21,7 @@
 Christian von Roques	   roques at pond.sub.org
 Christopher Oliver	   oliver at fritz.traverse.net
 Christian Recktenwald	   chris at citecs.de
+Dan Fandrich               dan at coneharvesters com
 Daniel Eisenbud 	   eisenbud at cs.swarthmore.edu
 Daniel Koening		   dan at mail.isis.de
 David Ellement		   ellement at sdd.hp.com
@@ -148,7 +149,8 @@
 			   nbecker at hns.com
 
 
- Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001, 2002, 2003, 
+           2009 Free Software Foundation, Inc.
 
  This file is free software; as a special exception the author gives
  unlimited permission to copy and/or distribute it, with or without

Modified: trunk/cipher/crc.c
===================================================================
--- trunk/cipher/crc.c	2009-02-13 18:47:56 UTC (rev 1390)
+++ trunk/cipher/crc.c	2009-02-16 21:05:37 UTC (rev 1391)
@@ -25,7 +25,6 @@
 #include <string.h>
 
 #include "g10lib.h"
-#include "memory.h"
 #include "cipher.h"
 
 #include "bithelp.h"

Modified: trunk/cipher/md4.c
===================================================================
--- trunk/cipher/md4.c	2009-02-13 18:47:56 UTC (rev 1390)
+++ trunk/cipher/md4.c	2009-02-16 21:05:37 UTC (rev 1391)
@@ -53,7 +53,6 @@
 #include <string.h>
 
 #include "g10lib.h"
-#include "memory.h"
 #include "cipher.h"
 
 #include "bithelp.h"

Modified: trunk/cipher/md5.c
===================================================================
--- trunk/cipher/md5.c	2009-02-13 18:47:56 UTC (rev 1390)
+++ trunk/cipher/md5.c	2009-02-16 21:05:37 UTC (rev 1391)
@@ -37,7 +37,6 @@
 #include <string.h>
 
 #include "g10lib.h"
-#include "memory.h"
 #include "cipher.h"
 
 #include "bithelp.h"

Modified: trunk/cipher/rmd160.c
===================================================================
--- trunk/cipher/rmd160.c	2009-02-13 18:47:56 UTC (rev 1390)
+++ trunk/cipher/rmd160.c	2009-02-16 21:05:37 UTC (rev 1391)
@@ -24,7 +24,6 @@
 #include <string.h>
 
 #include "g10lib.h"
-#include "memory.h"
 #include "rmd.h"
 #include "cipher.h" /* Only used for the rmd160_hash_buffer() prototype. */
 

Modified: trunk/cipher/rsa.c
===================================================================
--- trunk/cipher/rsa.c	2009-02-13 18:47:56 UTC (rev 1390)
+++ trunk/cipher/rsa.c	2009-02-16 21:05:37 UTC (rev 1391)
@@ -444,18 +444,28 @@
     else
       {
         /* Parameters to derive the key are given.  */
+        /* Note that we explicitly need to setup the values of tbl
+           because some compilers (e.g. OpenWatcom, IRIX) don't allow
+           to initialize a structure with automatic variables.  */
         struct { const char *name; gcry_mpi_t *value; } tbl[] = {
-          { "Xp1", &xp1 },
-          { "Xp2", &xp2 },
-          { "Xp",  &xp  },
-          { "Xq1", &xq1 },
-          { "Xq2", &xq2 },
-          { "Xq",  &xq  },
-          { NULL,  NULL }
+          { "Xp1" },
+          { "Xp2" },
+          { "Xp"  },
+          { "Xq1" },
+          { "Xq2" },
+          { "Xq"  },
+          { NULL }
         };
         int idx;
         gcry_sexp_t oneparm;
         
+        tbl[0].value = &xp1;
+        tbl[1].value = &xp2;
+        tbl[2].value = &xp;
+        tbl[3].value = &xq1;
+        tbl[4].value = &xq2;
+        tbl[5].value = &xq;
+
         for (idx=0; tbl[idx].name; idx++)
           {
             oneparm = gcry_sexp_find_token (deriveparms, tbl[idx].name, 0);

Modified: trunk/cipher/sha1.c
===================================================================
--- trunk/cipher/sha1.c	2009-02-13 18:47:56 UTC (rev 1390)
+++ trunk/cipher/sha1.c	2009-02-16 21:05:37 UTC (rev 1391)
@@ -37,7 +37,6 @@
 #endif
 
 #include "g10lib.h"
-#include "memory.h"
 #include "bithelp.h"
 #include "cipher.h"
 #include "hash-common.h"

Modified: trunk/cipher/sha256.c
===================================================================
--- trunk/cipher/sha256.c	2009-02-13 18:47:56 UTC (rev 1390)
+++ trunk/cipher/sha256.c	2009-02-16 21:05:37 UTC (rev 1391)
@@ -41,7 +41,6 @@
 #include <string.h>
 
 #include "g10lib.h"
-#include "memory.h"
 #include "bithelp.h"
 #include "cipher.h"
 #include "hash-common.h"

Modified: trunk/cipher/tiger.c
===================================================================
--- trunk/cipher/tiger.c	2009-02-13 18:47:56 UTC (rev 1390)
+++ trunk/cipher/tiger.c	2009-02-16 21:05:37 UTC (rev 1391)
@@ -24,7 +24,6 @@
 #include <string.h>
 
 #include "g10lib.h"
-#include "memory.h"
 #include "cipher.h"
 
 #ifdef HAVE_U64_TYPEDEF

Modified: trunk/cipher/whirlpool.c
===================================================================
--- trunk/cipher/whirlpool.c	2009-02-13 18:47:56 UTC (rev 1390)
+++ trunk/cipher/whirlpool.c	2009-02-16 21:05:37 UTC (rev 1391)
@@ -36,7 +36,6 @@
 
 #include "types.h"
 #include "g10lib.h"
-#include "memory.h"
 #include "cipher.h"
 
 #include "bithelp.h"

Modified: trunk/mpi/mpicoder.c
===================================================================
--- trunk/mpi/mpicoder.c	2009-02-13 18:47:56 UTC (rev 1390)
+++ trunk/mpi/mpicoder.c	2009-02-16 21:05:37 UTC (rev 1391)
@@ -456,6 +456,10 @@
       const unsigned char *s = buffer;
       size_t n;
       
+      /* This test is not strictly necessary and an assert (!len)
+         would be sufficient.  We keep this test in case we later
+         allow the BUFLEN argument to act as a sanitiy check.  Same
+         below. */
       if (len && len < 4)
         return gcry_error (GPG_ERR_TOO_SHORT);
 

Modified: trunk/mpi/mpiutil.c
===================================================================
--- trunk/mpi/mpiutil.c	2009-02-13 18:47:56 UTC (rev 1390)
+++ trunk/mpi/mpiutil.c	2009-02-16 21:05:37 UTC (rev 1391)
@@ -25,7 +25,6 @@
 
 #include "g10lib.h"
 #include "mpi-internal.h"
-#include "memory.h"
 #include "mod-source-info.h"
 
 

Modified: trunk/src/ath.h
===================================================================
--- trunk/src/ath.h	2009-02-13 18:47:56 UTC (rev 1390)
+++ trunk/src/ath.h	2009-02-16 21:05:37 UTC (rev 1391)
@@ -21,18 +21,22 @@
 #ifndef ATH_H
 #define ATH_H
 
+#include <config.h>
+
 #ifdef _WIN32
-#include <windows.h>
-#else
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif
+# include <windows.h>
+#else /* !_WIN32 */
+# ifdef HAVE_SYS_SELECT_H
+#  include <sys/select.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <sys/types.h>
+# include <sys/socket.h>
+#endif /* !_WIN32 */
 #include <gpg-error.h>
 
-#include <sys/time.h>  /* Required by Interix.  */
 
-#include <config.h>
-
 
 /* Define _ATH_EXT_SYM_PREFIX if you want to give all external symbols
    a prefix.  */

Modified: trunk/src/mpi.h
===================================================================
--- trunk/src/mpi.h	2009-02-13 18:47:56 UTC (rev 1390)
+++ trunk/src/mpi.h	2009-02-16 21:05:37 UTC (rev 1391)
@@ -30,8 +30,9 @@
 
 #include <config.h>
 #include <stdio.h>
+#include <string.h>
+
 #include "types.h"
-#include "memory.h"
 #include "../mpi/mpi-asm-defs.h"
 
 #include "g10lib.h"

Modified: trunk/src/sexp.c
===================================================================
--- trunk/src/sexp.c	2009-02-13 18:47:56 UTC (rev 1390)
+++ trunk/src/sexp.c	2009-02-16 21:05:37 UTC (rev 1391)
@@ -30,7 +30,6 @@
 
 #define GCRYPT_NO_MPI_MACROS 1
 #include "g10lib.h"
-#include "memory.h"
 
 typedef struct gcry_sexp *NODE;
 typedef unsigned short DATALEN;

Modified: trunk/tests/fipsdrv.c
===================================================================
--- trunk/tests/fipsdrv.c	2009-02-13 18:47:56 UTC (rev 1390)
+++ trunk/tests/fipsdrv.c	2009-02-16 21:05:37 UTC (rev 1391)
@@ -797,9 +797,9 @@
   if (base64_output)
     {
       static const unsigned char bintoasc[64+1] = 
-        ("ABCDEFGHIJKLMNOPQRSTUVWXYZ" 
-         "abcdefghijklmnopqrstuvwxyz" 
-         "0123456789+/"); 
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 
+        "abcdefghijklmnopqrstuvwxyz" 
+        "0123456789+/"; 
       const unsigned char *p;
       unsigned char inbuf[4];
       char outbuf[4];




More information about the Gnupg-commits mailing list