summaryrefslogtreecommitdiff
path: root/rpmio/rpmpgp.c
diff options
context:
space:
mode:
authorDemi Marie Obenour <demi@invisiblethingslab.com>2022-03-27 12:54:36 -0400
committerPanu Matilainen <pmatilai@redhat.com>2022-03-31 09:52:50 +0300
commit8948ec79f6c300e91319469ba72b9bd3480fe686 (patch)
tree05ea2fc62b4a94ead31d5ad5d550ff0e35d04661 /rpmio/rpmpgp.c
parenta9cca032a2b7c0c6bcacc6ab4ecd25c95cc75305 (diff)
downloadrpm-8948ec79f6c300e91319469ba72b9bd3480fe686.tar.gz
Avoid unneded MPI reparsing
Modify pgpPrtSig() to ignore the MPIs of a signature if its `tag` parameter is 0. The only caller that sets `tag` to 0 is pgpPrtParamSubkeys() (via parseSubkeySig()), which does not actually check any cryptographic signatures. The subkey binding signature has been checked earlier in pgpPrtParams().
Diffstat (limited to 'rpmio/rpmpgp.c')
-rw-r--r--rpmio/rpmpgp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/rpmio/rpmpgp.c b/rpmio/rpmpgp.c
index 22ac9c816..2b936619b 100644
--- a/rpmio/rpmpgp.c
+++ b/rpmio/rpmpgp.c
@@ -652,7 +652,7 @@ static int pgpPrtSig(pgpTag tag, const uint8_t *h, size_t hlen,
}
p = ((uint8_t *)v) + sizeof(*v);
- rc = pgpPrtSigParams(tag, v->pubkey_algo, p, h, hlen, _digp);
+ rc = tag ? pgpPrtSigParams(tag, v->pubkey_algo, p, h, hlen, _digp) : 0;
} break;
case 4:
{ pgpPktSigV4 v = (pgpPktSigV4)h;
@@ -714,7 +714,7 @@ static int pgpPrtSig(pgpTag tag, const uint8_t *h, size_t hlen,
if (p > hend)
return 1;
- rc = pgpPrtSigParams(tag, v->pubkey_algo, p, h, hlen, _digp);
+ rc = tag ? pgpPrtSigParams(tag, v->pubkey_algo, p, h, hlen, _digp) : 0;
} break;
default:
rpmlog(RPMLOG_WARNING, _("Unsupported version of signature: V%d\n"), version);