[svn] GnuPG - r3894 - branches/GNUPG-1-9-BRANCH/agent

svn author wk cvs at cvs.gnupg.org
Fri Sep 16 14:49:54 CEST 2005


Author: wk
Date: 2005-09-16 14:49:53 +0200 (Fri, 16 Sep 2005)
New Revision: 3894

Modified:
   branches/GNUPG-1-9-BRANCH/agent/ChangeLog
   branches/GNUPG-1-9-BRANCH/agent/minip12.c
Log:
Fixed padding in pkcs#12 


Modified: branches/GNUPG-1-9-BRANCH/agent/ChangeLog
===================================================================
--- branches/GNUPG-1-9-BRANCH/agent/ChangeLog	2005-09-15 17:36:30 UTC (rev 3893)
+++ branches/GNUPG-1-9-BRANCH/agent/ChangeLog	2005-09-16 12:49:53 UTC (rev 3894)
@@ -1,3 +1,8 @@
+2005-09-16  Werner Koch  <wk at g10code.com>
+
+	* minip12.c (build_key_sequence, build_cert_sequence): Fixed
+	padding.
+
 2005-09-15  Moritz Schulte  <moritz at g10code.com>
 
 	* t-protect.c (test_agent_protect): Implemented.

Modified: branches/GNUPG-1-9-BRANCH/agent/minip12.c
===================================================================
--- branches/GNUPG-1-9-BRANCH/agent/minip12.c	2005-09-15 17:36:30 UTC (rev 3893)
+++ branches/GNUPG-1-9-BRANCH/agent/minip12.c	2005-09-16 12:49:53 UTC (rev 3894)
@@ -745,6 +745,15 @@
   startoffset = 0;
   buffer = p = plain;
 
+/*   { */
+/* #  warning debug code is enabled */
+/*     FILE *fp = fopen ("tmp-rc2-plain-key.der", "wb"); */
+/*     if (!fp || fwrite (p, n, 1, fp) != 1) */
+/*       exit (2); */
+/*     fclose (fp); */
+/*   } */
+
+
   where = "decrypted-text";
   if (parse_tag (&p, &n, &ti) || ti.class || ti.tag != TAG_SEQUENCE)
     goto bailout;
@@ -1229,7 +1238,7 @@
   assert (needed == plainlen);
   /* Append some pad characters; we already allocated extra space. */
   n = 8 - plainlen % 8;
-  for (;(plainlen % 8); plainlen++)
+  for (i=0; i < n; i++, plainlen++)
     *p++ = n;
 
   *r_length = plainlen;
@@ -1453,6 +1462,7 @@
   size_t len[8], needed, n;
   unsigned char *p, *certseq;
   size_t certseqlen;
+  int i;
 
   /* Walk 8 steps down to collect the info: */
 
@@ -1535,7 +1545,7 @@
   
   /* Append some pad characters; we already allocated extra space. */
   n = 8 - certseqlen % 8;
-  for (;(certseqlen % 8); certseqlen++)
+  for (i=0; i < n; i++, certseqlen++)
     *p++ = n;
   
   *r_length = certseqlen;




More information about the Gnupg-commits mailing list