From 6d30580362be5ddb95cbf4e28b2ad31a8112f526 Mon Sep 17 00:00:00 2001 From: David Shaw Date: Wed, 4 Dec 2002 16:17:21 +0000 Subject: [PATCH] * 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. --- g10/ChangeLog | 7 +++++++ g10/keyedit.c | 4 ++-- g10/packet.h | 3 ++- g10/sign.c | 9 +++++---- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/g10/ChangeLog b/g10/ChangeLog index bbfa4534f..6a88a0fea 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,10 @@ +2002-12-04 David Shaw + + * 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. + 2002-12-03 David Shaw * options.h, g10.c (main), encode.c (write_pubkey_enc_from_list), diff --git a/g10/keyedit.c b/g10/keyedit.c index 5d9a8d775..91d8de02a 100644 --- a/g10/keyedit.c +++ b/g10/keyedit.c @@ -2684,7 +2684,7 @@ menu_set_primary_uid ( KBNODE pub_keyblock, KBNODE sec_keyblock ) if (action) { int rc = update_keysig_packet (&newsig, sig, - main_pk, uid, + main_pk, uid, NULL, sk, change_primary_uid_cb, action > 0? "x":NULL ); @@ -2769,7 +2769,7 @@ menu_set_preferences (KBNODE pub_keyblock, KBNODE sec_keyblock ) int rc; rc = update_keysig_packet (&newsig, sig, - main_pk, uid, + main_pk, uid, NULL, sk, keygen_upd_std_prefs, NULL ); diff --git a/g10/packet.h b/g10/packet.h index fdca455a1..446a8b2c6 100644 --- a/g10/packet.h +++ b/g10/packet.h @@ -483,7 +483,8 @@ int make_keysig_packet( PKT_signature **ret_sig, PKT_public_key *pk, int update_keysig_packet( PKT_signature **ret_sig, PKT_signature *orig_sig, PKT_public_key *pk, - PKT_user_id *uid, + PKT_user_id *uid, + PKT_public_key *subpk, PKT_secret_key *sk, int (*mksubpkt)(PKT_signature *, void *), void *opaque ); diff --git a/g10/sign.c b/g10/sign.c index c0a9b8f29..6900976c5 100644 --- a/g10/sign.c +++ b/g10/sign.c @@ -1249,6 +1249,7 @@ update_keysig_packet( PKT_signature **ret_sig, PKT_signature *orig_sig, PKT_public_key *pk, PKT_user_id *uid, + PKT_public_key *subpk, PKT_secret_key *sk, int (*mksubpkt)(PKT_signature *, void *), void *opaque @@ -1258,10 +1259,10 @@ update_keysig_packet( PKT_signature **ret_sig, int rc=0; MD_HANDLE md; - if (!orig_sig || !pk || !uid || !sk) - return G10ERR_GENERAL; - if (orig_sig->sig_class < 0x10 || orig_sig->sig_class > 0x13 ) - return G10ERR_GENERAL; + if ((!orig_sig || !pk || !sk) + || (orig_sig->sig_class >= 0x10 && orig_sig->sig_class <= 0x13 && !uid) + || (orig_sig->sig_class == 0x18 && !subpk)) + return G10ERR_GENERAL; md = md_open( orig_sig->digest_algo, 0 );