From f369efd6712148dc7ed40dba6d1ff5b0e169431a Mon Sep 17 00:00:00 2001 From: "Neal H. Walfield" Date: Tue, 15 Dec 2015 13:09:27 +0100 Subject: gpg: Improve the keyblock cache's transparency. * kbx/keybox-search.c (keybox_seek): New function. * g10/keydb.c (keydb_search): When reading from the cache, seek to just after the cached record. -- Signed-off-by: Neal H. Walfield --- g10/keydb.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'g10') diff --git a/g10/keydb.c b/g10/keydb.c index 860187fde..b30819963 100644 --- a/g10/keydb.c +++ b/g10/keydb.c @@ -1717,6 +1717,12 @@ keydb_search (KEYDB_HANDLE hd, KEYDB_SEARCH_DESC *desc, /* (DESCINDEX is already set). */ if (DBG_CLOCK) log_clock ("keydb_search leave (cached)"); + + hd->current = hd->keyblock_cache.resource; + /* HD->KEYBLOCK_CACHE.OFFSET is the last byte in the record. + Seek just beyond that. */ + keybox_seek (hd->active[hd->current].u.kb, + hd->keyblock_cache.offset + 1); return 0; } -- cgit v1.2.3