aboutsummaryrefslogtreecommitdiffstats
path: root/g10/packet.h
diff options
context:
space:
mode:
authorNeal H. Walfield <[email protected]>2016-02-19 13:48:56 +0000
committerNeal H. Walfield <[email protected]>2016-02-19 15:13:00 +0000
commitc45633a571bf663bc7f3610fc481acded6acfc19 (patch)
tree4f018128b3528d725717bdcf1102dc6d7fb9d236 /g10/packet.h
parentgpgparsemail: Allow weirdly-mixed pkcs7 signatures. (diff)
downloadgnupg-c45633a571bf663bc7f3610fc481acded6acfc19.tar.gz
gnupg-c45633a571bf663bc7f3610fc481acded6acfc19.zip
gpg: Add accessor & utility functions for pk->keyid and pk->main_keyid.
* g10/keydb.h (keyid_cmp): New function. * g10/keyid.c (pk_keyid): New function. (pk_main_keyid): New function. (keyid_copy): New function. (pk_keyid_str): New function. * g10/packet.h (PKT_public_key): Update comments for main_keyid and keyid. -- Signed-off-by: Neal H. Walfield <[email protected]> Before accessing pk->keyid, it is necessary to call keyid_from_pk (pk, NULL) to ensure that pk->keyid is valid. Because it is easy to forget to do this, these accessor functions take care of it.
Diffstat (limited to 'g10/packet.h')
-rw-r--r--g10/packet.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/g10/packet.h b/g10/packet.h
index 16524f801..dfd3a0008 100644
--- a/g10/packet.h
+++ b/g10/packet.h
@@ -279,8 +279,12 @@ typedef struct
byte pubkey_usage; /* for now only used to pass it to getkey() */
byte req_usage; /* hack to pass a request to getkey() */
u32 has_expired; /* set to the expiration date if expired */
- u32 main_keyid[2]; /* keyid of the primary key */
- u32 keyid[2]; /* calculated by keyid_from_pk() */
+ /* keyid of the primary key. Never access this value directly.
+ Instead, use pk_main_keyid(). */
+ u32 main_keyid[2];
+ /* keyid of this key. Never access this value directly! Instead,
+ use pk_keyid(). */
+ u32 keyid[2];
prefitem_t *prefs; /* list of preferences (may be NULL) */
struct
{