diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2011-11-07 14:47:03 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2011-11-07 14:47:03 +0200 |
commit | cde47f5945e16033395b5d0023a550b4c01ba0e7 (patch) | |
tree | 096c96ee0c840df3703de913e4da47209bcf1092 /sign | |
parent | a6f25aff4343c2f67d3fcbfe69929d518327d35f (diff) | |
download | rpm-cde47f5945e16033395b5d0023a550b4c01ba0e7.tar.gz rpm-cde47f5945e16033395b5d0023a550b4c01ba0e7.tar.bz2 rpm-cde47f5945e16033395b5d0023a550b4c01ba0e7.zip |
Use pgpDigParamsAlgo() throughout the codebase
- Tedious but straightforward conversion to use the API instead
of going to the struct directly.
- Remove digest.h includes where no longer necessary
Diffstat (limited to 'sign')
-rw-r--r-- | sign/rpmgensig.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/sign/rpmgensig.c b/sign/rpmgensig.c index 368f2aa41..e6c7659e8 100644 --- a/sign/rpmgensig.c +++ b/sign/rpmgensig.c @@ -17,7 +17,6 @@ #include <rpm/rpmlog.h> #include <rpm/rpmstring.h> -#include "rpmio/digest.h" #include "lib/rpmlead.h" #include "lib/signature.h" @@ -120,6 +119,8 @@ static int putSignature(Header sigh, int ishdr, uint8_t *pkt, size_t pktlen) rpmTagVal sigtag; struct rpmtd_s sigtd; int rc = 1; /* assume failure */ + unsigned int hash_algo; + unsigned int pubkey_algo; if (pgpPrtPkts(pkt, pktlen, dig, 0) == 0) sigp = pgpDigGetParams(dig, PGPTAG_SIGNATURE); @@ -129,13 +130,14 @@ static int putSignature(Header sigh, int ishdr, uint8_t *pkt, size_t pktlen) goto exit; } - if (rpmDigestLength(sigp->hash_algo) == 0) { - rpmlog(RPMLOG_ERR, _("Unsupported PGP hash algorithm %d\n"), - sigp->hash_algo); + hash_algo = pgpDigParamsAlgo(sigp, PGPVAL_HASHALGO); + if (rpmDigestLength(hash_algo) == 0) { + rpmlog(RPMLOG_ERR, _("Unsupported PGP hash algorithm %u\n"), hash_algo); goto exit; } - switch (sigp->pubkey_algo) { + pubkey_algo = pgpDigParamsAlgo(sigp, PGPVAL_PUBKEYALGO); + switch (pubkey_algo) { case PGPPUBKEYALGO_DSA: sigtag = ishdr ? RPMSIGTAG_DSA : RPMSIGTAG_GPG; break; @@ -143,8 +145,8 @@ static int putSignature(Header sigh, int ishdr, uint8_t *pkt, size_t pktlen) sigtag = ishdr ? RPMSIGTAG_RSA : RPMSIGTAG_PGP; break; default: - rpmlog(RPMLOG_ERR, _("Unsupported PGP pubkey algorithm %d\n"), - sigp->pubkey_algo); + rpmlog(RPMLOG_ERR, _("Unsupported PGP pubkey algorithm %u\n"), + pubkey_algo); goto exit; break; } |