aboutsummaryrefslogtreecommitdiffstats
path: root/g10
diff options
context:
space:
mode:
Diffstat (limited to 'g10')
-rw-r--r--g10/ChangeLog5
-rw-r--r--g10/call-agent.c18
2 files changed, 23 insertions, 0 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog
index 91934e318..f081d82b5 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,8 @@
+2009-02-27 Werner Koch <[email protected]>
+
+ * call-agent.c (agent_scd_pksign, agent_scd_pkdecrypt): First send
+ the SERIALNO command.
+
2009-02-24 Werner Koch <[email protected]>
* pkglue.c (pk_verify): Return an error for improper DATA instead
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 )