diff --git a/g10/call-agent.c b/g10/call-agent.c index 7d627bb36..160679749 100644 --- a/g10/call-agent.c +++ b/g10/call-agent.c @@ -1027,98 +1027,6 @@ agent_scd_genkey (int keyno, int force, u32 *createtime) - -/* Issue an SCD SERIALNO openpgp command and if SERIALNO is not NULL - ask the user to insert the requested card. */ -gpg_error_t -select_openpgp (const char *serialno) -{ - gpg_error_t err; - - /* Send the serialno command to initialize the connection. Without - a given S/N 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 what we expect. - - Note that an opt.limit_card_insert_tries of 1 means: No tries at - all whereas 0 means do not limit the number of tries. Due to the - sue of a pinentry prompt with a cancel option we use it here in a - boolean sense. */ - if (!serialno || opt.limit_card_insert_tries == 1) - err = assuan_transact (agent_ctx, "SCD SERIALNO openpgp", - NULL, NULL, NULL, NULL, NULL, NULL); - else - { - char *this_sn = NULL; - char *desc; - int ask; - char *want_sn; - char *p; - - want_sn = xtrystrdup (serialno); - if (!want_sn) - return gpg_error_from_syserror (); - p = strchr (want_sn, '/'); - if (p) - *p = 0; - - do - { - ask = 0; - err = assuan_transact (agent_ctx, "SCD SERIALNO openpgp", - NULL, NULL, NULL, NULL, - get_serialno_cb, &this_sn); - if (gpg_err_code (err) == GPG_ERR_CARD_NOT_PRESENT) - ask = 1; - else if (gpg_err_code (err) == GPG_ERR_NOT_SUPPORTED) - ask = 2; - else if (err) - ; - else if (this_sn) - { - if (strcmp (want_sn, this_sn)) - ask = 2; - } - - xfree (this_sn); - this_sn = NULL; - - if (ask) - { - char *formatted = NULL; - char *ocodeset = i18n_switchto_utf8 (); - - if (!strncmp (want_sn, "D27600012401", 12) - && strlen (want_sn) == 32 ) - formatted = xtryasprintf ("(%.4s) %.8s", - want_sn + 16, want_sn + 20); - - err = 0; - desc = xtryasprintf - ("%s:\n\n" - " \"%s\"", - ask == 1 - ? _("Please insert the card with serial number") - : _("Please remove the current card and " - "insert the one with serial number"), - formatted? formatted : want_sn); - if (!desc) - err = gpg_error_from_syserror (); - xfree (formatted); - i18n_switchback (ocodeset); - if (!err) - err = gpg_agent_get_confirmation (desc); - xfree (desc); - } - } - while (ask && !err); - xfree (want_sn); - } - - return err; -} - - /* Send a READCERT command to the SCdaemon. */ int