[svn] ksba - r280 - in trunk: . gl src tests

svn author wk cvs at cvs.gnupg.org
Wed Nov 7 12:44:46 CET 2007


Author: wk
Date: 2007-11-07 12:44:36 +0100 (Wed, 07 Nov 2007)
New Revision: 280

Modified:
   trunk/ChangeLog
   trunk/configure.ac
   trunk/gl/alloca.h
   trunk/src/ChangeLog
   trunk/src/cms.c
   trunk/src/crl.c
   trunk/src/der-encoder.c
   trunk/tests/ChangeLog
   trunk/tests/t-common.h
   trunk/tests/t-crl-parser.c
Log:
Fixed a segv when using more then one signing certificiate.
Fix for CRL parsing.
Typo fixes.
Make test output easier readable.
New option --disable-optimization for configure.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-11-03 14:10:24 UTC (rev 279)
+++ trunk/ChangeLog	2007-11-07 11:44:36 UTC (rev 280)
@@ -1,3 +1,7 @@
+2007-11-07  Werner Koch  <wk at g10code.com>
+
+	* configure.ac: Add option --disable-optimization.
+
 2007-08-08  Werner Koch  <wk at g10code.com>
 
 	* configure.ac: Use $host and not $target.  Reported by Peter

Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac	2007-11-03 14:10:24 UTC (rev 279)
+++ trunk/configure.ac	2007-11-07 11:44:36 UTC (rev 280)
@@ -99,6 +99,15 @@
 AC_LIBTOOL_RC
 AM_PROG_LIBTOOL
 
+# This is handy for debugging so the compiler doesn't rearrange
+# things and eliminate variables.
+AC_ARG_ENABLE(optimization,
+       AC_HELP_STRING([--disable-optimization],
+		      [disable compiler optimization]),
+                      [if test $enableval = no ; then
+                         CFLAGS=`echo $CFLAGS | sed 's/-O[[0-9]]//'`
+                       fi])
+
 if test "$GCC" = yes; then
     CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
 

Modified: trunk/gl/alloca.h
===================================================================
--- trunk/gl/alloca.h	2007-11-03 14:10:24 UTC (rev 279)
+++ trunk/gl/alloca.h	2007-11-07 11:44:36 UTC (rev 280)
@@ -5,7 +5,7 @@
 
    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published
-   by the Free Software Foundation; either version 2, or (at your option)
+   by the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    This program is distributed in the hope that it will be useful,
@@ -14,9 +14,8 @@
    General Public License for more details.
 
    You should have received a copy of the GNU General Public
-   License along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
-   USA.  */
+   License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
 
 /* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H
    means there is a real alloca function.  */

Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2007-11-03 14:10:24 UTC (rev 279)
+++ trunk/src/ChangeLog	2007-11-07 11:44:36 UTC (rev 280)
@@ -1,3 +1,8 @@
+2007-11-07  Werner Koch  <wk at g10code.com>
+
+	* cms.c (build_signed_data_attribute): Reset ATTRIDX for new
+	signers. Use xfree and not free.
+
 2007-11-03  Moritz Schulte  <moritz at g10code.com>
 
 	* ksba.h: Include <stdio.h>, since FILE* is used.
@@ -2,2 +7,6 @@
 
+2007-08-08  Werner Koch  <wk at g10code.com>
+
+	* crl.c (ksba_crl_get_update_times): Require only THIS_UPDATE.
+
 2007-07-04  Werner Koch  <wk at g10code.com>

Modified: trunk/src/cms.c
===================================================================
--- trunk/src/cms.c	2007-11-03 14:10:24 UTC (rev 279)
+++ trunk/src/cms.c	2007-11-07 11:44:36 UTC (rev 280)
@@ -2398,6 +2398,14 @@
       unsigned char *image;
       size_t imagelen;
 
+      for (i = 0; i < attridx; i++)
+        {
+          _ksba_asn_release_nodes (attrarray[i].root);
+          xfree (attrarray[i].image);
+        }
+      attridx = 0;
+      memset (attrarray, 0, sizeof (attrarray));
+
       if (!digestlist)
         {
 	  err = gpg_error (GPG_ERR_MISSING_VALUE); /* oops */
@@ -2580,6 +2588,7 @@
 	  goto leave;
 	}
 
