aboutsummaryrefslogtreecommitdiffstats
path: root/g10/call-agent.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2009-02-27 14:36:59 +0000
committerWerner Koch <[email protected]>2009-02-27 14:36:59 +0000
commitec4a3eb3c5b45321125a9b1fb2b8cd5ee20c52de (patch)
tree4ee2b19d3f5b44349fe36a40f28d0835e51d9fd8 /g10/call-agent.c
parentFixed a nasty bug in scdaemon which led to a card reset if the card was (diff)
downloadgnupg-ec4a3eb3c5b45321125a9b1fb2b8cd5ee20c52de.tar.gz
gnupg-ec4a3eb3c5b45321125a9b1fb2b8cd5ee20c52de.zip
Fix a gpg2 problem with removed cards.
Allow runtime conf change for scdaemon. New commands for scdaemon.
Diffstat (limited to 'g10/call-agent.c')
-rw-r--r--g10/call-agent.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/g10/call-agent.c b/g10/call-agent.c
index 57d963dfd..572fa8513 100644
--- a/g10/call-agent.c
+++ b/g10/call-agent.c
@@ -698,6 +698,15 @@ agent_scd_pksign (const char *serialno, int hashalgo,
if (indatalen*2 + 50 > DIM(line))
return gpg_error (GPG_ERR_GENERAL);
+ /* Send the serialno command to initialize the connection. We don't
+ care about the data returned. If the card has already been
+ initialized, this is a very fast command. We request the openpgp
+ card because that is waht we expect. */
+ rc = assuan_transact (agent_ctx, "SCD SERIALNO openpgp",
+ NULL, NULL, NULL, NULL, NULL, NULL);
+ if (rc)
+ return rc;
+
sprintf (line, "SCD SETDATA ");
p = line + strlen (line);
for (i=0; i < indatalen ; i++, p += 2 )
@@ -754,6 +763,15 @@ agent_scd_pkdecrypt (const char *serialno,
if (indatalen*2 + 50 > DIM(line))
return gpg_error (GPG_ERR_GENERAL);
+ /* Send the serialno command to initialize the connection. We don't
+ care about the data returned. If the card has already been
+ initialized, this is a very fast command. We request the openpgp
+ card because that is waht we expect. */
+ rc = assuan_transact (agent_ctx, "SCD SERIALNO openpgp",
+ NULL, NULL, NULL, NULL, NULL, NULL);
+ if (rc)
+ return rc;
+
sprintf (line, "SCD SETDATA ");
p = line + strlen (line);
for (i=0; i < indatalen ; i++, p += 2 )