1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

gpg: Return the last error for pubkey decryption.

* g10/mainproc.c (proc_encrypted): Check ->result against -1.
When c->dek == NULL, put GPG_ERR_NO_SECKEY only when not set.
* g10/pubkey-enc.c (get_session_key): Set k->result by the result of
get_it.
When no secret key is available for some reasons, return the last
specific error, if any.

GnuPG-bug-id: 4561
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2019-07-05 15:16:08 +09:00
parent 064aeb14c9
commit 6cc4119ec0
2 changed files with 25 additions and 18 deletions

View file

@ -583,7 +583,7 @@ proc_encrypted (CTX c, PACKET *pkt)
struct pubkey_enc_list *list;
for (list = c->pkenc_list; list; list = list->next)
if (list->result == GPG_ERR_NO_SECKEY)
if (list->result != -1)
{
char buf[20];
snprintf (buf, sizeof buf, "%08lX%08lX",
@ -668,7 +668,10 @@ proc_encrypted (CTX c, PACKET *pkt)
}
}
else if (!c->dek)
result = GPG_ERR_NO_SECKEY;
{
if (!result)
result = GPG_ERR_NO_SECKEY;
}
/* Compute compliance with CO_DE_VS. */
if (!result && is_status_enabled ()