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, see <https://www.gnu.org/licenses/>.
21 #include "keystructs.h"
24 * compare_packets - Check to see if 2 OpenPGP packets are the same.
25 * @a: The first packet to compare.
26 * @b: The second packet to compare.
28 * Takes 2 packets and returns 0 if they are the same, -1 if a is
29 * less than b, or 1 if a is greater than b.
31 int compare_packets(struct openpgp_packet *a, struct openpgp_packet *b);
34 * merge_keys - Takes 2 public keys and merges them.
35 * @a: The old key. The merged key is returned in this structure.
36 * @b: The new key. The changed from old to new keys are returned in this
39 * This function takes 2 keys and merges them. It then returns the merged
40 * key in a and the difference between this new key and the original a
41 * in b (ie newb contains the minimum amount of detail necessary to
42 * convert olda to newa). The intention is that olda is provided from
43 * internal storage and oldb from the remote user. newa is then stored in
44 * internal storage and newb is sent to all our keysync peers.
46 int merge_keys(struct openpgp_publickey *a, struct openpgp_publickey *b);
49 * find_packet - Checks to see if an OpenPGP packet exists in a list.
50 * @packet_list: The list of packets to look in.
51 * @packet: The packet to look for.
53 * Walks through the packet_list checking to see if the packet given is
54 * present in it. Returns true if it is.
56 bool find_packet(struct openpgp_packet_list *packet_list,
57 struct openpgp_packet *packet);
60 * get_signed_packet - Gets a signed packet from a list.
61 * @packet_list: The list of packets to look in.
62 * @packet: The packet to look for.
64 * Walks through the signedpacket_list looking for the supplied packet and
65 * returns it if found. Otherwise returns NULL.
67 struct openpgp_signedpacket_list *find_signed_packet(
68 struct openpgp_signedpacket_list *packet_list,
69 struct openpgp_packet *packet);
72 * merge_packet_sigs - Takes 2 signed packets and merges their sigs.
73 * @old: The old signed packet.
74 * @new: The new signed packet.
76 * Takes 2 signed packet list structures and the sigs of the packets on
77 * the head of these structures. These packets must both be the same and
78 * the fully merged structure is returned in old and the minimal
79 * difference to get from old to new in new.
81 int merge_packet_sigs(struct openpgp_signedpacket_list *old,
82 struct openpgp_signedpacket_list *new);