4 #include <rpm/rpmpgp.h>
6 typedef struct pgpDigAlg_s * pgpDigAlg;
8 typedef int (*setmpifunc)(pgpDigAlg digp,
9 int num, const uint8_t *p, const uint8_t *pend);
10 typedef int (*verifyfunc)(pgpDigAlg pgpkey, pgpDigAlg pgpsig,
11 uint8_t *hash, size_t hashlen, int hash_algo);
12 typedef void (*freefunc)(pgpDigAlg digp);
19 void *data; /*!< algorithm specific private data */
23 * Values parsed from OpenPGP signature/pubkey packet(s).
25 struct pgpDigParams_s {
30 uint8_t version; /*!< version number. */
31 pgpTime_t time; /*!< time that the key was created. */
32 uint8_t pubkey_algo; /*!< public key algorithm. */
37 uint8_t signhash16[2];
40 #define PGPDIG_SAVED_TIME (1 << 0)
41 #define PGPDIG_SAVED_ID (1 << 1)
46 pgpDigAlg pgpPubkeyNew(int algo);
48 pgpDigAlg pgpSignatureNew(int algo);
50 pgpDigAlg pgpDigAlgFree(pgpDigAlg da);
53 * Return no. of bits in a multiprecision integer.
54 * @param p pointer to multiprecision integer
58 unsigned int pgpMpiBits(const uint8_t *p)
60 return ((p[0] << 8) | p[1]);
64 * Return no. of bytes in a multiprecision integer.
65 * @param p pointer to multiprecision integer
66 * @return no. of bytes
69 size_t pgpMpiLen(const uint8_t *p)
71 return (2 + ((pgpMpiBits(p)+7)>>3));
74 #endif /* _RPMDIGEST_H */