diff options
author | Werner Koch <[email protected]> | 2003-10-10 15:12:02 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2003-10-10 15:12:02 +0000 |
commit | 5a0fbad9b3f44440d63c5b17a4e4197f4561f1e4 (patch) | |
tree | 457d9d2379faa0f264b9a62d9a10f22211e43fad /g10/apdu.c | |
parent | Add news about OpenPGP card support. (diff) | |
download | gnupg-5a0fbad9b3f44440d63c5b17a4e4197f4561f1e4.tar.gz gnupg-5a0fbad9b3f44440d63c5b17a4e4197f4561f1e4.zip |
* cardglue.c (card_close): New.
* ccid-driver.c (ccid_close_reader): New.
* apdu.c (close_ccid_reader, close_ct_reader, close_csc_reader)
(close_osc_reader, apdu_close_reader): New. Not all are properly
implemented yet.
* g10.c (g10_exit): Use close_card.
Diffstat (limited to 'g10/apdu.c')
-rw-r--r-- | g10/apdu.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/g10/apdu.c b/g10/apdu.c index d5b93de6e..1587bfe5b 100644 --- a/g10/apdu.c +++ b/g10/apdu.c @@ -347,6 +347,14 @@ open_ct_reader (int port) return reader; } +static int +close_ct_reader (int slot) +{ + /* FIXME: Implement. */ + reader_table[slot].used = 0; + return 0; +} + /* Actually send the APDU of length APDULEN to SLOT and return a maximum of *BUFLEN data in BUFFER, the actual retruned size will be @@ -570,6 +578,17 @@ pcsc_send_apdu (int slot, unsigned char *apdu, size_t apdulen, return err? -1:0; /* FIXME: Return appropriate error code. */ } +static int +close_pcsc_reader (int slot) +{ + /* FIXME: Implement. */ + reader_table[slot].used = 0; + return 0; +} + + + + #ifdef HAVE_LIBUSB /* @@ -609,6 +628,15 @@ open_ccid_reader (void) return slot; } +static int +close_ccid_reader (int slot) +{ + ccid_close_reader (reader_table[slot].ccid.handle); + reader_table[slot].used = 0; + return 0; +} + + /* Actually send the APDU of length APDULEN to SLOT and return a maximum of *BUFLEN data in BUFFER, the actual returned size will be @@ -738,6 +766,16 @@ open_osc_reader (int portno) } +static int +close_osc_reader (int slot) +{ + /* FIXME: Implement. */ + reader_table[slot].used = 0; + return 0; +} + + + /* Actually send the APDU of length APDULEN to SLOT and return a maximum of *BUFLEN data in BUFFER, the actual returned size will be set to BUFLEN. Returns: OpenSC error code. */ @@ -940,6 +978,26 @@ apdu_open_reader (const char *portstr) } +int +apdu_close_reader (int slot) +{ + if (slot < 0 || slot >= MAX_READER || !reader_table[slot].used ) + return SW_HOST_NO_DRIVER; + if (reader_table[slot].is_ctapi) + return close_ct_reader (slot); +#ifdef HAVE_LIBUSB + else if (reader_table[slot].is_ccid) + return close_ccid_reader (slot); +#endif +#ifdef HAVE_OPENSC + else if (reader_table[slot].is_osc) + return close_osc_reader (slot); +#endif + else + return close_pcsc_reader (slot); +} + + unsigned char * apdu_get_atr (int slot, size_t *atrlen) { |