summaryrefslogtreecommitdiffstats
path: root/g10/keydb.h
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@g10code.com>2016-11-21 16:19:32 +0100
committerNeal H. Walfield <neal@g10code.com>2016-11-21 16:39:53 +0100
commit91a0483c5db8ee4510981448a705981ee1cce199 (patch)
tree5583a2601a30186c2d9135cf5c82b33204577537 /g10/keydb.h
parentbuild: Add repo-only maintainer script append-signature.sh. (diff)
downloadgnupg2-91a0483c5db8ee4510981448a705981ee1cce199.tar.xz
gnupg2-91a0483c5db8ee4510981448a705981ee1cce199.zip
g10: Add a convenience function for checking if a key is a primary key
* g10/keydb.h (pk_is_primary): New function. * g10/tofu.c (get_trust): Use it. (tofu_register_signature): Likewise. (tofu_register_encryption): Likewise. (tofu_set_policy): Likewise. (tofu_get_policy): Likewise. Signed-off-by: Neal H. Walfield <neal@g10code.com>
Diffstat (limited to 'g10/keydb.h')
-rw-r--r--g10/keydb.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/g10/keydb.h b/g10/keydb.h
index 815b17ee8..e4fbe274f 100644
--- a/g10/keydb.h
+++ b/g10/keydb.h
@@ -433,6 +433,13 @@ keyid_cmp (const u32 *a, const u32 *b)
return 0;
}
+/* Return whether PK is a primary key. */
+static int GPGRT_ATTR_UNUSED
+pk_is_primary (PKT_public_key *pk)
+{
+ return keyid_cmp (pk_keyid (pk), pk_main_keyid (pk)) == 0;
+}
+
/* Copy the keyid in SRC to DEST and return DEST. */
u32 *keyid_copy (u32 *dest, const u32 *src);