summaryrefslogtreecommitdiff
path: root/rpmio/digest.h
blob: 9199a8d4550a812d9e391ebd8fa50703978da65c (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
#ifndef _RPMDIGEST_H
#define _RPMDIGEST_H

#include "rpmio/base64.h"
#include <rpmpgp.h>

#include <nss.h>
#include <sechash.h>
#include <keyhi.h>
#include <cryptohi.h>

/** \ingroup rpmio
 * Values parsed from OpenPGP signature/pubkey packet(s).
 */
struct pgpDigParams_s {
    const char * userid;
    const uint8_t * hash;
    const char * params[4];
    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];
    uint8_t signid[8];
    uint8_t saved;
#define	PGPDIG_SAVED_TIME	(1 << 0)
#define	PGPDIG_SAVED_ID		(1 << 1)

};

/** \ingroup rpmio
 * Container for values parsed from an OpenPGP signature and public key.
 */
struct pgpDig_s {
    struct pgpDigParams_s signature;
    struct pgpDigParams_s pubkey;

    size_t nbytes;		/*!< No. bytes of plain text. */

    DIGEST_CTX sha1ctx;		/*!< (dsa) sha1 hash context. */
    DIGEST_CTX hdrsha1ctx;	/*!< (dsa) header sha1 hash context. */
    void * sha1;		/*!< (dsa) V3 signature hash. */
    size_t sha1len;		/*!< (dsa) V3 signature hash length. */

    DIGEST_CTX md5ctx;		/*!< (rsa) md5 hash context. */
    DIGEST_CTX hdrmd5ctx;	/*!< (rsa) header md5 hash context. */
    void * md5;			/*!< (rsa) V3 signature hash. */
    size_t md5len;		/*!< (rsa) V3 signature hash length. */

    /* DSA parameters */
    SECKEYPublicKey *dsa;
    SECItem *dsasig;

    /* RSA parameters */
    SECKEYPublicKey *rsa;
    SECItem *rsasig;
};

#endif /* _RPMDIGEST_H */