2 * merge.h - Routines to merge OpenPGP public keys.
4 * Copyright 2002-2005,2007,2011 Jonathan McDowell <noodles@earth.li>
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; version 2 of the License.
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 #include "keystructs.h"
25 * compare_packets - Check to see if 2 OpenPGP packets are the same.
26 * @a: The first packet to compare.
27 * @b: The second packet to compare.
29 * Takes 2 packets and returns 0 if they are the same, -1 if a is
30 * less than b, or 1 if a is greater than b.
32 int compare_packets(struct openpgp_packet *a, struct openpgp_packet *b);
35 * merge_keys - Takes 2 public keys and merges them.
36 * @a: The old key. The merged key is returned in this structure.
37 * @b: The new key. The changed from old to new keys are returned in this
40 * This function takes 2 keys and merges them. It then returns the merged
41 * key in a and the difference between this new key and the original a
42 * in b (ie newb contains the minimum amount of detail necessary to
43 * convert olda to newa). The intention is that olda is provided from
44 * internal storage and oldb from the remote user. newa is then stored in
45 * internal storage and newb is sent to all our keysync peers.
47 int merge_keys(struct openpgp_publickey *a, struct openpgp_publickey *b);
50 * find_packet - Checks to see if an OpenPGP packet exists in a list.
51 * @packet_list: The list of packets to look in.
52 * @packet: The packet to look for.
54 * Walks through the packet_list checking to see if the packet given is
55 * present in it. Returns true if it is.
57 bool find_packet(struct openpgp_packet_list *packet_list,
58 struct openpgp_packet *packet);
61 * get_signed_packet - Gets a signed packet from a list.
62 * @packet_list: The list of packets to look in.
63 * @packet: The packet to look for.
65 * Walks through the signedpacket_list looking for the supplied packet and
66 * returns it if found. Otherwise returns NULL.
68 struct openpgp_signedpacket_list *find_signed_packet(
69 struct openpgp_signedpacket_list *packet_list,
70 struct openpgp_packet *packet);
73 * merge_packet_sigs - Takes 2 signed packets and merges their sigs.
74 * @old: The old signed packet.
75 * @new: The new signed packet.
77 * Takes 2 signed packet list structures and the sigs of the packets on
78 * the head of these structures. These packets must both be the same and
79 * the fully merged structure is returned in old and the minimal
80 * difference to get from old to new in new.
82 int merge_packet_sigs(struct openpgp_signedpacket_list *old,
83 struct openpgp_signedpacket_list *new);