+      assert (attridx <= DIM (attrarray));
       for (i=0; i < attridx; i++)
         {
           if (i)
@@ -2620,7 +2629,7 @@
   for (i = 0; i < attridx; i++)
     {
       _ksba_asn_release_nodes (attrarray[i].root);
-      free (attrarray[i].image);
+      xfree (attrarray[i].image);
     }
 
   return err;

Modified: trunk/src/crl.c
===================================================================
--- trunk/src/crl.c	2007-11-03 14:10:24 UTC (rev 279)
+++ trunk/src/crl.c	2007-11-07 11:44:36 UTC (rev 280)
@@ -36,6 +36,8 @@
 
 static const char oidstr_crlNumber[] = "2.5.29.20";
 static const char oidstr_crlReason[] = "2.5.29.21";
+static const char oidstr_issuingDistributionPoint[] = "2.5.29.28";
+static const char oidstr_certificateIssuer[] = "2.5.29.29";
 static const char oidstr_authorityKeyIdentifier[] = "2.5.29.35";
 
 /* We better buffer the hashing. */
@@ -560,7 +562,7 @@
     *next = 0;
   if (!crl)
     return gpg_error (GPG_ERR_INV_VALUE);
-  if (!*crl->this_update || !*crl->next_update)
+  if (!*crl->this_update)
     return gpg_error (GPG_ERR_INV_TIME);
   if (this)
     _ksba_copy_time (this, crl->this_update);
@@ -1130,6 +1132,10 @@
         default: crl->item.reason |= KSBA_CRLREASON_OTHER; break;
         }
     }
+  if (!strcmp (oid, oidstr_certificateIssuer))
+    {
+      /* FIXME: We need to implement this. */
+    }
   else if (critical)
     err = gpg_error (GPG_ERR_UNKNOWN_CRIT_EXTN);
   

Modified: trunk/src/der-encoder.c
===================================================================
--- trunk/src/der-encoder.c	2007-11-03 14:10:24 UTC (rev 279)
+++ trunk/src/der-encoder.c	2007-11-07 11:44:36 UTC (rev 280)
@@ -523,10 +523,10 @@
 }
 
 /* Create a DER encoding from the value tree ROOT and return an
-   allocated image of appropriate length in r_imae and r_imagelen.
+   allocated image of appropriate length in r_image and r_imagelen.
    The value tree is modified so that it can be used the same way as a
    parsed one, i.e the elements off, and len are set to point into
-   image. */
+   image.  */
 gpg_error_t
 _ksba_der_encode_tree (AsnNode root,
                        unsigned char **r_image, size_t *r_imagelen)

Modified: trunk/tests/ChangeLog
===================================================================
--- trunk/tests/ChangeLog	2007-11-03 14:10:24 UTC (rev 279)
+++ trunk/tests/ChangeLog	2007-11-07 11:44:36 UTC (rev 280)
@@ -1,3 +1,7 @@
+2007-08-08  Werner Koch  <wk at g10code.com>
+
+	* t-common.h (print_sexp_hex): New.
+
 2007-07-04  Werner Koch  <wk at g10code.com>
 
 	Changed license to GPLv3.

Modified: trunk/tests/t-common.h
===================================================================
--- trunk/tests/t-common.h	2007-11-03 14:10:24 UTC (rev 279)
+++ trunk/tests/t-common.h	2007-11-07 11:44:36 UTC (rev 280)
@@ -155,7 +155,58 @@
     }
 }
 
+/* Variant of print_sexp which force printing the values in hex.  */
+void
+print_sexp_hex (ksba_const_sexp_t p)
+{
+  int level = 0;
 
+  if (!p)
+    fputs ("[none]", stdout);
+  else
+    {
+      for (;;)
+        {
+          if (*p == '(')
+            {
+              putchar (*p);
+              p++;
+              level++;
+            }
+          else if (*p == ')')
+            {
+              putchar (*p);
+              if (--level <= 0 )
+                return;
+            }
+          else if (!digitp (p))
+            {
+              fputs ("[invalid s-exp]", stdout);
+              return;
+            }
+          else
+            {
+              char *endp;
+              unsigned long len, n;
+
+              len = strtoul (p, &endp, 10);
+              p = endp;
+              if (*p != ':')
+                {
+                  fputs ("[invalid s-exp]", stdout);
+                  return;
+                }
+              p++;
+              putchar('#');
+              for (n=0; n < len; n++, p++)
+                printf ("%02X", *p);
+              putchar('#');
+            }
+        }
+    }
+}
+
+
 void
 print_dn (char *p)
 {

Modified: trunk/tests/t-crl-parser.c
===================================================================
--- trunk/tests/t-crl-parser.c	2007-11-03 14:10:24 UTC (rev 279)
+++ trunk/tests/t-crl-parser.c	2007-11-07 11:44:36 UTC (rev 280)
@@ -179,7 +179,7 @@
             err = ksba_crl_get_item (crl, &serial, rdate, &reason);
             fail_if_err2 (fname, err);
             printf ("CRL entry %d: s=", ++count);
-            print_sexp (serial);
+            print_sexp_hex (serial);
             printf (", t=");
             print_time (rdate);
             printf (", r=%x\n", reason);
@@ -221,7 +221,7 @@
                 print_names (24, name1);
                 ksba_name_release (name1);
                 fputs ("                serial: ", stdout);
-                print_sexp (serial);
+                print_sexp_hex (serial);
                 ksba_free (serial);
               }
             putchar ('\n');




More information about the Gnupg-commits mailing list