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

svn author wk cvs at cvs.gnupg.org
Thu Jul 2 15:40:16 CEST 2009


Author: wk
Date: 2009-07-02 15:40:15 +0200 (Thu, 02 Jul 2009)
New Revision: 1397

Modified:
   trunk/THANKS
   trunk/cipher/ChangeLog
   trunk/cipher/md.c
   trunk/src/ChangeLog
   trunk/src/dumpsexp.c
   trunk/src/sexp.c
   trunk/tests/ChangeLog
   trunk/tests/benchmark.c
Log:
Minor bug fixes.


Modified: trunk/cipher/ChangeLog
===================================================================
--- trunk/cipher/ChangeLog	2009-07-02 10:43:32 UTC (rev 1396)
+++ trunk/cipher/ChangeLog	2009-07-02 13:40:15 UTC (rev 1397)
@@ -1,3 +1,8 @@
+2009-07-02  Werner Koch  <wk at g10code.com>
+
+	* md.c (md_read): Fix incomplete check for NULL.
+	Reported by Fabian Kail.
+
 2009-03-31  Werner Koch  <wk at g10code.com>
 
 	* rsa.c (rsa_check_secret_key): Return GPG_ERR_BAD_SECKEY and not

Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2009-07-02 10:43:32 UTC (rev 1396)
+++ trunk/src/ChangeLog	2009-07-02 13:40:15 UTC (rev 1397)
@@ -1,3 +1,13 @@
+2009-07-02  Werner Koch  <wk at g10code.com>
+
+	* dumpsexp.c (main): Fix handling multiple files.
+	(parse_and_print): Implement hex and octal escaping.
+
+	* sexp.c (unquote_string): Remove superfluous clearing of ESC.
+	* dumpsexp.c (parse_and_print): Add missing break.
+	(main): Fix return value.
+	Reported by Fabian Keil.
+
 2009-02-16  Werner Koch  <wk at g10code.com>
 
 	* ath.h [HAVE_SYS_SELECT_H]: Include <sys/select.h> for fd_set.

Modified: trunk/tests/ChangeLog
===================================================================
--- trunk/tests/ChangeLog	2009-07-02 10:43:32 UTC (rev 1396)
+++ trunk/tests/ChangeLog	2009-07-02 13:40:15 UTC (rev 1397)
@@ -1,3 +1,7 @@
+2009-06-08  Werner Koch  <wk at g10code.com>
+
+	* benchmark.c (cipher_bench): Center labels.  Suggested by Brad Hards.
+
 2009-02-16  Werner Koch  <wk at g10code.com>
 
 	* fipsdrv.c (print_buffer): Remove parens from initializer for

Modified: trunk/THANKS
===================================================================
--- trunk/THANKS	2009-07-02 10:43:32 UTC (rev 1396)
+++ trunk/THANKS	2009-07-02 13:40:15 UTC (rev 1397)
@@ -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
+Daiki Ueno                 ueno at unixuser org
 Dan Fandrich               dan at coneharvesters com
 Daniel Eisenbud 	   eisenbud at cs.swarthmore.edu
 Daniel Koening		   dan at mail.isis.de
@@ -32,6 +33,7 @@
 Elie De Brauwer            elie at de-brauwer.be
 Enzo Michelangeli	   em at MailAndNews.com
 Ernst Molitor		   ernst.molitor at uni-bonn.de
+Fabian Keil                fk at fabiankeil de
 Fabio Coatti		   cova at felix.unife.it
 Felix von Leitner	   leitner at amdiv.de
 Frank Heckenbach	   heckenb at mi.uni-erlangen.de

