blob: 683b57d455a757d5654bf36c5f28a6ef08b2ee9b [file] [log] [blame]
Andrew Geissler595f6302022-01-24 19:11:47 +00001From c4b1bee51bbdd732b94b431a951481af99117703 Mon Sep 17 00:00:00 2001
2From: Panu Matilainen <pmatilai@redhat.com>
3Date: Thu, 30 Sep 2021 09:51:10 +0300
4Subject: [PATCH 2/3] Process MPI's from all kinds of signatures
5
6No immediate effect but needed by the following commits.
7
8CVE: CVE-2021-3521
9Upstream-Status: Backport [https://github.com/rpm-software-management/rpm/commit/b5e8bc74b]
10
11Signed-off-by: Changqing Li <changqing.li@windriver.com>
12
13---
14 rpmio/rpmpgp.c | 13 +++++--------
15 1 file changed, 5 insertions(+), 8 deletions(-)
16
17diff --git a/rpmio/rpmpgp.c b/rpmio/rpmpgp.c
18index 25f67048fd..509e777e6d 100644
19--- a/rpmio/rpmpgp.c
20+++ b/rpmio/rpmpgp.c
21@@ -543,7 +543,7 @@ pgpDigAlg pgpDigAlgFree(pgpDigAlg alg)
22 return NULL;
23 }
24
25-static int pgpPrtSigParams(pgpTag tag, uint8_t pubkey_algo, uint8_t sigtype,
26+static int pgpPrtSigParams(pgpTag tag, uint8_t pubkey_algo,
27 const uint8_t *p, const uint8_t *h, size_t hlen,
28 pgpDigParams sigp)
29 {
30@@ -556,10 +556,8 @@ static int pgpPrtSigParams(pgpTag tag, uint8_t pubkey_algo, uint8_t sigtype,
31 int mpil = pgpMpiLen(p);
32 if (pend - p < mpil)
33 break;
34- if (sigtype == PGPSIGTYPE_BINARY || sigtype == PGPSIGTYPE_TEXT) {
35- if (sigalg->setmpi(sigalg, i, p))
36- break;
37- }
38+ if (sigalg->setmpi(sigalg, i, p))
39+ break;
40 p += mpil;
41 }
42
43@@ -619,7 +617,7 @@ static int pgpPrtSig(pgpTag tag, const uint8_t *h, size_t hlen,
44 }
45
46 p = ((uint8_t *)v) + sizeof(*v);
47- rc = pgpPrtSigParams(tag, v->pubkey_algo, v->sigtype, p, h, hlen, _digp);
48+ rc = pgpPrtSigParams(tag, v->pubkey_algo, p, h, hlen, _digp);
49 } break;
50 case 4:
51 { pgpPktSigV4 v = (pgpPktSigV4)h;
52@@ -677,8 +675,7 @@ static int pgpPrtSig(pgpTag tag, const uint8_t *h, size_t hlen,
53 p += 2;
54 if (p > hend)
55 return 1;
56-
57- rc = pgpPrtSigParams(tag, v->pubkey_algo, v->sigtype, p, h, hlen, _digp);
58+ rc = pgpPrtSigParams(tag, v->pubkey_algo, p, h, hlen, _digp);
59 } break;
60 default:
61 rpmlog(RPMLOG_WARNING, _("Unsupported version of signature: V%d\n"), version);
62--
632.17.1
64