diff options
author | Werner Koch <[email protected]> | 2016-08-23 13:22:28 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2016-08-23 13:24:10 +0000 |
commit | be4ff75d7d5ac6ed15feb245ef3cec59b4bad561 (patch) | |
tree | 67dffdf32235e3e459aa52cd1b248420a6dc480f /src/keylist.c | |
parent | core: Extend gpgme_user_id_t with 'address'. (diff) | |
download | gpgme-be4ff75d7d5ac6ed15feb245ef3cec59b4bad561.tar.gz gpgme-be4ff75d7d5ac6ed15feb245ef3cec59b4bad561.zip |
core: Change the way TOFU information are represented.
* src/gpgme.h.in (struct _gpgme_signature): Remove field 'tofu'. Add
field 'key'.
(struct _gpgme_key): Add field 'fpr'.
(struct _gpgme_user_id): Add field 'tofu'.
(struct _gpgme_tofu_info): Remove fields 'address' and 'fpr'.
* src/key.c (gpgme_key_unref): Release TOFU and FPR.
* src/keylist.c (keylist_colon_handler): Store the fingerprint of the
first subkey also in KEY.
* src/verify.c (release_tofu_info): Remove.
(release_op_data): Release KEY.
(parse_tofu_user): Rewrite for new data structure.
(parse_tofu_stats): Ditto.
(parse_tofu_stats_long): Ditto.
* tests/run-verify.c (print_result): Ditto.
* tests/run-keylist.c (main): Print more fields.
--
TOFU information are now associated with the user ID and not with a
separate object.
Note that this breaks code relying on the former non-released TOFU
feature. The C++ bindings won't work right now.
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'src/keylist.c')
-rw-r--r-- | src/keylist.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/keylist.c b/src/keylist.c index 5a346ea4..38ddd0c5 100644 --- a/src/keylist.c +++ b/src/keylist.c @@ -708,6 +708,22 @@ keylist_colon_handler (void *priv, char *line) if (!subkey->fpr) return gpg_error_from_syserror (); } + /* If this is the first subkey, store the fingerprint also + in the KEY object. */ + if (subkey == key->subkeys) + { + if (key->fpr && strcmp (key->fpr, subkey->fpr)) + { + /* FPR already set but mismatch: Should never happen. */ + return trace_gpg_error (GPG_ERR_INTERNAL); + } + if (!key->fpr) + { + key->fpr = strdup (subkey->fpr); + if (!key->fpr) + return gpg_error_from_syserror (); + } + } } /* Field 13 has the gpgsm chain ID (take only the first one). */ |