gpg: Fix ugly error message for an unknown symkey algorithm.

* g10/mainproc.c (proc_symkey_enc): Do not continue with an unknown
algorithm.
--

Trying to encrypt data created with

 printf "\x8c\x49\x05\x0e\x0a\x03\x01"

fails in version 2.2.19 with

 gpg: packet(3) with unknown version 5

but with later versions with

  gpg: encrypted with unknown algorithm 14
  gpg: Ohhhh jeeee: ... this is a bug \
       ([...]/passphrase.c:433:passphrase_to_dek)

so we better catch this case earlier.

Reported-by: Tavis Ormandy
Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2021-01-27 11:45:33 +01:00
parent fb84674d6c
commit b08418d22c
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
1 changed files with 4 additions and 1 deletions

View File

@ -381,7 +381,10 @@ proc_symkey_enc (CTX c, PACKET *pkt)
}
}
else
log_error (_("encrypted with unknown algorithm %d.%s\n"), algo, a);
{
log_error (_("encrypted with unknown algorithm %d.%s\n"), algo, a);
s = NULL; /* Force a goto leave. */
}
if (openpgp_md_test_algo (enc->s2k.hash_algo))
{