mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
gpg: Do not allow compressed key packets on import.
* g10/import.c (read_block): Bail out on compressed packets.
* g10/options.h (COMPAT_COMPR_KEYS): New.
* g10/gpg.c (compatibility_flags): Add "compr-keys".
* common/util.h (GPG_ERR_UNEXPECTED_PACKET): Add a new replacement
code.
--
Compressed key packets do not make much sense but historically they
were supported. Thus we also add a compatibility flag.
GnuPG-bug-id: 7014
Backported-from-master: 8e529f9221
This commit is contained in:
parent
d48b26a2f6
commit
23ccad05c6
4 changed files with 11 additions and 2 deletions
|
@ -44,6 +44,9 @@
|
|||
# define GPG_ERR_NO_RESET_CODE 321
|
||||
# define GPG_ERR_BAD_RESET_CODE 322
|
||||
#endif
|
||||
#if GPGRT_VERSION_NUMBER < 0x013800 /* 1.56 */
|
||||
# define GPG_ERR_UNEXPECTED_PACKET 216
|
||||
#endif
|
||||
|
||||
#ifndef EXTERN_UNLESS_MAIN_MODULE
|
||||
# if !defined (INCLUDED_BY_MAIN_MODULE)
|
||||
|
|
|
@ -1037,6 +1037,7 @@ static struct debug_flags_s debug_flags [] =
|
|||
/* The list of compatibility flags. */
|
||||
static struct compatibility_flags_s compatibility_flags [] =
|
||||
{
|
||||
{ COMPAT_COMPR_KEYS, "compr-keys" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
|
|
|
@ -1057,7 +1057,12 @@ read_block( IOBUF a, unsigned int options,
|
|||
switch (pkt->pkttype)
|
||||
{
|
||||
case PKT_COMPRESSED:
|
||||
if (check_compress_algo (pkt->pkt.compressed->algorithm))
|
||||
if (!(opt.compat_flags & COMPAT_COMPR_KEYS))
|
||||
{
|
||||
rc = GPG_ERR_UNEXPECTED_PACKET;
|
||||
goto ready;
|
||||
}
|
||||
else if (check_compress_algo (pkt->pkt.compressed->algorithm))
|
||||
{
|
||||
rc = GPG_ERR_COMPR_ALGO;
|
||||
goto ready;
|
||||
|
|
|
@ -387,7 +387,7 @@ EXTERN_UNLESS_MAIN_MODULE int memory_debug_mode;
|
|||
EXTERN_UNLESS_MAIN_MODULE int memory_stat_debug_mode;
|
||||
|
||||
/* Compatibility flags */
|
||||
/* #define COMPAT_FOO 1 */
|
||||
#define COMPAT_COMPR_KEYS 4 /* Allow import of compressed keys. (T7014) */
|
||||
|
||||
|
||||
/* Compliance test macors. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue