aboutsummaryrefslogtreecommitdiffstats
path: root/g10/pkclist.c
diff options
context:
space:
mode:
authorNeal H. Walfield <[email protected]>2016-09-06 13:45:38 +0000
committerNeal H. Walfield <[email protected]>2016-09-06 19:37:48 +0000
commit875ac9216f1383851a82bd240cadb17c7112f6a8 (patch)
treef5ec927728294d2fbfedaae8204a03e8171f1bc0 /g10/pkclist.c
parentg10: Simplify the binding statistics shown for a TOFU conflict. (diff)
downloadgnupg-875ac9216f1383851a82bd240cadb17c7112f6a8.tar.gz
gnupg-875ac9216f1383851a82bd240cadb17c7112f6a8.zip
g10: Record and show statistics for encrypted messages when using TOFU
* g10/tofu.c: Include "sqrtu32.h". (struct tofu_dbs_s.s): Rename get_trust_gather_other_keys to get_trust_gather_signature_stats. Add new field get_trust_gather_encryption_stats. (initdb): Create the encryptions table. (ask_about_binding): Show the encryption statistics too. (tofu_register): Rename from this... (tofu_register_signature): ... to this and update callers. (tofu_register_encryption): New function. (write_stats_status): Add parameters encryption_count, encryption_first_done and encryption_most_recent. Update callers. Compute the trust using the euclidean distance of the signature and signature count. Compare with twice the threshold. Include encryption count information in the TFS and TOFU_STATS lines. (show_statistics): Also get information about the encrypted messages. * g10/trustdb.c (tdb_get_validity_core): Use it. -- Signed-off-by: Neal H. Walfield <[email protected]>
Diffstat (limited to 'g10/pkclist.c')
-rw-r--r--g10/pkclist.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/g10/pkclist.c b/g10/pkclist.c
index f7b248375..62f5b7f9b 100644
--- a/g10/pkclist.c
+++ b/g10/pkclist.c
@@ -1314,6 +1314,29 @@ build_pk_list (ctrl_t ctrl, strlist_t rcpts, PK_LIST *ret_pk_list)
rc = GPG_ERR_NO_USER_ID;
}
+#ifdef USE_TOFU
+ if (! rc && (opt.trust_model == TM_TOFU_PGP || opt.trust_model == TM_TOFU))
+ {
+ PK_LIST iter;
+ for (iter = pk_list; iter; iter = iter->next)
+ {
+ int rc2;
+
+ /* Note: we already resolved any conflict when looking up
+ the key. Don't annoy the user again if she selected
+ accept once. */
+ rc2 = tofu_register_encryption (ctrl, iter->pk, NULL, 0);
+ if (rc2)
+ log_info ("WARNING: Failed to register encryption to %s"
+ " with TOFU engine\n",
+ keystr (pk_main_keyid (iter->pk)));
+ else if (DBG_TRUST)
+ log_debug ("Registered encryption to %s with TOFU DB.\n",
+ keystr (pk_main_keyid (iter->pk)));
+ }
+ }
+#endif /*USE_TOFU*/
+
fail:
if ( rc )