aboutsummaryrefslogtreecommitdiffstats
path: root/g10/keylist.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2021-05-19 00:32:19 +0000
committerWerner Koch <[email protected]>2021-05-19 00:42:35 +0000
commit40da61b89b62dcb77847dc79eb159e885f52f817 (patch)
treecc96e9d8b54046a2a541f066c9e579921f07e523 /g10/keylist.c
parentgpg: Fix sending an OpenPGP key with umlaut to an LDAP keyserver. (diff)
downloadgnupg-40da61b89b62dcb77847dc79eb159e885f52f817.tar.gz
gnupg-40da61b89b62dcb77847dc79eb159e885f52f817.zip
gpg: Improve speed of secret key listing.
* agent/command.c (cmd_keyinfo): Factor some code out to ... (get_keyinfo_on_cards): ... new. (cmd_havekey): Add --list mode. * g10/gpg.h (struct server_control_s): Add new caching vars. * g10/gpg.c (gpg_deinit_default_ctrl): Release cache. * g10/call-agent.c (agent_probe_any_secret_key): Init and try to use the keygrip cache. (agent_genkey): Clear the cache. (agent_import_key): Ditto. * g10/keylist.c (list_all, list_one): Pass ctrl to agent_probe_any_secret_key. * g10/getkey.c (lookup): Ditto. -- With this change we first ask the agent for a list of all secret keygrips and use that list instead of asking the agent for each public key. Speeds up my "gpg -K" with a lot of secret and public keys by more than 25%. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'g10/keylist.c')
-rw-r--r--g10/keylist.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/g10/keylist.c b/g10/keylist.c
index e222259ac..de651d671 100644
--- a/g10/keylist.c
+++ b/g10/keylist.c
@@ -553,7 +553,7 @@ list_all (ctrl_t ctrl, int secret, int mark_secret)
}
if (secret || mark_secret)
- any_secret = !agent_probe_any_secret_key (NULL, keyblock);
+ any_secret = !agent_probe_any_secret_key (ctrl, keyblock);
else
any_secret = 0;
@@ -645,7 +645,7 @@ list_one (ctrl_t ctrl, strlist_t names, int secret, int mark_secret)
if (secret)
any_secret = 1;
else if (mark_secret)
- any_secret = !agent_probe_any_secret_key (NULL, keyblock);
+ any_secret = !agent_probe_any_secret_key (ctrl, keyblock);
else
any_secret = 0;