Add ad API for retrieving algorithm values from digest parameter containers

- Mildly annoying but necessary in order to make pgpDigParams properly
  opaque some day (and also allow sane access to this data)
This commit is contained in:
Panu Matilainen 2011-11-07 14:42:13 +02:00
parent 45c880304b
commit a6f25aff43
2 changed files with 24 additions and 0 deletions

View File

@ -920,6 +920,22 @@ exit:
return rc;
}
unsigned int pgpDigParamsAlgo(pgpDigParams digp, unsigned int algotype)
{
unsigned int algo = 0; /* assume failure */
if (digp) {
switch (algotype) {
case PGPVAL_PUBKEYALGO:
algo = digp->pubkey_algo;
break;
case PGPVAL_HASHALGO:
algo = digp->hash_algo;
break;
}
}
return algo;
}
int pgpPrtPkts(const uint8_t * pkts, size_t pktlen, pgpDig dig, int printing)
{
const uint8_t *p = pkts;

View File

@ -1060,6 +1060,14 @@ pgpDigParams pgpDigGetParams(pgpDig dig, unsigned int pkttype);
*/
int pgpDigParamsCmp(pgpDigParams p1, pgpDigParams p2);
/** \ingroup rpmpgp
* Retrieve OpenPGP algorithm parameters
* param digp parameter container
* param algotype PGPVAL_HASHALGO / PGPVAL_PUBKEYALGO
* return algorithm value, 0 on error
*/
unsigned int pgpDigParamsAlgo(pgpDigParams digp, unsigned int algotype);
/** \ingroup rpmpgp
* Verify a PGP signature.
* @param key public key