summaryrefslogtreecommitdiffstats
path: root/agent
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2016-01-05 02:15:49 +0100
committerNIIBE Yutaka <gniibe@fsij.org>2016-01-05 02:15:49 +0100
commitff3b607fc879b70665c187500022cc63e2a0cd86 (patch)
tree1b2331ad83a826babb08f24ac50f004cc39dc2c1 /agent
parentgpg: Fix double free. (diff)
downloadgnupg2-ff3b607fc879b70665c187500022cc63e2a0cd86.tar.xz
gnupg2-ff3b607fc879b70665c187500022cc63e2a0cd86.zip
agent: Fix RSA verification for card.
* agent/pksign.c (agent_pksign_do): Use S-exp of public key, instead of shadowed key. -- Reported-by: Justus Winter Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to 'agent')
-rw-r--r--agent/pksign.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/agent/pksign.c b/agent/pksign.c
index 7b498d464..9011be2e9 100644
--- a/agent/pksign.c
+++ b/agent/pksign.c
@@ -492,21 +492,20 @@ agent_pksign_do (ctrl_t ctrl, const char *cache_nonce,
* for RSA internally there is no need to do it here again. */
if (check_signature)
{
+ gcry_sexp_t sexp_key = s_pkey? s_pkey: s_skey;
+
if (s_hash == NULL)
{
if (ctrl->digest.algo == MD_USER_TLS_MD5SHA1)
rc = do_encode_raw_pkcs1 (data, datalen,
- gcry_pk_get_nbits (s_skey),
- &s_hash);
+ gcry_pk_get_nbits (sexp_key), &s_hash);
else
- rc = do_encode_md (data, datalen,
- ctrl->digest.algo,
- &s_hash,
+ rc = do_encode_md (data, datalen, ctrl->digest.algo, &s_hash,
ctrl->digest.raw_value);
}
if (! rc)
- rc = gcry_pk_verify (s_sig, s_hash, s_pkey? s_pkey: s_skey);
+ rc = gcry_pk_verify (s_sig, s_hash, sexp_key);
if (rc)
{