Modified: trunk/cipher/md.c
===================================================================
--- trunk/cipher/md.c	2009-07-02 10:43:32 UTC (rev 1396)
+++ trunk/cipher/md.c	2009-07-02 13:40:15 UTC (rev 1397)
@@ -948,10 +948,13 @@
 
   if (! algo)
     {
-      /* return the first algorithm */
-      if (r && r->next)
-	log_debug ("more than one algorithm in md_read(0)\n");
-      return r->digest->read( &r->context.c );
+      /* Return the first algorithm */
+      if (r)
+        {
+          if (r->next)
+            log_debug ("more than one algorithm in md_read(0)\n");
+          return r->digest->read (&r->context.c);
+        }
     }
   else
     {

Modified: trunk/src/dumpsexp.c
===================================================================
--- trunk/src/dumpsexp.c	2009-07-02 10:43:32 UTC (rev 1396)
+++ trunk/src/dumpsexp.c	2009-07-02 13:40:15 UTC (rev 1397)
@@ -276,7 +276,7 @@
 
 
 
-
+/* Returns 0 on success.  */
 static int
 parse_and_print (FILE *fp)
 {
@@ -488,12 +488,37 @@
               state = IN_STRING;
               break;
             }
+          break;
           
         case IN_OCT_ESC: 
-          state = IN_STRING;
+          if (quote_idx < 3 && strchr ("01234567", c))
+            {
+              quote_buf[quote_idx++] = c; 
+              if (quote_idx == 3)
+                {
+                  printchr ((unsigned int)quote_buf[0] * 8 * 8
+                            + (unsigned int)quote_buf[1] * 8
+                            + (unsigned int)quote_buf[2]);
+                  state = IN_STRING;
+                }
+            }
+          else
+            state = IN_STRING;
           break;
         case IN_HEX_ESC: 
-          state = IN_STRING;
+          if (quote_idx < 2 && strchr ("0123456789abcdefABCDEF", c))
+            {
+              quote_buf[quote_idx++] = c; 
+              if (quote_idx == 2)
+                {
+                  printchr (xtoi_1 (quote_buf[0]) * 16
+                            + xtoi_1 (quote_buf[1]));
+
+                  state = IN_STRING;
+                }
+            }
+          else
+            state = IN_STRING;
           break;
         case CR_ESC:
           state = IN_STRING;
@@ -590,7 +615,8 @@
     }
   else
     {
-      for (; argc; argc--)
+      rc = 0;
+      for (; argc; argv++, argc--)
         {
           FILE *fp = fopen (*argv, "rb");
           if (!fp)
@@ -600,14 +626,13 @@
             }
           else 
             {
-              if ( parse_and_print (fp) )
+              if (parse_and_print (fp))
                 rc = 1;
               fclose (fp);
             }
         }
     }
   
-
-  return !rc;
+  return !!rc;
 }
 

Modified: trunk/src/sexp.c
===================================================================
--- trunk/src/sexp.c	2009-07-02 10:43:32 UTC (rev 1396)
+++ trunk/src/sexp.c	2009-07-02 13:40:15 UTC (rev 1397)
@@ -909,7 +909,6 @@
                 {
                   s++; n--;
                 }
-              esc = 0;
               break;
               
             case '\n':  /* ignore LF[,CR] */

Modified: trunk/tests/benchmark.c
===================================================================
--- trunk/tests/benchmark.c	2009-07-02 10:43:32 UTC (rev 1396)
+++ trunk/tests/benchmark.c	2009-07-02 13:40:15 UTC (rev 1397)
@@ -448,12 +448,12 @@
   size_t allocated_buflen, buflen;
   int repetitions;
   static struct { int mode; const char *name; int blocked; } modes[] = {
-    { GCRY_CIPHER_MODE_ECB, "ECB", 1 },
-    { GCRY_CIPHER_MODE_CBC, "CBC", 1 },
-    { GCRY_CIPHER_MODE_CFB, "CFB", 0 },
-    { GCRY_CIPHER_MODE_OFB, "OFB", 0 },
-    { GCRY_CIPHER_MODE_CTR, "CTR", 0 },
-    { GCRY_CIPHER_MODE_STREAM, "STREAM", 0 },
+    { GCRY_CIPHER_MODE_ECB, "      ECB", 1 },
+    { GCRY_CIPHER_MODE_CBC, "      CBC", 1 },
+    { GCRY_CIPHER_MODE_CFB, "      CFB", 0 },
+    { GCRY_CIPHER_MODE_OFB, "      OFB", 0 },
+    { GCRY_CIPHER_MODE_CTR, "      CTR", 0 },
+    { GCRY_CIPHER_MODE_STREAM, "    STREAM", 0 },
     {0}
   };
   int modeidx;




More information about the Gnupg-commits mailing list