aboutsummaryrefslogtreecommitdiffstats
path: root/agent/findkey.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2014-03-04 02:54:59 +0000
committerNIIBE Yutaka <[email protected]>2014-03-11 07:03:01 +0000
commitac5a1a3ccb7c3e6393bc83d73b545dec9b70e7d1 (patch)
tree66bfee42a5e19cad0c50651844b9bf7670a54ec9 /agent/findkey.c
parentBackport useful code from fixes for bug 1447. (diff)
downloadgnupg-ac5a1a3ccb7c3e6393bc83d73b545dec9b70e7d1.tar.gz
gnupg-ac5a1a3ccb7c3e6393bc83d73b545dec9b70e7d1.zip
agent: API change of agent_key_from_file.
* agent/findkey.c (agent_key_from_file): Always return S-expression. * agent/command.c (cmd_passwd): Distinguish by SHADOW_INFO. (cmd_export_key): Likewise. Free SHADOW_INFO. (cmd_keytocard): Likewise. Release S_SKEY. * agent/pkdecrypt.c (agent_pkdecrypt): Likewise. * agent/pksign.c (agent_pksign_do): Likewise. Use the S-expression to know the key type. Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'agent/findkey.c')
-rw-r--r--agent/findkey.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/agent/findkey.c b/agent/findkey.c
index 6464b02ac..7b24c55ed 100644
--- a/agent/findkey.c
+++ b/agent/findkey.c
@@ -537,9 +537,9 @@ read_key_file (const unsigned char *grip, gcry_sexp_t *result)
/* Return the secret key as an S-Exp in RESULT after locating it using
- the GRIP. Stores NULL at RESULT if the operation shall be diverted
- to a token; in this case an allocated S-expression with the
- shadow_info part from the file is stored at SHADOW_INFO.
+ the GRIP. If the operation shall be diverted to a token, an
+ allocated S-expression with the shadow_info part from the file is
+ stored at SHADOW_INFO; if not NULL will be stored at SHADOW_INFO.
CACHE_MODE defines now the cache shall be used. DESC_TEXT may be
set to present a custom description for the pinentry. LOOKUP_TTL
is an optional function to convey a TTL to the cache manager; we do
@@ -562,7 +562,6 @@ agent_key_from_file (ctrl_t ctrl, const char *cache_nonce,
unsigned char *buf;
size_t len, buflen, erroff;
gcry_sexp_t s_skey;
- int got_shadow_info = 0;
*result = NULL;
if (shadow_info)
@@ -638,7 +637,6 @@ agent_key_from_file (ctrl_t ctrl, const char *cache_nonce,
{
memcpy (*shadow_info, s, n);
rc = 0;
- got_shadow_info = 1;
}
}
if (rc)
@@ -654,7 +652,7 @@ agent_key_from_file (ctrl_t ctrl, const char *cache_nonce,
}
gcry_sexp_release (s_skey);
s_skey = NULL;
- if (rc || got_shadow_info)
+ if (rc)
{
xfree (buf);
if (r_passphrase)