* scdaemon.c, scdaemon.h: New option --disable-opensc.

* card.c (card_open): Implement it.
* apdu.c (open_osc_reader, osc_send_apdu): New.
(apdu_open_reader) [HAVE_OPENSC]: Use the opensc driver if not
disabled.
(error_string) [HAVE_OPENSC]: Use sc_strerror.
(send_apdu) [HAVE_OPENSC]: Call osc_apdu_send.

* card-p15.c (p15_enum_keypairs, p15_prepare_key): Adjusted for
libgpg-error.
This commit is contained in:
Werner Koch 2003-08-18 17:34:51 +00:00
parent 0506e4ebec
commit 4eb5165019
2 changed files with 7 additions and 4 deletions

View File

@ -136,7 +136,7 @@ p15_enum_keypairs (CARD card, int idx,
log_info ("certificate for private key %d not found: %s\n",
idx, sc_strerror (rc));
/* note, that we return the ID anyway */
rc = gpg_error (GPG_ERR_MISSING_CERTIFICATE);
rc = gpg_error (GPG_ERR_MISSING_CERT);
goto return_keyid;
}
certinfo = tmpobj->data;
@ -339,7 +339,7 @@ p15_prepare_key (CARD card, const char *keyidstr,
if (rc < 0)
{
log_error ("private key not found: %s\n", sc_strerror(rc));
return gpg_error (GPG_ERR_NO_SECRET_KEY);
return gpg_error (GPG_ERR_NO_SECKEY);
}
rc = sc_pkcs15_find_pin_by_auth_id (card->p15card,
@ -357,7 +357,7 @@ p15_prepare_key (CARD card, const char *keyidstr,
rc = pincb (pincb_arg, pinobj->label, &pinvalue);
if (rc)
{
log_info ("PIN callback returned error: %s\n", gnupg_strerror (rc));
log_info ("PIN callback returned error: %s\n", gpg_strerror (rc));
return rc;
}

View File

@ -88,7 +88,7 @@ card_help_get_keygrip (KsbaCert cert, unsigned char *array)
/* Create a new context for the card and figures out some basic
information of the card. Detects whgether a PKCS_15 application is
information of the card. Detects whether a PKCS_15 application is
stored.
Common errors: GPG_ERR_CARD_NOT_PRESENT */
@ -99,6 +99,9 @@ card_open (CARD *rcard)
CARD card;
int rc;
if (opt.disable_opensc)
return gpg_error (GPG_ERR_NOT_SUPPORTED);
card = xtrycalloc (1, sizeof *card);
if (!card)
return out_of_core ();