diff options
| author | David Shaw <[email protected]> | 2002-12-04 18:50:10 +0000 |
|---|---|---|
| committer | David Shaw <[email protected]> | 2002-12-04 18:50:10 +0000 |
| commit | 1aec20776c0568c71aac299feb5519facc80348f (patch) | |
| tree | 4ddfa6ae507218ab20ac09175b8604859b0fcbc9 /g10/keygen.c | |
| parent | * trustdb.c (validate_keys): Show trust parameters when building trustdb, (diff) | |
| download | gnupg-1aec20776c0568c71aac299feb5519facc80348f.tar.gz gnupg-1aec20776c0568c71aac299feb5519facc80348f.zip | |
* main.h, keyedit.c, keygen.c: Back out previous (2002-12-01) change.
Minimal isn't always best.
* sign.c (update_keysig_packet): Use the current time rather then a
modification of the original signature time. Make sure that this doesn't
cause a time warp.
* keygen.c (keygen_add_key_expire): Properly handle a key expiration date
in the past (use a duration of 0).
* keyedit.c (menu_expire): Use update_keysig_packet so any sig subpackets
are maintained during the update.
* build-packet.c (build_sig_subpkt): Mark sig expired or unexpired when
the sig expiration subpacket is added. (build_sig_subpkt_from_sig): Handle
making an expiration subpacket from a sig that has already expired (use a
duration of 0).
* packet.h, sign.c (update_keysig_packet), keyedit.c
(menu_set_primary_uid, menu_set_preferences): Add ability to issue 0x18
subkey binding sigs to update_keysig_packet and change all callers.
Diffstat (limited to 'g10/keygen.c')
| -rw-r--r-- | g10/keygen.c | 61 |
1 files changed, 21 insertions, 40 deletions
diff --git a/g10/keygen.c b/g10/keygen.c index aa30b4d6b..24ba95fb9 100644 --- a/g10/keygen.c +++ b/g10/keygen.c @@ -143,56 +143,37 @@ do_add_key_flags (PKT_signature *sig, unsigned int use) build_sig_subpkt (sig, SIGSUBPKT_KEY_FLAGS, buf, 1); } -static void -do_copy_key_flags (PKT_signature *sig, PKT_signature *oldsig) -{ - const byte *f; - size_t n; - - /* Note that this will make any key flags in the unhashed area - disappear. This may be good or bad, depending on your point of - view. */ - f=parse_sig_subpkt(oldsig->hashed,SIGSUBPKT_KEY_FLAGS,&n); - if(f) - build_sig_subpkt(sig,SIGSUBPKT_KEY_FLAGS,f,n); -} -static void -do_add_key_expire( PKT_signature *sig, PKT_public_key *pk ) +int +keygen_add_key_expire( PKT_signature *sig, void *opaque ) { - if( pk->expiredate ) - { - byte buf[4]; - u32 u; + PKT_public_key *pk = opaque; + byte buf[8]; + u32 u; - u = pk->expiredate > pk->timestamp? pk->expiredate - pk->timestamp - : pk->timestamp; - buf[0] = (u >> 24) & 0xff; - buf[1] = (u >> 16) & 0xff; - buf[2] = (u >> 8) & 0xff; - buf[3] = u & 0xff; - build_sig_subpkt( sig, SIGSUBPKT_KEY_EXPIRE, buf, 4 ); - } -} + if( pk->expiredate ) { + if(pk->expiredate > pk->timestamp) + u= pk->expiredate - pk->timestamp; + else + u= 0; -int -keygen_copy_flags_add_expire( PKT_signature *sig, void *opaque ) -{ - struct flags_expire *fe=opaque; - do_add_key_expire(sig,fe->pk); - do_copy_key_flags(sig,fe->sig); + buf[0] = (u >> 24) & 0xff; + buf[1] = (u >> 16) & 0xff; + buf[2] = (u >> 8) & 0xff; + buf[3] = u & 0xff; + build_sig_subpkt( sig, SIGSUBPKT_KEY_EXPIRE, buf, 4 ); + } - return 0; + return 0; } static int keygen_add_key_flags_and_expire (PKT_signature *sig, void *opaque) { - struct opaque_data_usage_and_pk *oduap = opaque; + struct opaque_data_usage_and_pk *oduap = opaque; - do_add_key_flags (sig, oduap->usage); - do_add_key_expire(sig,oduap->pk); - return 0; + do_add_key_flags (sig, oduap->usage); + return keygen_add_key_expire (sig, oduap->pk); } static int @@ -511,7 +492,7 @@ keygen_add_std_prefs( PKT_signature *sig, void *opaque ) byte buf[8]; do_add_key_flags (sig, pk->pubkey_usage); - do_add_key_expire (sig, pk); + keygen_add_key_expire( sig, opaque ); keygen_upd_std_prefs (sig, opaque); buf[0] = 0x80; /* no modify - It is reasonable that a key holder |
