[svn] GnuPG - r5252 - in branches/STABLE-BRANCH-2-0: . agent

svn author wk cvs at cvs.gnupg.org
Tue Jan 26 17:33:59 CET 2010


Author: wk
Date: 2010-01-26 17:33:58 +0100 (Tue, 26 Jan 2010)
New Revision: 5252

Modified:
   branches/STABLE-BRANCH-2-0/NEWS
   branches/STABLE-BRANCH-2-0/agent/ChangeLog
   branches/STABLE-BRANCH-2-0/agent/protect.c
Log:
Fixed a regression in 2.0.14


Modified: branches/STABLE-BRANCH-2-0/agent/ChangeLog
===================================================================
--- branches/STABLE-BRANCH-2-0/agent/ChangeLog	2010-01-26 16:15:12 UTC (rev 5251)
+++ branches/STABLE-BRANCH-2-0/agent/ChangeLog	2010-01-26 16:33:58 UTC (rev 5252)
@@ -1,3 +1,8 @@
+2010-01-26  Werner Koch  <wk at g10code.com>
+
+	* protect.c (do_encryption): Encode the s2kcount and do not use a
+	static value of 96.
+
 2009-12-21  Werner Koch  <wk at g10code.com>
 
 	* command.c (cmd_getinfo): Add sub-command "s2k_count".

Modified: branches/STABLE-BRANCH-2-0/NEWS
===================================================================
--- branches/STABLE-BRANCH-2-0/NEWS	2010-01-26 16:15:12 UTC (rev 5251)
+++ branches/STABLE-BRANCH-2-0/NEWS	2010-01-26 16:33:58 UTC (rev 5252)
@@ -3,7 +3,10 @@
 
  * New command --passwd for GPG.
 
+ * Fixes a regression in 2.0.14 which prevented unprotection of new
+   or changed gpg-agent passphrases.
 
+
 Noteworthy changes in version 2.0.14 (2009-12-21)
 -------------------------------------------------
 

Modified: branches/STABLE-BRANCH-2-0/agent/protect.c
===================================================================
--- branches/STABLE-BRANCH-2-0/agent/protect.c	2010-01-26 16:15:12 UTC (rev 5251)
+++ branches/STABLE-BRANCH-2-0/agent/protect.c	2010-01-26 16:33:58 UTC (rev 5252)
@@ -360,19 +360,25 @@
        
      in canoncical format of course.  We use asprintf and %n modifier
      and dummy values as placeholders.  */
-  p = xtryasprintf
-    ("(9:protected%d:%s((4:sha18:%n_8bytes_2:96)%d:%n%*s)%d:%n%*s)",
-     (int)strlen (modestr), modestr,
-     &saltpos, 
-     blklen, &ivpos, blklen, "",
-     enclen, &encpos, enclen, "");
-  if (!p)
-    {
-      gpg_error_t tmperr = out_of_core ();
-      xfree (iv);
-      xfree (outbuf);
-      return tmperr;
-    }
+  {
+    char countbuf[35];
+
+    snprintf (countbuf, sizeof countbuf, "%lu", get_standard_s2k_count ());
+    p = xtryasprintf
+      ("(9:protected%d:%s((4:sha18:%n_8bytes_%u:%s)%d:%n%*s)%d:%n%*s)",
+       (int)strlen (modestr), modestr,
+       &saltpos, 
+       (unsigned int)strlen (countbuf), countbuf,
+       blklen, &ivpos, blklen, "",
+       enclen, &encpos, enclen, "");
+    if (!p)
+      {
+        gpg_error_t tmperr = out_of_core ();
+        xfree (iv);
+        xfree (outbuf);
+        return tmperr;
+      }
+  }
   *resultlen = strlen (p);
   *result = (unsigned char*)p;
   memcpy (p+saltpos, iv+2*blklen, 8);




More information about the Gnupg-commits mailing list