2003-08-05 17:11:04 +00:00
|
|
|
/* apdu.h - ISO 7816 APDU functions and low level I/O
|
2008-09-23 09:57:45 +00:00
|
|
|
* Copyright (C) 2003, 2008 Free Software Foundation, Inc.
|
2003-08-05 17:11:04 +00:00
|
|
|
*
|
|
|
|
* This file is part of GnuPG.
|
|
|
|
*
|
|
|
|
* GnuPG is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2007-07-04 19:49:40 +00:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2003-08-05 17:11:04 +00:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* GnuPG is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2016-11-05 12:02:19 +01:00
|
|
|
* along with this program; if not, see <https://www.gnu.org/licenses/>.
|
2004-10-14 09:12:36 +00:00
|
|
|
*
|
|
|
|
* $Id$
|
2003-08-05 17:11:04 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef APDU_H
|
|
|
|
#define APDU_H
|
|
|
|
|
|
|
|
/* ISO 7816 values for the statusword are defined here because they
|
|
|
|
should not be visible to the users of the actual ISO command
|
|
|
|
API. */
|
|
|
|
enum {
|
|
|
|
SW_MORE_DATA = 0x6100, /* Note: that the low byte must be
|
|
|
|
masked of.*/
|
2004-01-27 16:40:42 +00:00
|
|
|
SW_EOF_REACHED = 0x6282,
|
2008-09-23 09:57:45 +00:00
|
|
|
SW_TERM_STATE = 0x6285, /* Selected file is in termination state. */
|
2003-08-05 17:11:04 +00:00
|
|
|
SW_EEPROM_FAILURE = 0x6581,
|
2019-02-21 15:16:11 +09:00
|
|
|
SW_ACK_TIMEOUT = 0x6600, /* OpenPGPcard: Ack timeout. */
|
2003-08-05 17:11:04 +00:00
|
|
|
SW_WRONG_LENGTH = 0x6700,
|
2008-09-23 09:57:45 +00:00
|
|
|
SW_SM_NOT_SUP = 0x6882, /* Secure Messaging is not supported. */
|
|
|
|
SW_CC_NOT_SUP = 0x6884, /* Command Chaining is not supported. */
|
2021-02-23 12:56:42 +01:00
|
|
|
SW_FILE_STRUCT = 0x6981, /* Command can't be used for file structure. */
|
2003-08-05 17:11:04 +00:00
|
|
|
SW_CHV_WRONG = 0x6982,
|
|
|
|
SW_CHV_BLOCKED = 0x6983,
|
2014-07-24 16:16:53 +02:00
|
|
|
SW_REF_DATA_INV = 0x6984, /* Referenced data invalidated. */
|
2003-08-05 17:11:04 +00:00
|
|
|
SW_USE_CONDITIONS = 0x6985,
|
2021-01-27 18:31:12 +01:00
|
|
|
SW_NO_CURRENT_EF = 0x6986, /* No current EF selected. */
|
2003-08-05 17:11:04 +00:00
|
|
|
SW_BAD_PARAMETER = 0x6a80, /* (in the data field) */
|
2004-01-27 16:40:42 +00:00
|
|
|
SW_NOT_SUPPORTED = 0x6a81,
|
|
|
|
SW_FILE_NOT_FOUND = 0x6a82,
|
|
|
|
SW_RECORD_NOT_FOUND = 0x6a83,
|
2011-12-14 18:48:47 +01:00
|
|
|
SW_NOT_ENOUGH_MEMORY= 0x6a84, /* Not enough memory space in the file. */
|
|
|
|
SW_INCONSISTENT_LC = 0x6a85, /* Lc inconsistent with TLV structure. */
|
|
|
|
SW_INCORRECT_P0_P1 = 0x6a86,
|
2009-03-30 12:46:06 +00:00
|
|
|
SW_BAD_LC = 0x6a87, /* Lc does not match command or p1/p2. */
|
2003-08-05 17:11:04 +00:00
|
|
|
SW_REF_NOT_FOUND = 0x6a88,
|
|
|
|
SW_BAD_P0_P1 = 0x6b00,
|
2005-09-05 14:36:36 +00:00
|
|
|
SW_EXACT_LENGTH = 0x6c00,
|
2003-08-05 17:11:04 +00:00
|
|
|
SW_INS_NOT_SUP = 0x6d00,
|
|
|
|
SW_CLA_NOT_SUP = 0x6e00,
|
|
|
|
SW_SUCCESS = 0x9000,
|
|
|
|
|
2014-12-15 17:38:40 +01:00
|
|
|
/* The following statuswords are no real ones but used to map host
|
2003-08-05 17:11:04 +00:00
|
|
|
OS errors into status words. A status word is 16 bit so that
|
|
|
|
those values can't be issued by a card. */
|
|
|
|
SW_HOST_OUT_OF_CORE = 0x10001, /* No way yet to differentiate
|
|
|
|
between errnos on a failed malloc. */
|
2004-04-20 14:17:10 +00:00
|
|
|
SW_HOST_INV_VALUE = 0x10002,
|
2003-08-05 17:11:04 +00:00
|
|
|
SW_HOST_INCOMPLETE_CARD_RESPONSE = 0x10003,
|
2004-04-20 14:17:10 +00:00
|
|
|
SW_HOST_NO_DRIVER = 0x10004,
|
|
|
|
SW_HOST_NOT_SUPPORTED = 0x10005,
|
|
|
|
SW_HOST_LOCKING_FAILED= 0x10006,
|
2004-07-16 15:45:25 +00:00
|
|
|
SW_HOST_BUSY = 0x10007,
|
|
|
|
SW_HOST_NO_CARD = 0x10008,
|
|
|
|
SW_HOST_CARD_INACTIVE = 0x10009,
|
|
|
|
SW_HOST_CARD_IO_ERROR = 0x1000a,
|
|
|
|
SW_HOST_GENERAL_ERROR = 0x1000b,
|
2004-08-05 09:24:36 +00:00
|
|
|
SW_HOST_NO_READER = 0x1000c,
|
2005-11-28 11:52:25 +00:00
|
|
|
SW_HOST_ABORTED = 0x1000d,
|
scd: Rename 'keypad' to 'pinpad'.
* NEWS: Mention scd changes.
* agent/divert-scd.c (getpin_cb): Change message.
* agent/call-scd.c (inq_needpin): Change the protocol to
POPUPPINPADPROMPT and DISMISSPINPADPROMPT.
* scd/command.c (pin_cb): Likewise.
* scd/apdu.c (struct reader_table_s): Rename member functions.
(check_pcsc_pinpad, pcsc_pinpad_verify, pcsc_pinpad_modify,
check_ccid_pinpad, ccid_pinpad_operation, apdu_check_pinpad
apdu_pinpad_verify, apdu_pinpad_modify): Rename.
* scd/apdu.h (SW_HOST_NO_PINPAD, apdu_check_pinpad)
(apdu_pinpad_verify, apdu_pinpad_modify): Rename.
* scd/iso7816.h (iso7816_check_pinpad): Rename.
* scd/iso7816.c (map_sw): Use SW_HOST_NO_PINPAD.
(iso7816_check_pinpad): Rename.
(iso7816_verify_kp, iso7816_change_reference_data_kp): Follow
the change.
* scd/ccid-driver.h (CCID_DRIVER_ERR_NO_PINPAD): Rename.
* scd/ccid-driver.c (ccid_transceive_secure): Use it.
* scd/app-dinsig.c (verify_pin): Follow the change.
* scd/app-nks.c (verify_pin): Follow the change.
* scd/app-openpgp.c (check_pinpad_request): Rename.
(parse_login_data, verify_a_chv, verify_chv3, do_change_pin): Follow
the change.
* scd/scdaemon.c (oDisablePinpad, oEnablePinpadVarlen): Rename.
* scd/scdaemon.h (opt): Rename to disable_pinpad,
enable_pinpad_varlen.
* tools/gpgconf-comp.c (gc_options_scdaemon): Rename to
disable-pinpad.
2013-02-07 10:07:51 +09:00
|
|
|
SW_HOST_NO_PINPAD = 0x1000e,
|
2017-09-20 10:06:43 +09:00
|
|
|
SW_HOST_ALREADY_CONNECTED = 0x1000f,
|
2020-08-12 16:06:49 +02:00
|
|
|
SW_HOST_CANCELLED = 0x10010,
|
|
|
|
SW_HOST_DEVICE_ACCESS = 0x10011,
|
|
|
|
SW_HOST_USB_OTHER = 0x10020,
|
|
|
|
SW_HOST_USB_IO = 0x10021,
|
|
|
|
SW_HOST_USB_ACCESS = 0x10023,
|
|
|
|
SW_HOST_USB_NO_DEVICE = 0x10024,
|
|
|
|
SW_HOST_USB_BUSY = 0x10026,
|
|
|
|
SW_HOST_USB_TIMEOUT = 0x10027,
|
2020-11-27 15:17:56 +09:00
|
|
|
SW_HOST_USB_OVERFLOW = 0x10028,
|
|
|
|
SW_HOST_UI_CANCELLED = 0x10030,
|
|
|
|
SW_HOST_UI_TIMEOUT = 0x10031
|
2003-08-05 17:11:04 +00:00
|
|
|
};
|
|
|
|
|
scd: Support multiple readers by CCID driver.
* scd/apdu.c (new_reader_slot): Lock is now in apdu_dev_list_start.
(close_pcsc_reader_direct, close_ccid_reader): RDRNAME is handled...
(apdu_close_reader): ... by this function now.
(apdu_prepare_exit): Likewise.
(open_ccid_reader): Open with dev_list.
(apdu_dev_list_start, apdu_dev_list_finish): New.
(apdu_open_one_reader): New.
(apdu_open_reader): Support multiple readers.
* scd/app.c (select_application): With SCAN, opening all readers
available, and register as new APP.
(app_write_learn_status): app->ref_count == 0 is valid for APP which is
not yet used.
(app_list_start, app_list_finish): New.
* scd/ccid-driver.c (struct ccid_driver_s): Remove RID and BCD_DEVICE.
Add BAI.
(parse_ccid_descriptor): BCD_DEVICE is now on the arguments.
(ccid_dev_scan, ccid_dev_scan_finish): New.
(ccid_get_BAI, ccid_compare_BAI, ccid_open_usb_reader): New.
(ccid_open_reader): Support multiple readers.
(ccid_set_progress_cb, ccid_close_reader): No RID any more.
--
With this change, multiple readers/tokens are supported by the internal
CCID driver of GnuPG. Until the changes of upper layers (scdaemon,
gpg-agent, and gpg front end), only a single reader is used, though.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2017-01-06 09:14:13 +09:00
|
|
|
struct dev_list;
|
2003-08-05 17:11:04 +00:00
|
|
|
|
2005-09-05 14:36:36 +00:00
|
|
|
#define SW_EXACT_LENGTH_P(a) (((a)&~0xff) == SW_EXACT_LENGTH)
|
|
|
|
|
2003-08-05 17:11:04 +00:00
|
|
|
|
2008-10-14 18:18:21 +00:00
|
|
|
/* Bit flags for the card status. */
|
|
|
|
#define APDU_CARD_USABLE (1) /* Card is present and ready for use. */
|
|
|
|
#define APDU_CARD_PRESENT (2) /* Card is just present. */
|
|
|
|
#define APDU_CARD_ACTIVE (4) /* Card is active. */
|
|
|
|
|
|
|
|
|
2016-12-29 10:07:43 +09:00
|
|
|
gpg_error_t apdu_init (void);
|
|
|
|
|
scd: Support multiple readers by CCID driver.
* scd/apdu.c (new_reader_slot): Lock is now in apdu_dev_list_start.
(close_pcsc_reader_direct, close_ccid_reader): RDRNAME is handled...
(apdu_close_reader): ... by this function now.
(apdu_prepare_exit): Likewise.
(open_ccid_reader): Open with dev_list.
(apdu_dev_list_start, apdu_dev_list_finish): New.
(apdu_open_one_reader): New.
(apdu_open_reader): Support multiple readers.
* scd/app.c (select_application): With SCAN, opening all readers
available, and register as new APP.
(app_write_learn_status): app->ref_count == 0 is valid for APP which is
not yet used.
(app_list_start, app_list_finish): New.
* scd/ccid-driver.c (struct ccid_driver_s): Remove RID and BCD_DEVICE.
Add BAI.
(parse_ccid_descriptor): BCD_DEVICE is now on the arguments.
(ccid_dev_scan, ccid_dev_scan_finish): New.
(ccid_get_BAI, ccid_compare_BAI, ccid_open_usb_reader): New.
(ccid_open_reader): Support multiple readers.
(ccid_set_progress_cb, ccid_close_reader): No RID any more.
--
With this change, multiple readers/tokens are supported by the internal
CCID driver of GnuPG. Until the changes of upper layers (scdaemon,
gpg-agent, and gpg front end), only a single reader is used, though.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2017-01-06 09:14:13 +09:00
|
|
|
gpg_error_t apdu_dev_list_start (const char *portstr, struct dev_list **l_p);
|
2017-01-27 18:01:52 +09:00
|
|
|
void apdu_dev_list_finish (struct dev_list *l);
|
scd: Support multiple readers by CCID driver.
* scd/apdu.c (new_reader_slot): Lock is now in apdu_dev_list_start.
(close_pcsc_reader_direct, close_ccid_reader): RDRNAME is handled...
(apdu_close_reader): ... by this function now.
(apdu_prepare_exit): Likewise.
(open_ccid_reader): Open with dev_list.
(apdu_dev_list_start, apdu_dev_list_finish): New.
(apdu_open_one_reader): New.
(apdu_open_reader): Support multiple readers.
* scd/app.c (select_application): With SCAN, opening all readers
available, and register as new APP.
(app_write_learn_status): app->ref_count == 0 is valid for APP which is
not yet used.
(app_list_start, app_list_finish): New.
* scd/ccid-driver.c (struct ccid_driver_s): Remove RID and BCD_DEVICE.
Add BAI.
(parse_ccid_descriptor): BCD_DEVICE is now on the arguments.
(ccid_dev_scan, ccid_dev_scan_finish): New.
(ccid_get_BAI, ccid_compare_BAI, ccid_open_usb_reader): New.
(ccid_open_reader): Support multiple readers.
(ccid_set_progress_cb, ccid_close_reader): No RID any more.
--
With this change, multiple readers/tokens are supported by the internal
CCID driver of GnuPG. Until the changes of upper layers (scdaemon,
gpg-agent, and gpg front end), only a single reader is used, though.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2017-01-06 09:14:13 +09:00
|
|
|
|
2010-05-03 11:10:49 +00:00
|
|
|
/* Note, that apdu_open_reader returns no status word but -1 on error. */
|
2019-09-12 08:48:48 +09:00
|
|
|
int apdu_open_reader (struct dev_list *l);
|
2004-07-16 15:45:25 +00:00
|
|
|
int apdu_open_remote_reader (const char *portstr,
|
|
|
|
const unsigned char *cookie, size_t length,
|
|
|
|
int (*readfnc) (void *opaque,
|
|
|
|
void *buffer, size_t size),
|
|
|
|
void *readfnc_value,
|
|
|
|
int (*writefnc) (void *opaque,
|
|
|
|
const void *buffer, size_t size),
|
|
|
|
void *writefnc_value,
|
|
|
|
void (*closefnc) (void *opaque),
|
|
|
|
void *closefnc_value);
|
2003-10-21 17:12:50 +00:00
|
|
|
int apdu_close_reader (int slot);
|
2009-07-16 15:54:59 +00:00
|
|
|
void apdu_prepare_exit (void);
|
2004-04-20 14:17:10 +00:00
|
|
|
int apdu_enum_reader (int slot, int *used);
|
2003-08-05 17:11:04 +00:00
|
|
|
unsigned char *apdu_get_atr (int slot, size_t *atrlen);
|
|
|
|
|
2004-07-16 15:45:25 +00:00
|
|
|
const char *apdu_strerror (int rc);
|
2003-08-05 17:11:04 +00:00
|
|
|
|
2004-07-16 15:45:25 +00:00
|
|
|
|
2008-10-14 18:18:21 +00:00
|
|
|
/* These APDU functions return status words. */
|
|
|
|
|
|
|
|
int apdu_connect (int slot);
|
|
|
|
int apdu_disconnect (int slot);
|
2004-07-16 15:45:25 +00:00
|
|
|
|
2009-07-13 09:59:50 +00:00
|
|
|
int apdu_set_progress_cb (int slot, gcry_handler_progress_t cb, void *cb_arg);
|
2018-10-11 15:41:49 +09:00
|
|
|
int apdu_set_prompt_cb (int slot, void (*cb) (void *, int), void *cb_arg);
|
2009-07-13 09:59:50 +00:00
|
|
|
|
2004-04-20 14:17:10 +00:00
|
|
|
int apdu_reset (int slot);
|
scd: Simplify monitoring card removal.
* scd/apdu.c (struct reader_table_s): Remove any_status, last_status,
status, and change_counter field.
(new_reader_slot, dump_reader_status, ct_activate_card, open_ct_reader)
(connect_pcsc_card, open_pcsc_reader_direct, open_pcsc_reader_wrapped)
(open_ccid_reader, apdu_reset): Follow the change.
(ct_dump_reader_status): Remove.
(apdu_get_status_internal, apdu_get_status): Remove CHANGED arg.
(apdu_connect): Follow the change.
* scd/command.c (struct vreader_s): Remove reset_failed, any, and
changed field.
(cmd_getinfo, update_reader_status_file): Follow the change.
--
In the past, scdaemon monitors card insertion (as well as removal), so
the code has been complicated, and there has been duplication in two
layers. Now, it only monitors card removal, it's now simplified.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2016-12-28 11:14:29 +09:00
|
|
|
int apdu_get_status (int slot, int hang, unsigned int *status);
|
scd: Rename 'keypad' to 'pinpad'.
* NEWS: Mention scd changes.
* agent/divert-scd.c (getpin_cb): Change message.
* agent/call-scd.c (inq_needpin): Change the protocol to
POPUPPINPADPROMPT and DISMISSPINPADPROMPT.
* scd/command.c (pin_cb): Likewise.
* scd/apdu.c (struct reader_table_s): Rename member functions.
(check_pcsc_pinpad, pcsc_pinpad_verify, pcsc_pinpad_modify,
check_ccid_pinpad, ccid_pinpad_operation, apdu_check_pinpad
apdu_pinpad_verify, apdu_pinpad_modify): Rename.
* scd/apdu.h (SW_HOST_NO_PINPAD, apdu_check_pinpad)
(apdu_pinpad_verify, apdu_pinpad_modify): Rename.
* scd/iso7816.h (iso7816_check_pinpad): Rename.
* scd/iso7816.c (map_sw): Use SW_HOST_NO_PINPAD.
(iso7816_check_pinpad): Rename.
(iso7816_verify_kp, iso7816_change_reference_data_kp): Follow
the change.
* scd/ccid-driver.h (CCID_DRIVER_ERR_NO_PINPAD): Rename.
* scd/ccid-driver.c (ccid_transceive_secure): Use it.
* scd/app-dinsig.c (verify_pin): Follow the change.
* scd/app-nks.c (verify_pin): Follow the change.
* scd/app-openpgp.c (check_pinpad_request): Rename.
(parse_login_data, verify_a_chv, verify_chv3, do_change_pin): Follow
the change.
* scd/scdaemon.c (oDisablePinpad, oEnablePinpadVarlen): Rename.
* scd/scdaemon.h (opt): Rename to disable_pinpad,
enable_pinpad_varlen.
* tools/gpgconf-comp.c (gc_options_scdaemon): Rename to
disable-pinpad.
2013-02-07 10:07:51 +09:00
|
|
|
int apdu_check_pinpad (int slot, int command, pininfo_t *pininfo);
|
|
|
|
int apdu_pinpad_verify (int slot, int class, int ins, int p0, int p1,
|
scd: Support multiple readers by CCID driver.
* scd/apdu.c (new_reader_slot): Lock is now in apdu_dev_list_start.
(close_pcsc_reader_direct, close_ccid_reader): RDRNAME is handled...
(apdu_close_reader): ... by this function now.
(apdu_prepare_exit): Likewise.
(open_ccid_reader): Open with dev_list.
(apdu_dev_list_start, apdu_dev_list_finish): New.
(apdu_open_one_reader): New.
(apdu_open_reader): Support multiple readers.
* scd/app.c (select_application): With SCAN, opening all readers
available, and register as new APP.
(app_write_learn_status): app->ref_count == 0 is valid for APP which is
not yet used.
(app_list_start, app_list_finish): New.
* scd/ccid-driver.c (struct ccid_driver_s): Remove RID and BCD_DEVICE.
Add BAI.
(parse_ccid_descriptor): BCD_DEVICE is now on the arguments.
(ccid_dev_scan, ccid_dev_scan_finish): New.
(ccid_get_BAI, ccid_compare_BAI, ccid_open_usb_reader): New.
(ccid_open_reader): Support multiple readers.
(ccid_set_progress_cb, ccid_close_reader): No RID any more.
--
With this change, multiple readers/tokens are supported by the internal
CCID driver of GnuPG. Until the changes of upper layers (scdaemon,
gpg-agent, and gpg front end), only a single reader is used, though.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2017-01-06 09:14:13 +09:00
|
|
|
pininfo_t *pininfo);
|
scd: Rename 'keypad' to 'pinpad'.
* NEWS: Mention scd changes.
* agent/divert-scd.c (getpin_cb): Change message.
* agent/call-scd.c (inq_needpin): Change the protocol to
POPUPPINPADPROMPT and DISMISSPINPADPROMPT.
* scd/command.c (pin_cb): Likewise.
* scd/apdu.c (struct reader_table_s): Rename member functions.
(check_pcsc_pinpad, pcsc_pinpad_verify, pcsc_pinpad_modify,
check_ccid_pinpad, ccid_pinpad_operation, apdu_check_pinpad
apdu_pinpad_verify, apdu_pinpad_modify): Rename.
* scd/apdu.h (SW_HOST_NO_PINPAD, apdu_check_pinpad)
(apdu_pinpad_verify, apdu_pinpad_modify): Rename.
* scd/iso7816.h (iso7816_check_pinpad): Rename.
* scd/iso7816.c (map_sw): Use SW_HOST_NO_PINPAD.
(iso7816_check_pinpad): Rename.
(iso7816_verify_kp, iso7816_change_reference_data_kp): Follow
the change.
* scd/ccid-driver.h (CCID_DRIVER_ERR_NO_PINPAD): Rename.
* scd/ccid-driver.c (ccid_transceive_secure): Use it.
* scd/app-dinsig.c (verify_pin): Follow the change.
* scd/app-nks.c (verify_pin): Follow the change.
* scd/app-openpgp.c (check_pinpad_request): Rename.
(parse_login_data, verify_a_chv, verify_chv3, do_change_pin): Follow
the change.
* scd/scdaemon.c (oDisablePinpad, oEnablePinpadVarlen): Rename.
* scd/scdaemon.h (opt): Rename to disable_pinpad,
enable_pinpad_varlen.
* tools/gpgconf-comp.c (gc_options_scdaemon): Rename to
disable-pinpad.
2013-02-07 10:07:51 +09:00
|
|
|
int apdu_pinpad_modify (int slot, int class, int ins, int p0, int p1,
|
scd: Support multiple readers by CCID driver.
* scd/apdu.c (new_reader_slot): Lock is now in apdu_dev_list_start.
(close_pcsc_reader_direct, close_ccid_reader): RDRNAME is handled...
(apdu_close_reader): ... by this function now.
(apdu_prepare_exit): Likewise.
(open_ccid_reader): Open with dev_list.
(apdu_dev_list_start, apdu_dev_list_finish): New.
(apdu_open_one_reader): New.
(apdu_open_reader): Support multiple readers.
* scd/app.c (select_application): With SCAN, opening all readers
available, and register as new APP.
(app_write_learn_status): app->ref_count == 0 is valid for APP which is
not yet used.
(app_list_start, app_list_finish): New.
* scd/ccid-driver.c (struct ccid_driver_s): Remove RID and BCD_DEVICE.
Add BAI.
(parse_ccid_descriptor): BCD_DEVICE is now on the arguments.
(ccid_dev_scan, ccid_dev_scan_finish): New.
(ccid_get_BAI, ccid_compare_BAI, ccid_open_usb_reader): New.
(ccid_open_reader): Support multiple readers.
(ccid_set_progress_cb, ccid_close_reader): No RID any more.
--
With this change, multiple readers/tokens are supported by the internal
CCID driver of GnuPG. Until the changes of upper layers (scdaemon,
gpg-agent, and gpg front end), only a single reader is used, though.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2017-01-06 09:14:13 +09:00
|
|
|
pininfo_t *pininfo);
|
2008-09-23 09:57:45 +00:00
|
|
|
int apdu_send_simple (int slot, int extended_mode,
|
|
|
|
int class, int ins, int p0, int p1,
|
2003-08-05 17:11:04 +00:00
|
|
|
int lc, const char *data);
|
2011-02-04 12:57:53 +01:00
|
|
|
int apdu_send (int slot, int extended_mode,
|
2009-03-30 12:46:06 +00:00
|
|
|
int class, int ins, int p0, int p1, int lc, const char *data,
|
2003-08-05 17:11:04 +00:00
|
|
|
unsigned char **retbuf, size_t *retbuflen);
|
2011-02-04 12:57:53 +01:00
|
|
|
int apdu_send_le (int slot, int extended_mode,
|
2009-03-30 12:46:06 +00:00
|
|
|
int class, int ins, int p0, int p1,
|
2003-08-05 17:11:04 +00:00
|
|
|
int lc, const char *data, int le,
|
|
|
|
unsigned char **retbuf, size_t *retbuflen);
|
2009-05-13 17:12:00 +00:00
|
|
|
int apdu_send_direct (int slot, size_t extended_length,
|
2004-07-16 15:45:25 +00:00
|
|
|
const unsigned char *apdudata, size_t apdudatalen,
|
2019-01-20 11:41:23 +01:00
|
|
|
int handle_more, unsigned int *r_sw,
|
2004-07-16 15:45:25 +00:00
|
|
|
unsigned char **retbuf, size_t *retbuflen);
|
2015-11-09 16:15:44 +09:00
|
|
|
const char *apdu_get_reader_name (int slot);
|
2003-08-05 17:11:04 +00:00
|
|
|
|
|
|
|
#endif /*APDU_H*/
|