+ * @a: The first packet to compare.
+ * @b: The second packet to compare.
+ *
+ * Takes 2 packets and returns 0 if they are the same, -1 if a is
+ * less than b, or 1 if a is greater than b.
+ */
+int compare_packets(struct openpgp_packet *a, struct openpgp_packet *b)
+{
+ int ret, len;
+
+ if (a->tag > b->tag) {
+ ret = 1;
+ } else if (b->tag > a->tag) {
+ ret = -1;
+ } else {
+ len = (a->length < b->length) ? a->length : b->length;
+ ret = memcmp(a->data, b->data, len);
+ if (ret == 0 && a->length != b->length) {
+ ret = (a->length < b->length) ? -1 : 1;
+ }
+ }
+
+ return ret;
+}
+
+/**
+ * compare_signatures - Check to see if 2 OpenPGP signatures are the same.
+ * @a: The first signature to compare.
+ * @b: The second signature to compare.