mirror of
git://git.gnupg.org/gnupg.git
synced 2025-04-17 15:44:34 +02:00
* 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.
This commit is contained in:
parent
efef00aed3
commit
5b34e0264e
@ -1,5 +1,11 @@
|
|||||||
2007-01-31 David Shaw <dshaw@jabberwocky.com>
|
2007-01-31 David Shaw <dshaw@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):
|
* main.h, keygen.c (ask_expiredate), keyedit.c (menu_expire):
|
||||||
Remove the need for ask_expiredate().
|
Remove the need for ask_expiredate().
|
||||||
|
|
||||||
|
24
g10/sign.c
24
g10/sign.c
@ -572,7 +572,8 @@ write_onepass_sig_packets (SK_LIST sk_list, IOBUF out, int sigclass )
|
|||||||
* Helper to write the plaintext (literal data) packet
|
* Helper to write the plaintext (literal data) packet
|
||||||
*/
|
*/
|
||||||
static int
|
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;
|
PKT_plaintext *pt = NULL;
|
||||||
u32 filesize;
|
u32 filesize;
|
||||||
@ -613,7 +614,7 @@ write_plaintext_packet (IOBUF out, IOBUF inp, const char *fname, int ptmode)
|
|||||||
if (!opt.no_literal) {
|
if (!opt.no_literal) {
|
||||||
PACKET pkt;
|
PACKET pkt;
|
||||||
|
|
||||||
pt->timestamp = make_timestamp ();
|
pt->timestamp = timestamp;
|
||||||
pt->mode = ptmode;
|
pt->mode = ptmode;
|
||||||
pt->len = filesize;
|
pt->len = filesize;
|
||||||
pt->new_ctb = !pt->len && !RFC1991;
|
pt->new_ctb = !pt->len && !RFC1991;
|
||||||
@ -749,7 +750,7 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr,
|
|||||||
SK_LIST sk_list = NULL;
|
SK_LIST sk_list = NULL;
|
||||||
SK_LIST sk_rover = NULL;
|
SK_LIST sk_rover = NULL;
|
||||||
int multifile = 0;
|
int multifile = 0;
|
||||||
u32 duration=0;
|
u32 create_time=make_timestamp(),duration=0;
|
||||||
|
|
||||||
memset( &afx, 0, sizeof afx);
|
memset( &afx, 0, sizeof afx);
|
||||||
memset( &zfx, 0, sizeof zfx);
|
memset( &zfx, 0, sizeof zfx);
|
||||||
@ -1026,7 +1027,8 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rc = write_plaintext_packet (out, inp, fname,
|
rc = write_plaintext_packet (out, inp, fname,
|
||||||
opt.textmode && !outfile ? 't':'b');
|
opt.textmode && !outfile ? 't':'b',
|
||||||
|
create_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* catch errors from above */
|
/* catch errors from above */
|
||||||
@ -1036,7 +1038,7 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr,
|
|||||||
/* write the signatures */
|
/* write the signatures */
|
||||||
rc = write_signature_packets (sk_list, out, mfx.md,
|
rc = write_signature_packets (sk_list, out, mfx.md,
|
||||||
opt.textmode && !outfile? 0x01 : 0x00,
|
opt.textmode && !outfile? 0x01 : 0x00,
|
||||||
0, duration, detached ? 'D':'S');
|
create_time, duration, detached ? 'D':'S');
|
||||||
if( rc )
|
if( rc )
|
||||||
goto leave;
|
goto leave;
|
||||||
|
|
||||||
@ -1075,7 +1077,7 @@ clearsign_file( const char *fname, STRLIST locusr, const char *outfile )
|
|||||||
SK_LIST sk_rover = NULL;
|
SK_LIST sk_rover = NULL;
|
||||||
int old_style = RFC1991;
|
int old_style = RFC1991;
|
||||||
int only_md5 = 0;
|
int only_md5 = 0;
|
||||||
u32 duration=0;
|
u32 create_time=make_timestamp(),duration=0;
|
||||||
|
|
||||||
memset( &afx, 0, sizeof afx);
|
memset( &afx, 0, sizeof afx);
|
||||||
init_packet( &pkt );
|
init_packet( &pkt );
|
||||||
@ -1195,7 +1197,8 @@ clearsign_file( const char *fname, STRLIST locusr, const char *outfile )
|
|||||||
iobuf_push_filter( out, armor_filter, &afx );
|
iobuf_push_filter( out, armor_filter, &afx );
|
||||||
|
|
||||||
/* write the signatures */
|
/* 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 )
|
if( rc )
|
||||||
goto leave;
|
goto leave;
|
||||||
|
|
||||||
@ -1230,7 +1233,7 @@ sign_symencrypt_file (const char *fname, STRLIST locusr)
|
|||||||
SK_LIST sk_list = NULL;
|
SK_LIST sk_list = NULL;
|
||||||
SK_LIST sk_rover = NULL;
|
SK_LIST sk_rover = NULL;
|
||||||
int algo;
|
int algo;
|
||||||
u32 duration=0;
|
u32 create_time=make_timestamp(),duration=0;
|
||||||
|
|
||||||
memset( &afx, 0, sizeof afx);
|
memset( &afx, 0, sizeof afx);
|
||||||
memset( &zfx, 0, sizeof zfx);
|
memset( &zfx, 0, sizeof zfx);
|
||||||
@ -1348,7 +1351,8 @@ sign_symencrypt_file (const char *fname, STRLIST locusr)
|
|||||||
|
|
||||||
/* Pipe data through all filters; i.e. write the signed stuff */
|
/* Pipe data through all filters; i.e. write the signed stuff */
|
||||||
/*(current filters: zip - encrypt - armor)*/
|
/*(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)
|
if (rc)
|
||||||
goto leave;
|
goto leave;
|
||||||
|
|
||||||
@ -1356,7 +1360,7 @@ sign_symencrypt_file (const char *fname, STRLIST locusr)
|
|||||||
/*(current filters: zip - encrypt - armor)*/
|
/*(current filters: zip - encrypt - armor)*/
|
||||||
rc = write_signature_packets (sk_list, out, mfx.md,
|
rc = write_signature_packets (sk_list, out, mfx.md,
|
||||||
opt.textmode? 0x01 : 0x00,
|
opt.textmode? 0x01 : 0x00,
|
||||||
0, duration, 'S');
|
create_time, duration, 'S');
|
||||||
if( rc )
|
if( rc )
|
||||||
goto leave;
|
goto leave;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user