[svn] GnuPG - r4418 - branches/STABLE-BRANCH-1-4/g10

svn author dshaw cvs at cvs.gnupg.org
Wed Jan 31 21:23:47 CET 2007


Author: dshaw
Date: 2007-01-31 21:23:45 +0100 (Wed, 31 Jan 2007)
New Revision: 4418

Modified:
   branches/STABLE-BRANCH-1-4/g10/ChangeLog
   branches/STABLE-BRANCH-1-4/g10/sign.c
Log:
* sign.c (write_plaintext_packet): Take timestamp from outside.
Change all callers.  (sign_file, clearsign_file,
sign_symencrypt_file): Calculate one timestamp for the whole
transaction.  Different timestamps for each step can leak performance
information.


Modified: branches/STABLE-BRANCH-1-4/g10/ChangeLog
===================================================================
--- branches/STABLE-BRANCH-1-4/g10/ChangeLog	2007-01-31 19:42:48 UTC (rev 4417)
+++ branches/STABLE-BRANCH-1-4/g10/ChangeLog	2007-01-31 20:23:45 UTC (rev 4418)
@@ -1,5 +1,11 @@
 2007-01-31  David Shaw  <dshaw at jabberwocky.com>
 
+	* sign.c (write_plaintext_packet): Take timestamp from outside.
+	Change all callers.
+	(sign_file, clearsign_file, sign_symencrypt_file): Calculate one
+	timestamp for the whole transaction.  Different timestamps for
+	each step can leak performance information.
+
 	* main.h, keygen.c (ask_expiredate), keyedit.c (menu_expire):
 	Remove the need for ask_expiredate().
 

Modified: branches/STABLE-BRANCH-1-4/g10/sign.c
===================================================================
--- branches/STABLE-BRANCH-1-4/g10/sign.c	2007-01-31 19:42:48 UTC (rev 4417)
+++ branches/STABLE-BRANCH-1-4/g10/sign.c	2007-01-31 20:23:45 UTC (rev 4418)
@@ -572,7 +572,8 @@
  * Helper to write the plaintext (literal data) packet
  */
 static int
-write_plaintext_packet (IOBUF out, IOBUF inp, const char *fname, int ptmode)
+write_plaintext_packet (IOBUF out, IOBUF inp, const char *fname,
+			int ptmode, u32 timestamp)
 {
     PKT_plaintext *pt = NULL;
     u32 filesize;
@@ -613,7 +614,7 @@
     if (!opt.no_literal) {
         PACKET pkt;
 
-        pt->timestamp = make_timestamp ();
+        pt->timestamp = timestamp;
         pt->mode = ptmode;
         pt->len = filesize;
         pt->new_ctb = !pt->len && !RFC1991;
@@ -749,7 +750,7 @@
     SK_LIST sk_list = NULL;
     SK_LIST sk_rover = NULL;
     int multifile = 0;
-    u32 duration=0;
+    u32 create_time=make_timestamp(),duration=0;
 
     memset( &afx, 0, sizeof afx);
     memset( &zfx, 0, sizeof zfx);
@@ -1026,7 +1027,8 @@
     }
     else {
         rc = write_plaintext_packet (out, inp, fname,
-                                     opt.textmode && !outfile ? 't':'b');
+                                     opt.textmode && !outfile ? 't':'b',
+				     create_time);
     }
 
     /* catch errors from above */
@@ -1036,7 +1038,7 @@
     /* write the signatures */
     rc = write_signature_packets (sk_list, out, mfx.md,
                                   opt.textmode && !outfile? 0x01 : 0x00,
-				  0, duration, detached ? 'D':'S');
+				  create_time, duration, detached ? 'D':'S');
     if( rc )
         goto leave;
 
@@ -1075,7 +1077,7 @@
     SK_LIST sk_rover = NULL;
     int old_style = RFC1991;
     int only_md5 = 0;
-    u32 duration=0;
+    u32 create_time=make_timestamp(),duration=0;
 
     memset( &afx, 0, sizeof afx);
     init_packet( &pkt );
@@ -1195,7 +1197,8 @@
     iobuf_push_filter( out, armor_filter, &afx );
 
     /* write the signatures */
-    rc=write_signature_packets (sk_list, out, textmd, 0x01, 0, duration, 'C');
+    rc=write_signature_packets (sk_list, out, textmd, 0x01,
+				create_time, duration, 'C');
     if( rc )
         goto leave;
 
@@ -1230,7 +1233,7 @@
     SK_LIST sk_list = NULL;
     SK_LIST sk_rover = NULL;
     int algo;
-    u32 duration=0;
+    u32 create_time=make_timestamp(),duration=0;
 
     memset( &afx, 0, sizeof afx);
     memset( &zfx, 0, sizeof zfx);
@@ -1348,7 +1351,8 @@
 
     /* Pipe data through all filters; i.e. write the signed stuff */
     /*(current filters: zip - encrypt - armor)*/
-    rc = write_plaintext_packet (out, inp, fname, opt.textmode ? 't':'b');
+    rc = write_plaintext_packet (out, inp, fname, opt.textmode ? 't':'b',
+				 create_time);
     if (rc)
 	goto leave;
     
@@ -1356,7 +1360,7 @@
     /*(current filters: zip - encrypt - armor)*/
     rc = write_signature_packets (sk_list, out, mfx.md,
 				  opt.textmode? 0x01 : 0x00,
-				  0, duration, 'S');
+				  create_time, duration, 'S');
     if( rc )
         goto leave;
 




More information about the Gnupg-commits mailing list