aboutsummaryrefslogtreecommitdiffstats
path: root/g10/build-packet.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>1998-10-16 16:00:17 +0000
committerWerner Koch <[email protected]>1998-10-16 16:00:17 +0000
commite81e0970f7ab6c815f3396168d47fc6ab57fdf30 (patch)
tree175aa8c360560b30cf500a91eb72b34e16bdedc4 /g10/build-packet.c
parentbackup (diff)
downloadgnupg-e81e0970f7ab6c815f3396168d47fc6ab57fdf30.tar.gz
gnupg-e81e0970f7ab6c815f3396168d47fc6ab57fdf30.zip
last local commit
Diffstat (limited to 'g10/build-packet.c')
-rw-r--r--g10/build-packet.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/g10/build-packet.c b/g10/build-packet.c
index a877b7e3c..11edb33e6 100644
--- a/g10/build-packet.c
+++ b/g10/build-packet.c
@@ -209,8 +209,14 @@ do_public_key( IOBUF out, int ctb, PKT_public_key *pk )
else
iobuf_put( a, pk->version );
write_32(a, pk->timestamp );
- if( pk->version < 4 )
- write_16(a, pk->valid_days );
+ if( pk->version < 4 ) {
+ u16 ndays;
+ if( pk->expiredate )
+ ndays = (u16)((pk->expiredate - pk->timestamp) / 86400L);
+ else
+ ndays = 0;
+ write_16(a, 0 );
+ }
iobuf_put(a, pk->pubkey_algo );
n = pubkey_get_npkey( pk->pubkey_algo );
if( !n )
@@ -280,8 +286,14 @@ do_secret_key( IOBUF out, int ctb, PKT_secret_key *sk )
else
iobuf_put( a, sk->version );
write_32(a, sk->timestamp );
- if( sk->version < 4 )
- write_16(a, sk->valid_days );
+ if( sk->version < 4 ) {
+ u16 ndays;
+ if( sk->expiredate )
+ ndays = (u16)((sk->expiredate - sk->timestamp) / 86400L);
+ else
+ ndays = 0;
+ write_16(a, 0 );
+ }
iobuf_put(a, sk->pubkey_algo );
nskey = pubkey_get_nskey( sk->pubkey_algo );
npkey = pubkey_get_npkey( sk->pubkey_algo );