diff options
author | Werner Koch <[email protected]> | 2016-09-07 07:26:11 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2016-09-07 07:26:11 +0000 |
commit | 120b14783c0312d782dc08ce4949a6209d5ccc7b (patch) | |
tree | 6cbd39d10a102aed9ce9b46e0e1d34c05909489e /src/verify.c | |
parent | tests: Set passphrase cb in t-encrypt-mixed (diff) | |
download | gpgme-120b14783c0312d782dc08ce4949a6209d5ccc7b.tar.gz gpgme-120b14783c0312d782dc08ce4949a6209d5ccc7b.zip |
core,cpp: Extend the TOFU information.
* src/gpgme.h.in (struct _gpeme_tofu_info): Rename FIRSTSEEN to
SIGNFIRST and LASTSEEN to SIGNLAST. Add ENCRFIST and ENCRLAST.
* src/keylist.c (parse_tfs_record): Parse to ENCRFIRST and ENCRLAST.
* src/verify.c (parse_tofu_stats): Ditto.
* tests/run-keylist.c (main): Adjust and print encrypt stats.
* tests/run-verify.c (print_result): Ditto.
* lang/cpp/src/tofuinfo.h (TofuInfo): Rename firstSeen to signFirst
and lastSeen to signLast. Add encrCount, encrFirst and encrLast.
* lang/cpp/src/tofuinfo.cpp (encrCount, encrFirst, encrLast): New.
--
The latest GnuPG commits have the needed changes but we also allow the
use of currently released GnuPG version.
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'src/verify.c')
-rw-r--r-- | src/verify.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/verify.c b/src/verify.c index 92eb3334..5ac937d9 100644 --- a/src/verify.c +++ b/src/verify.c @@ -755,20 +755,21 @@ parse_tofu_user (gpgme_signature_t sig, char *args, gpgme_protocol_t protocol) /* Parse a TOFU_STATS line and store it in the last tofu info of SIG. * - * TOFU_STATS <validity> <sign-count> <encr-count> [<policy> [<tm1> <tm2>]] + * TOFU_STATS <validity> <sign-count> <encr-count> \ + * [<policy> [<tm1> <tm2> <tm3> <tm4>]] */ static gpgme_error_t parse_tofu_stats (gpgme_signature_t sig, char *args) { gpgme_error_t err; gpgme_tofu_info_t ti; - char *field[6]; + char *field[8]; int nfields; unsigned long uval; if (!sig->key || !sig->key->_last_uid || !(ti = sig->key->_last_uid->tofu)) return trace_gpg_error (GPG_ERR_INV_ENGINE); /* No TOFU_USER seen. */ - if (ti->firstseen || ti->signcount || ti->validity || ti->policy) + if (ti->signfirst || ti->signcount || ti->validity || ti->policy) return trace_gpg_error (GPG_ERR_INV_ENGINE); /* Already set. */ nfields = _gpgme_split_fields (args, field, DIM (field)); @@ -824,11 +825,24 @@ parse_tofu_stats (gpgme_signature_t sig, char *args) err = _gpgme_strtoul_field (field[4], &uval); if (err) return trace_gpg_error (GPG_ERR_INV_ENGINE); - ti->firstseen = uval; + ti->signfirst = uval; err = _gpgme_strtoul_field (field[5], &uval); if (err) return trace_gpg_error (GPG_ERR_INV_ENGINE); - ti->lastseen = uval; + ti->signlast = uval; + if (nfields > 7) + { + /* This condition is only to allow for gpg 2.1.15 - can + * eventually be removed. */ + err = _gpgme_strtoul_field (field[6], &uval); + if (err) + return trace_gpg_error (GPG_ERR_INV_ENGINE); + ti->encrfirst = uval; + err = _gpgme_strtoul_field (field[7], &uval); + if (err) + return trace_gpg_error (GPG_ERR_INV_ENGINE); + ti->encrlast = uval; + } return 0; } |