cscvs to tla changeset 2
[onak.git] / keystructs.h
1 /*
2  * keystructs.h - Structures for OpenPGP keys
3  *
4  * Jonathan McDowell <noodles@earth.li>
5  *
6  * Copyright 2002 Project Purple
7  */
8
9 #ifndef __KEYSTRUCTS_H__
10 #define __KEYSTRUCTS_H__
11
12 #include <stdbool.h>
13 #include <stdlib.h>
14
15 /**
16  *      struct openpgp_packet - Stores an OpenPGP packet.
17  *      @tag: The packet tag (ie type).
18  *      @newformat: Indicates if this is a new format packet.
19  *      @length: The length of the packet.
20  *      @data: The actual packet
21  *
22  *      This structure holds any form of OpenPGP packet with minimum common
23  *      details decoded out.
24  */
25 struct openpgp_packet {
26         unsigned int tag;
27         bool newformat;
28         size_t length;
29         unsigned char *data;
30 };
31
32 /**
33  *      struct openpgp_packet_list - A linked list of OpenPGP packets.
34  *      @packet: The actual packet structure.
35  *      @next: A pointer to the next packet in the list.
36  *
37  *      This structure is used to hold a linked list of packets, for example
38  *      all the signatures of a public key's UID.
39  */
40 struct openpgp_packet_list {
41         struct openpgp_packet *packet;
42         struct openpgp_packet_list *next;
43 };
44
45 /**
46  *      struct openpgp_signedpacket_list - A packet with signatures.
47  *      @uid: The OpenPGP packet that's signed.
48  *      @sigs: A list of sigs for the packet.
49  *      @next: A pointer to the next packet with signatures.
50  *
51  *      This structure holds an OpenPGP packet along with signatures that are
52  *      over this packet. It also links to the next signed packet. It's usually
53  *      used to hold a UID or subkey with their associated signatures.
54  */
55 struct openpgp_signedpacket_list {
56         struct openpgp_packet *packet;
57         struct openpgp_packet_list *sigs;
58         struct openpgp_packet_list *last_sig;
59         struct openpgp_signedpacket_list *next;
60 };
61
62 /**
63  *      struct openpgp_publickey - An OpenPGP public key complete with sigs.
64  *      @publickey: The OpenPGP packet for the public key.
65  *      @revocation: The OpenPGP packet for the revocation [optional]
66  *      @uids: The list of UIDs with signatures for this key.
67  *      @subkeys: The list of subkeys with signatures for this key.
68  *      @next: The next public key.
69  */
70 struct openpgp_publickey {
71         struct openpgp_packet                   *publickey;
72         struct openpgp_packet_list              *revocations;
73         struct openpgp_packet_list              *last_revocation;
74         struct openpgp_signedpacket_list        *uids;
75         struct openpgp_signedpacket_list        *last_uid;
76         struct openpgp_signedpacket_list        *subkeys;
77         struct openpgp_signedpacket_list        *last_subkey;
78         struct openpgp_publickey                *next;
79 };
80
81 #endif /* __KEYSTRUCTS_H__ */