Panu Matilainen 2742b0
From 329e2ec47f6cd3bc7ecf85abd9f2ab179c59914f Mon Sep 17 00:00:00 2001
Panu Matilainen 2742b0
Message-Id: <329e2ec47f6cd3bc7ecf85abd9f2ab179c59914f.1650871821.git.pmatilai@redhat.com>
Panu Matilainen 2742b0
From: Demi Marie Obenour <demi@invisiblethingslab.com>
Panu Matilainen 2742b0
Date: Thu, 14 Apr 2022 15:38:11 -0400
Panu Matilainen 2742b0
Subject: [PATCH] Fix OpenPGP key ID parsing regression
Panu Matilainen 2742b0
Panu Matilainen 2742b0
This fixes a regression in 598a771d8b4f4f480d4990ccf59b978d537201dd,
Panu Matilainen 2742b0
which caused RPM to parse key flags from a hashed key ID subpacket.  As
Panu Matilainen 2742b0
a result, RPM would wrongly reject a signature that had both key ID and
Panu Matilainen 2742b0
key usage flags subpackets in the hashed section.
Panu Matilainen 2742b0
Panu Matilainen 2742b0
(backported from commit 7f830132fe717d4b31c035bb3d08379451e3cd81)
Panu Matilainen 2742b0
---
Panu Matilainen 2742b0
 rpmio/rpmpgp.c | 1 +
Panu Matilainen 2742b0
 1 file changed, 1 insertion(+)
Panu Matilainen 2742b0
Panu Matilainen 2742b0
diff --git a/rpmio/rpmpgp.c b/rpmio/rpmpgp.c
Panu Matilainen 2742b0
index deea65eae..242b34e19 100644
Panu Matilainen 2742b0
--- a/rpmio/rpmpgp.c
Panu Matilainen 2742b0
+++ b/rpmio/rpmpgp.c
Panu Matilainen 2742b0
@@ -528,6 +528,7 @@ static int pgpPrtSubType(const uint8_t *h, size_t hlen, pgpSigType sigtype,
Panu Matilainen 2742b0
 		_digp->saved |= PGPDIG_SAVED_ID;
Panu Matilainen 2742b0
 		memcpy(_digp->signid, p+1, sizeof(_digp->signid));
Panu Matilainen 2742b0
 	    }
Panu Matilainen 2742b0
+	    break;
Panu Matilainen 2742b0
 	case PGPSUBTYPE_KEY_FLAGS: /* Key usage flags */
Panu Matilainen 2742b0
 	    /* Subpackets in the unhashed section cannot be trusted */
Panu Matilainen 2742b0
 	    if (!hashed)
Panu Matilainen 2742b0
-- 
Panu Matilainen 2742b0
2.35.1
Panu Matilainen 2742b0