aboutsummaryrefslogtreecommitdiffstats
path: root/g10/call-agent.c
diff options
context:
space:
mode:
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 )