mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
* 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.
This commit is contained in:
parent
547b00c9ff
commit
5a0fbad9b3
8 changed files with 139 additions and 12 deletions
58
g10/apdu.c
58
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)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue