aboutsummaryrefslogtreecommitdiffstats
path: root/agent/divert-scd.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2019-05-16 01:09:41 +0000
committerNIIBE Yutaka <[email protected]>2019-05-16 01:09:41 +0000
commitdc35b25195e564affdea7969a7c4ea4e200ab45f (patch)
treee4fe0ea00ad5bd5f7025a5de366236371d20c4fe /agent/divert-scd.c
parentagent: Support scdaemon operation using KEYGRIP. (diff)
downloadgnupg-dc35b25195e564affdea7969a7c4ea4e200ab45f.tar.gz
gnupg-dc35b25195e564affdea7969a7c4ea4e200ab45f.zip
agent,scd: Scan and load all public keys for availability.
* agent/divert-scd.c (ask_for_card): Scan by SERIALNO command. * scd/app-openpgp.c (do_with_keygrip): Make sure to load pubkey. Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'agent/divert-scd.c')
-rw-r--r--agent/divert-scd.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/agent/divert-scd.c b/agent/divert-scd.c
index a6ffba75f..cfa2347c7 100644
--- a/agent/divert-scd.c
+++ b/agent/divert-scd.c
@@ -48,15 +48,22 @@ ask_for_card (ctrl_t ctrl, const unsigned char *shadow_info,
*r_kid = NULL;
- bin2hex (grip, 20, hexgrip);
- err = agent_card_keyinfo (ctrl, hexgrip, &keyinfo);
+ /* Scan device(s), and check if key for GRIP is available. */
+ err = agent_card_serialno (ctrl, &serialno, NULL);
if (!err)
{
- agent_card_free_keyinfo (keyinfo);
- if ((*r_kid = xtrystrdup (hexgrip)))
- return 0;
- else
- return gpg_error_from_syserror ();
+ xfree (serialno);
+ bin2hex (grip, 20, hexgrip);
+ err = agent_card_keyinfo (ctrl, hexgrip, &keyinfo);
+ if (!err)
+ {
+ /* Key for GRIP found, use it directly. */
+ agent_card_free_keyinfo (keyinfo);
+ if ((*r_kid = xtrystrdup (hexgrip)))
+ return 0;
+ else
+ return gpg_error_from_syserror ();
+ }
}
err = parse_shadow_info (shadow_info, &want_sn, &want_kid, NULL);