summaryrefslogtreecommitdiff
path: root/rpmio/rpmpgp.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2011-11-07 13:18:13 +0200
committerPanu Matilainen <pmatilai@redhat.com>2011-11-07 13:29:29 +0200
commit45c880304b78cc7e77a94a309303bc53f96024c6 (patch)
tree93f1dac02324f3c7381070dcc6314c73315c615a /rpmio/rpmpgp.c
parent41a3fda32b9092bbf5562b1716463480b99b78d0 (diff)
downloadrpm-45c880304b78cc7e77a94a309303bc53f96024c6.tar.gz
rpm-45c880304b78cc7e77a94a309303bc53f96024c6.tar.bz2
rpm-45c880304b78cc7e77a94a309303bc53f96024c6.zip
Add an API for comparing two digest parameter containers
- Lift the digest parameter comparison from librpmsign to rpmpgp.c where it really belongs.
Diffstat (limited to 'rpmio/rpmpgp.c')
-rw-r--r--rpmio/rpmpgp.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/rpmio/rpmpgp.c b/rpmio/rpmpgp.c
index 045740e43..36ed66c01 100644
--- a/rpmio/rpmpgp.c
+++ b/rpmio/rpmpgp.c
@@ -897,6 +897,29 @@ pgpDigParams pgpDigGetParams(pgpDig dig, unsigned int pkttype)
return params;
}
+int pgpDigParamsCmp(pgpDigParams p1, pgpDigParams p2)
+{
+ int rc = 1; /* assume different, eg if either is NULL */
+ if (p1 && p2) {
+ /* XXX Should we compare something else too? */
+ if (p1->hash_algo != p2->hash_algo)
+ goto exit;
+ if (p1->pubkey_algo != p2->pubkey_algo)
+ goto exit;
+ if (p1->version != p2->version)
+ goto exit;
+ if (p1->sigtype != p2->sigtype)
+ goto exit;
+ if (memcmp(p1->signid, p2->signid, sizeof(p1->signid)) != 0)
+ goto exit;
+
+ /* Parameters match ... at least for our purposes */
+ rc = 0;
+ }
+exit:
+ return rc;
+}
+
int pgpPrtPkts(const uint8_t * pkts, size_t pktlen, pgpDig dig, int printing)
{
const uint8_t *p = pkts;