From b357ff2aa64c6a0ff17941d99feeb1174035b031 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 12 Sep 2024 11:06:09 +0200 Subject: gpg: Don't bail out for unknown subkey packet versions. * g10/import.c (read_block): Don't show a warning for unbnown version also for non-primary-key packets. * g10/parse-packet.c (parse_key): Use log_info for unsupported v5 packets. -- This fixes the problem that 2.2 can't import keys with a v5 subkey. This fix allows a gnupg 2.6. version to export a key with an additional PQC subkey and 2.2 can still import the other subkeys. The second patch avoids that gpg returns with an error code. Updates-commit: de70a2f377c1647417fb8a2b6476c3744a901296 --- g10/import.c | 3 ++- g10/parse-packet.c | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/g10/import.c b/g10/import.c index 657b2deb6..ba9531234 100644 --- a/g10/import.c +++ b/g10/import.c @@ -959,7 +959,8 @@ read_block( IOBUF a, unsigned int options, else if (rc ) /* (ignore errors) */ { skip_sigs = 0; - if (gpg_err_code (rc) == GPG_ERR_UNKNOWN_PACKET) + if (gpg_err_code (rc) == GPG_ERR_UNKNOWN_PACKET + || gpg_err_code (rc) == GPG_ERR_UNKNOWN_VERSION) ; /* Do not show a diagnostic. */ else if (gpg_err_code (rc) == GPG_ERR_INV_PACKET && (pkt->pkttype == PKT_USER_ID diff --git a/g10/parse-packet.c b/g10/parse-packet.c index e0fe9c0c8..d0190fd43 100644 --- a/g10/parse-packet.c +++ b/g10/parse-packet.c @@ -2474,7 +2474,10 @@ parse_key (IOBUF inp, int pkttype, unsigned long pktlen, } else { - log_error ("packet(%d) with unknown version %d\n", pkttype, version); + if (version == 5) + log_info ("packet(%d) with unsupported version %d\n", pkttype, version); + else + log_error ("packet(%d) with unsupported version %d\n", pkttype,version); if (list_mode) es_fputs (":key packet: [unknown version]\n", listfp); err = gpg_error (GPG_ERR_UNKNOWN_VERSION); -- cgit v1.2.3