summaryrefslogtreecommitdiffstats
path: root/agent/findkey.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2010-09-02 12:46:23 +0200
committerWerner Koch <wk@gnupg.org>2010-09-02 12:46:23 +0200
commit90a4599c5ee0b6f8740d8b537013e68839112217 (patch)
treeb320fb2244bf1e150a9308d531f0cd5db2ffdf16 /agent/findkey.c
parentEven less prompts for a new key now. (diff)
downloadgnupg2-90a4599c5ee0b6f8740d8b537013e68839112217.tar.xz
gnupg2-90a4599c5ee0b6f8740d8b537013e68839112217.zip
Obscure the cached passphrases.
Diffstat (limited to 'agent/findkey.c')
-rw-r--r--agent/findkey.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/agent/findkey.c b/agent/findkey.c
index 5f98d59d6..02aea24e5 100644
--- a/agent/findkey.c
+++ b/agent/findkey.c
@@ -291,14 +291,13 @@ unprotect (ctrl_t ctrl, const char *cache_nonce, const char *desc_text,
/* Initially try to get it using a cache nonce. */
if (cache_nonce)
{
- void *cache_marker;
- const char *pw;
+ char *pw;
- pw = agent_get_cache (cache_nonce, CACHE_MODE_NONCE, &cache_marker);
+ pw = agent_get_cache (cache_nonce, CACHE_MODE_NONCE);
if (pw)
{
rc = agent_unprotect (*keybuf, pw, NULL, &result, &resultlen);
- agent_unlock_cache_entry (&cache_marker);
+ xfree (pw);
if (!rc)
{
xfree (*keybuf);
@@ -312,15 +311,14 @@ unprotect (ctrl_t ctrl, const char *cache_nonce, const char *desc_text,
unprotect it, we fall back to ask the user */
if (cache_mode != CACHE_MODE_IGNORE)
{
- void *cache_marker;
- const char *pw;
+ char *pw;
retry:
- pw = agent_get_cache (hexgrip, cache_mode, &cache_marker);
+ pw = agent_get_cache (hexgrip, cache_mode);
if (pw)
{
rc = agent_unprotect (*keybuf, pw, NULL, &result, &resultlen);
- agent_unlock_cache_entry (&cache_marker);
+ xfree (pw);
if (!rc)
{
xfree (*keybuf);