diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2011-11-07 12:53:47 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2011-11-07 12:53:47 +0200 |
commit | 9134a375f03d48ba40f41437a9089a8a87e21433 (patch) | |
tree | ca2222978a680a1afb5783c2efcfacab799d3310 /rpmio | |
parent | b04cdcb459e80e9bc03701e3e575411bf44aba72 (diff) | |
download | librpm-tizen-9134a375f03d48ba40f41437a9089a8a87e21433.tar.gz librpm-tizen-9134a375f03d48ba40f41437a9089a8a87e21433.tar.bz2 librpm-tizen-9134a375f03d48ba40f41437a9089a8a87e21433.zip |
Eliminate direct pgpDig accesses from keyring
Diffstat (limited to 'rpmio')
-rw-r--r-- | rpmio/rpmkeyring.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/rpmio/rpmkeyring.c b/rpmio/rpmkeyring.c index 208e29078..30aa61a63 100644 --- a/rpmio/rpmkeyring.c +++ b/rpmio/rpmkeyring.c @@ -184,8 +184,8 @@ pgpDig rpmPubkeyDig(rpmPubkey key) dig = pgpNewDig(); rc = pgpPrtPkts(key->pkt, key->pktlen, dig, 0); if (rc == 0) { - pgpDigParams pubp = &dig->pubkey; - if (!memcmp(pubp->signid, zeros, sizeof(pubp->signid)) || + pgpDigParams pubp = pgpDigGetParams(dig, PGPTAG_PUBLIC_KEY); + if (!pubp || !memcmp(pubp->signid, zeros, sizeof(pubp->signid)) || !memcmp(pubp->time, zeros, sizeof(pubp->time)) || pubp->userid == NULL) { rc = -1; @@ -211,10 +211,9 @@ char * rpmPubkeyBase64(rpmPubkey key) rpmRC rpmKeyringLookup(rpmKeyring keyring, pgpDig sig) { rpmRC res = RPMRC_NOKEY; + pgpDigParams sigp = pgpDigGetParams(sig, PGPTAG_SIGNATURE); - if (keyring && sig) { - pgpDigParams sigp = &sig->signature; - pgpDigParams pubp = &sig->pubkey; + if (keyring && sigp) { struct rpmPubkey_s needle, *key; needle.pkt = NULL; needle.pktlen = 0; @@ -223,8 +222,9 @@ rpmRC rpmKeyringLookup(rpmKeyring keyring, pgpDig sig) if ((key = rpmKeyringFindKeyid(keyring, &needle))) { /* Retrieve parameters from pubkey packet(s) */ int pktrc = pgpPrtPkts(key->pkt, key->pktlen, sig, 0); + pgpDigParams pubp = pgpDigGetParams(sig, PGPTAG_PUBLIC_KEY); /* Do the parameters match the signature? */ - if (pktrc == 0 && sigp->pubkey_algo == pubp->pubkey_algo && + if (pubp && pktrc == 0 && sigp->pubkey_algo == pubp->pubkey_algo && memcmp(sigp->signid, pubp->signid, sizeof(sigp->signid)) == 0) { res = RPMRC_OK; } |