blob: f10f1c871d766f7c63d6e09d45f614413ed9a541 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
#ifndef _RPMDIGEST_H
#define _RPMDIGEST_H
#include <rpm/rpmpgp.h>
typedef struct pgpDigAlg_s * pgpDigAlg;
typedef int (*setmpifunc)(pgpDigAlg digp,
int num, const uint8_t *p, const uint8_t *pend);
typedef int (*verifyfunc)(pgpDigAlg pgpkey, pgpDigAlg pgpsig,
uint8_t *hash, size_t hashlen, int hash_algo);
typedef void (*freefunc)(pgpDigAlg digp);
struct pgpDigAlg_s {
setmpifunc setmpi;
verifyfunc verify;
freefunc free;
int mpis;
void *data; /*!< algorithm specific private data */
};
/** \ingroup rpmio
* Values parsed from OpenPGP signature/pubkey packet(s).
*/
struct pgpDigParams_s {
char * userid;
uint8_t * hash;
uint8_t tag;
uint8_t version; /*!< version number. */
pgpTime_t time; /*!< time that the key was created. */
uint8_t pubkey_algo; /*!< public key algorithm. */
uint8_t hash_algo;
uint8_t sigtype;
uint8_t hashlen;
uint8_t signhash16[2];
pgpKeyID_t signid;
uint8_t saved;
#define PGPDIG_SAVED_TIME (1 << 0)
#define PGPDIG_SAVED_ID (1 << 1)
pgpDigAlg alg;
};
pgpDigAlg pgpPubkeyNew(int algo);
pgpDigAlg pgpSignatureNew(int algo);
pgpDigAlg pgpDigAlgFree(pgpDigAlg da);
/** \ingroup rpmpgp
* Return no. of bits in a multiprecision integer.
* @param p pointer to multiprecision integer
* @return no. of bits
*/
static inline
unsigned int pgpMpiBits(const uint8_t *p)
{
return ((p[0] << 8) | p[1]);
}
/** \ingroup rpmpgp
* Return no. of bytes in a multiprecision integer.
* @param p pointer to multiprecision integer
* @return no. of bytes
*/
static inline
size_t pgpMpiLen(const uint8_t *p)
{
return (2 + ((pgpMpiBits(p)+7)>>3));
}
#endif /* _RPMDIGEST_H */
|