From d30e345692440b9c6677118c1d20b9d17d80f873 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 31 Oct 2024 15:11:55 +0100 Subject: gpg: Allow the use of an ADSK subkey as ADSK subkey. * g10/packet.h (PKT_public_key): Increased size of req_usage to 16. * g10/getkey.c (key_byname): Set allow_adsk in the context if ir was requested via req_usage. (finish_lookup): Allow RENC usage matching. * g10/keyedit.c (append_adsk_to_key): Adjust the assert. * g10/keygen.c (prepare_adsk): Also allow to find an RENC subkey. -- If an ADSK is to be added it may happen that an ADSK subkey is found first and this should then be used even that it does not have the E usage. However, it used to have that E usage when it was added. While testing this I found another pecularity: If you do gpg -k ADSK_SUBKEY_FPR without the '!' suffix and no corresponding encryption subkey is dound, you will get an unusabe key error. I hesitate to fix that due to possible side-effects. GnuPG-bug-id: 6882 --- g10/keygen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'g10/keygen.c') diff --git a/g10/keygen.c b/g10/keygen.c index 81f03fdfb..bdb3cd43a 100644 --- a/g10/keygen.c +++ b/g10/keygen.c @@ -4646,7 +4646,7 @@ prepare_adsk (ctrl_t ctrl, const char *name) } adsk_pk = xcalloc (1, sizeof *adsk_pk); - adsk_pk->req_usage = PUBKEY_USAGE_ENC; + adsk_pk->req_usage = PUBKEY_USAGE_ENC | PUBKEY_USAGE_RENC; err = get_pubkey_byname (ctrl, GET_PUBKEY_TRY_LDAP, NULL, adsk_pk, name, NULL, NULL, 1); if (err) -- cgit v1.2.3