4 #include <rpm/rpmpgp.h>
6 typedef struct pgpDigAlg_s * pgpDigAlg;
8 typedef int (*setmpifunc)(pgpDigAlg digp, int num, const uint8_t *p);
9 typedef int (*verifyfunc)(pgpDigAlg pgpkey, pgpDigAlg pgpsig,
10 uint8_t *hash, size_t hashlen, int hash_algo);
11 typedef void (*freefunc)(pgpDigAlg digp);
18 void *data; /*!< algorithm specific private data */
22 * Values parsed from OpenPGP signature/pubkey packet(s).
24 struct pgpDigParams_s {
29 uint8_t version; /*!< version number. */
30 uint32_t time; /*!< key/signature creation time. */
31 uint8_t pubkey_algo; /*!< public key algorithm. */
36 uint8_t signhash16[2];
39 #define PGPDIG_SAVED_TIME (1 << 0)
40 #define PGPDIG_SAVED_ID (1 << 1)
45 pgpDigAlg pgpPubkeyNew(int algo);
47 pgpDigAlg pgpSignatureNew(int algo);
49 pgpDigAlg pgpDigAlgFree(pgpDigAlg da);
52 * Return no. of bits in a multiprecision integer.
53 * @param p pointer to multiprecision integer
57 unsigned int pgpMpiBits(const uint8_t *p)
59 return ((p[0] << 8) | p[1]);
63 * Return no. of bytes in a multiprecision integer.
64 * @param p pointer to multiprecision integer
65 * @return no. of bytes
68 size_t pgpMpiLen(const uint8_t *p)
70 return (2 + ((pgpMpiBits(p)+7)>>3));
73 #endif /* _RPMDIGEST_H */