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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
|
/*
* keystructs.h - Structures for OpenPGP keys
*
* Copyright 2002 Jonathan McDowell <noodles@earth.li>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KEYSTRUCTS_H__
#define __KEYSTRUCTS_H__
#include <inttypes.h>
#include <stdbool.h>
#include <stdlib.h>
#include "ll.h"
/**
* struct openpgp_packet - Stores an OpenPGP packet.
* @tag: The packet tag (ie type).
* @newformat: Indicates if this is a new format packet.
* @length: The length of the packet.
* @data: The actual packet
*
* This structure holds any form of OpenPGP packet with minimum common
* details decoded out.
*/
struct openpgp_packet {
unsigned int tag;
bool newformat;
size_t length;
unsigned char *data;
};
/**
* struct openpgp_packet_list - A linked list of OpenPGP packets.
* @packet: The actual packet structure.
* @next: A pointer to the next packet in the list.
*
* This structure is used to hold a linked list of packets, for example
* all the signatures of a public key's UID.
*/
struct openpgp_packet_list {
struct openpgp_packet *packet;
struct openpgp_packet_list *next;
};
/**
* struct openpgp_signedpacket_list - A packet with signatures.
* @uid: The OpenPGP packet that's signed.
* @sigs: A list of sigs for the packet.
* @next: A pointer to the next packet with signatures.
*
* This structure holds an OpenPGP packet along with signatures that are
* over this packet. It also links to the next signed packet. It's usually
* used to hold a UID or subkey with their associated signatures.
*/
struct openpgp_signedpacket_list {
struct openpgp_packet *packet;
struct openpgp_packet_list *sigs;
struct openpgp_packet_list *last_sig;
struct openpgp_signedpacket_list *next;
};
/**
* struct openpgp_publickey - An OpenPGP public key complete with sigs.
* @publickey: The OpenPGP packet for the public key.
* @revoked: True if the key is revoked.
* @sigs: Any signatures directly on the publickey packet.
* @uids: The list of UIDs with signatures for this key.
* @subkeys: The list of subkeys with signatures for this key.
* @next: The next public key.
*/
struct openpgp_publickey {
struct openpgp_packet *publickey;
bool revoked;
struct openpgp_packet_list *sigs;
struct openpgp_packet_list *last_sig;
struct openpgp_signedpacket_list *uids;
struct openpgp_signedpacket_list *last_uid;
struct openpgp_signedpacket_list *subkeys;
struct openpgp_signedpacket_list *last_subkey;
struct openpgp_publickey *next;
};
/**
* struct stats_key - holds key details suitable for doing stats on.
* @keyid: The keyid.
* @colour: Used for marking during DFS/BFS.
* @parent: The key that lead us to this one for DFS/BFS.
* @sigs: A linked list of the signatures on this key.
* @gotsigs: A bool indicating if we've initialized the sigs element yet.
* @disabled: If we shouldn't consider the key in calculations.
* @revoked: If the key is revoked (and shouldn't be considered).
*/
struct stats_key {
uint64_t keyid;
int colour;
uint64_t parent;
struct ll *sigs;
struct ll *signs;
bool gotsigs;
bool disabled;
bool revoked;
};
/**
* struct skshash - holds an SKS key hash (md5 over sorted packet list)
* @hash: The 128 bit MD5 hash of the sorted packet list from the key
*/
struct skshash {
uint8_t hash[16];
};
#endif /* __KEYSTRUCTS_H__ */
|