[PATCH] Create cache item for current key from previous.

Ben Kibbey bjk at luxsci.net
Sun Jul 24 03:01:56 CEST 2016

* agent/findkey.c (unprotect): Create cache item from previous and
current values.

Fixes the KEYINFO cache field for a key that previously failed do to not
being found in the cache but succeeded when the last_stored_cache_key
was tried. Use the last_stored_cache_key cached passphrase for the new
cache entry for the current keygrip.

Has the limitation that the key will need to be used at least once
before the cache field of KEYINFO is updated.

Signed-off-by: Ben Kibbey <bjk at luxsci.net>
 agent/findkey.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/agent/findkey.c b/agent/findkey.c
index c5ab0e9..838e17f 100644
--- a/agent/findkey.c
+++ b/agent/findkey.c
@@ -528,6 +528,7 @@ unprotect (ctrl_t ctrl, const char *cache_nonce, const char *desc_text,
                                     &result, &resultlen);
               if (!rc)
+                  agent_put_cache (hexgrip, cache_mode, pw, 0);
                   if (r_passphrase)
                     *r_passphrase = pw;

More information about the Gnupg-devel mailing list