summaryrefslogtreecommitdiffstats
path: root/g10/gpg.h
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2017-03-31 20:44:05 +0200
committerWerner Koch <wk@gnupg.org>2017-03-31 21:27:16 +0200
commit5556eca5acd46983bff0b38a1ffbc2f07fbaba9f (patch)
tree5bf542ac76662ed10a5b7bf9d4d7db69c7656ae3 /g10/gpg.h
parentgpg: Pass CTRL also to getkey_end. (diff)
downloadgnupg2-5556eca5acd46983bff0b38a1ffbc2f07fbaba9f.tar.xz
gnupg2-5556eca5acd46983bff0b38a1ffbc2f07fbaba9f.zip
gpg: Avoid multiple open calls to the keybox file.
* g10/keydb.h (KEYDB_HANDLE): Move typedef to ... * g10/gpg.h: here. (struct server_control_s): Add field 'cached_getkey_kdb'. * g10/gpg.c (gpg_deinit_default_ctrl): Release that keydb handle. * g10/getkey.c (getkey_end): Cache keydb handle. (get_pubkey): Use cached keydb handle. * kbx/keybox-search.c (keybox_search_reset): Use lseek instead of closing the file. -- Before this patch a "gpg --check-sigs" opened and closed the keybox file for almost every signature check. By caching the keydb handle and using lseek(2) this can be limited to just 2 times. This might speed up things on Windows. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'g10/gpg.h')
-rw-r--r--g10/gpg.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/g10/gpg.h b/g10/gpg.h
index c66358570..9b8b77ca0 100644
--- a/g10/gpg.h
+++ b/g10/gpg.h
@@ -59,10 +59,13 @@ struct server_local_s;
struct dirmngr_local_s;
typedef struct dirmngr_local_s *dirmngr_local_t;
-/* Object used to describe a keyblok node. */
+/* Object used to describe a keyblock node. */
typedef struct kbnode_struct *KBNODE; /* Deprecated use kbnode_t. */
typedef struct kbnode_struct *kbnode_t;
+/* The handle for keydb operations. */
+typedef struct keydb_handle *KEYDB_HANDLE;
+
/* TOFU database meta object. */
struct tofu_dbs_s;
typedef struct tofu_dbs_s *tofu_dbs_t;
@@ -94,6 +97,8 @@ struct server_control_s
int batch_updated_wanted;
} tofu;
+ /* This is used to cache a key data base handle. */
+ KEYDB_HANDLE cached_getkey_kdb;
};