gpg: Improve the keyblock cache's transparency.
authorNeal H. Walfield <neal@g10code.com>
Tue, 15 Dec 2015 11:21:30 +0000 (12:21 +0100)
committerNeal H. Walfield <neal@g10code.com>
Tue, 15 Dec 2015 11:21:30 +0000 (12:21 +0100)
commit2e4e10c1dcd8dfeafec51f44ebf26acfeb770c41
treeeb1c054a94fc82708178c618d30e0dc31760697f
parent0ea186db645da2b51a7e71f46793d447f2de5e3d
gpg: Improve the keyblock cache's transparency.

* kbx/keybox-search.c (keybox_offset): New function.
* g10/keydb.c (struct keyblock_cache): Add fields resource and offset.
(keyblock_cache_clear): Reset HD->KEYBLOCK_CACHE.RESOURCE and
HD->KEYBLOCK_CACHE.OFFSET.
(keydb_search): Don't use the cached result if it comes before the
current file position.  When caching an entry, also record the
position at which it was found.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
GnuPG-bug-id: 2187
g10/keydb.c
kbx/keybox-search.c
kbx/keybox.h