#include <ccid.h>
#include <stdarg.h>
#include "ccid-internal.h"
#include <libusb.h>
#include <ccid-spec.h>
Go to the source code of this file.
Defines | |
#define | _SWAP(field, func) desc->field = func (desc->field) |
Functions | |
static size_t | x_rbuflen (struct _xfr *xfr) |
static size_t | x_tbuflen (struct _xfr *xfr) |
int | _cci_wait_for_interrupt (struct _cci *cci) |
unsigned int | _RDR_to_PC_DataBlock (struct _cci *cci, struct _xfr *xfr) |
unsigned int | _RDR_to_PC_SlotStatus (struct _cci *cci, struct _xfr *xfr) |
static int | _cmd_result (struct _cci *cci, const struct ccid_msg *msg) |
static int | do_recv (struct _cci *cci, struct _xfr *xfr) |
static void | _chipcard_set_status (struct _chipcard *cc, unsigned int status) |
int | _RDR_to_PC (struct _cci *cci, unsigned int slot, struct _xfr *xfr) |
static int | _PC_to_RDR (struct _cci *cci, unsigned int slot, struct _xfr *xfr) |
int | _PC_to_RDR_XfrBlock (struct _cci *cci, unsigned int slot, struct _xfr *xfr) |
int | _PC_to_RDR_GetSlotStatus (struct _cci *cci, unsigned int slot, struct _xfr *xfr) |
int | _PC_to_RDR_IccPowerOn (struct _cci *cci, unsigned int slot, struct _xfr *xfr, unsigned int voltage) |
int | _PC_to_RDR_IccPowerOff (struct _cci *cci, unsigned int slot, struct _xfr *xfr) |
static void | byteswap_desc (struct ccid_desc *desc) |
static unsigned int | bcd_hi (uint16_t word) |
static unsigned int | bcd_lo (uint16_t word) |
static int | get_endpoint (struct _cci *cci, const uint8_t *ptr, size_t len) |
static int | fill_ccid_desc (struct _cci *cci, const uint8_t *ptr, size_t len) |
static int | probe_descriptors (struct _cci *cci) |
cci_t | cci_probe (ccidev_t dev, const char *tracefile) |
Connect to a physical chipcard device. | |
void | cci_close (cci_t cci) |
Close connection to a chip card device. | |
unsigned int | cci_slots (cci_t cci) |
Retrieve the number of slots in the CCID. | |
chipcard_t | cci_get_slot (cci_t cci, unsigned int num) |
Retrieve a handle to a CCID slot. | |
void | cci_log (cci_t cci, const char *fmt,...) |
Print a message in the trace log. |
#define _SWAP | ( | field, | |||
func | ) | desc->field = func (desc->field) |
Referenced by byteswap_desc().
int _cci_wait_for_interrupt | ( | struct _cci * | cci | ) |
Definition at line 24 of file cci.c.
References _chipcard::cc_status, _cci::cci_dev, _cci::cci_intrp, _cci::cci_slot, _cci::cci_xfr, CHIPCARD_NOT_PRESENT, CHIPCARD_PRESENT, RDR_to_PC_HardwareError, RDR_to_PC_NotifySlotChange, trace, x_rbuflen(), and _xfr::x_rxhdr.
Referenced by chipcard_wait_for_card().
static void _chipcard_set_status | ( | struct _chipcard * | cc, | |
unsigned int | status | |||
) | [static] |
Definition at line 203 of file cci.c.
References _chipcard::cc_parent, _chipcard::cc_status, CCID_SLOT_STATUS_MASK, CCID_STATUS_ICC_ACTIVE, CCID_STATUS_ICC_NOT_PRESENT, CCID_STATUS_ICC_PRESENT, CHIPCARD_ACTIVE, CHIPCARD_NOT_PRESENT, CHIPCARD_PRESENT, and trace.
Referenced by _RDR_to_PC().
Definition at line 101 of file cci.c.
References CCID_ERR_ABORT, CCID_ERR_AUTO_SEQ, CCID_ERR_BAD_TCK, CCID_ERR_BAD_TS, CCID_ERR_BUSY, CCID_ERR_CLASS, CCID_ERR_DEACTIVATED, CCID_ERR_HARDWARE, CCID_ERR_MUTE, CCID_ERR_OVERRUN, CCID_ERR_PARITY, CCID_ERR_PIN_TIMEOUT, CCID_ERR_PROCEDURE, CCID_ERR_PROTOCOL, CCID_ERR_USR_MAX, CCID_ERR_USR_MIN, CCID_RESULT_ERROR, CCID_RESULT_SUCCESS, CCID_RESULT_TIMEOUT, CCID_STATUS_RESULT_MASK, ccid_msg::in, and trace.
Referenced by _RDR_to_PC().
Definition at line 258 of file cci.c.
References ccid_msg::bSeq, ccid_msg::bSlot, _cci::cci_dev, _cci::cci_outp, _cci::cci_seq, ccid_msg::dwLength, sys_le32, x_tbuflen(), _xfr::x_txhdr, and _xfr::x_txlen.
Referenced by _PC_to_RDR_GetSlotStatus(), _PC_to_RDR_IccPowerOff(), _PC_to_RDR_IccPowerOn(), and _PC_to_RDR_XfrBlock().
Definition at line 301 of file cci.c.
References _PC_to_RDR(), ccid_msg::bMessageType, PC_to_RDR_GetSlotStatus, trace, and _xfr::x_txhdr.
Referenced by cci_probe(), chipcard_slot_status(), and chipcard_wait_for_card().
Definition at line 348 of file cci.c.
References _PC_to_RDR(), ccid_msg::bMessageType, PC_to_RDR_IccPowerOff, trace, and _xfr::x_txhdr.
Referenced by chipcard_slot_off().
int _PC_to_RDR_IccPowerOn | ( | struct _cci * | cci, | |
unsigned int | slot, | |||
struct _xfr * | xfr, | |||
unsigned int | voltage | |||
) |
Definition at line 315 of file cci.c.
References _PC_to_RDR(), ccid_msg::bMessageType, CHIPCARD_1_8V, CHIPCARD_3V, CHIPCARD_5V, CHIPCARD_AUTO_VOLTAGE, ccid_msg::out, PC_to_RDR_IccPowerOn, trace, and _xfr::x_txhdr.
Referenced by chipcard_slot_on().
Definition at line 287 of file cci.c.
References _hex_dumpf(), _PC_to_RDR(), ccid_msg::bMessageType, _cci::cci_tf, PC_to_RDR_XfrBlock, trace, _xfr::x_txbuf, _xfr::x_txhdr, and _xfr::x_txlen.
Referenced by chipcard_transact().
Definition at line 224 of file cci.c.
References _chipcard_set_status(), _cmd_result(), ccid_msg::bSeq, ccid_msg::bSlot, _cci::cci_seq, _cci::cci_slot, CCID_RESULT_TIMEOUT, do_recv(), ccid_msg::in, trace, _xfr::x_rxhdr, and _xfr::x_rxlen.
Referenced by cci_probe(), chipcard_slot_off(), chipcard_slot_on(), chipcard_slot_status(), chipcard_transact(), and chipcard_wait_for_card().
Definition at line 69 of file cci.c.
References _hex_dumpf(), ccid_msg::bMessageType, _cci::cci_tf, ccid_msg::in, RDR_to_PC_DataBlock, trace, _xfr::x_rxbuf, _xfr::x_rxhdr, and _xfr::x_rxlen.
Referenced by chipcard_slot_on(), and chipcard_transact().
Definition at line 78 of file cci.c.
References ccid_msg::bMessageType, CHIPCARD_CLOCK_ERR, CHIPCARD_CLOCK_START, CHIPCARD_CLOCK_STOP, CHIPCARD_CLOCK_STOP_H, CHIPCARD_CLOCK_STOP_L, ccid_msg::in, RDR_to_PC_SlotStatus, trace, and _xfr::x_rxhdr.
Referenced by cci_probe(), chipcard_slot_off(), and chipcard_slot_status().
static unsigned int bcd_hi | ( | uint16_t | word | ) | [static] |
Definition at line 381 of file cci.c.
Referenced by fill_ccid_desc().
static unsigned int bcd_lo | ( | uint16_t | word | ) | [static] |
Definition at line 386 of file cci.c.
Referenced by fill_ccid_desc().
static void byteswap_desc | ( | struct ccid_desc * | desc | ) | [static] |
Definition at line 174 of file cci.c.
References _cci::cci_dev, _cci::cci_inp, ccid_msg::dwLength, sys_le32, x_rbuflen(), _xfr::x_rxhdr, and _xfr::x_rxlen.
Referenced by _RDR_to_PC().
static int fill_ccid_desc | ( | struct _cci * | cci, | |
const uint8_t * | ptr, | |||
size_t | len | |||
) | [static] |
Definition at line 432 of file cci.c.
References _hex_dumpf(), bcd_hi(), bcd_lo(), ccid_desc::bcdCCID, ccid_desc::bClassEnvelope, ccid_desc::bClassGetResponse, ccid_desc::bDescriptorType, ccid_desc::bMaxCCIDBusySlots, ccid_desc::bMaxSlotIndex, ccid_desc::bPINSupport, ccid_desc::bVoltageSupport, byteswap_desc(), _cci::cci_desc, _cci::cci_max_slots, _cci::cci_num_slots, _cci::cci_tf, CCID_1_8V, CCID_3V, CCID_5V, CCID_ACTIVATE, CCID_ATR_CONFIG, CCID_BAUD, CCID_CLOCK_STOP, CCID_FREQ, CCID_IFSD, CCID_NAD, CCID_PIN_MOD, CCID_PIN_VER, CCID_PPS, CCID_PPS_VENDOR, CCID_T0, CCID_T1, CCID_T1_APDU, CCID_T1_APDU_EXT, CCID_T1_TPDU, CCID_VOLTAGE, ccid_desc::dwDataRate, ccid_desc::dwDefaultClock, ccid_desc::dwFeatures, ccid_desc::dwMaxCCIDMessageLength, ccid_desc::dwMaxDataRate, ccid_desc::dwMaxIFSD, ccid_desc::dwMaximumClock, ccid_desc::dwProtocols, trace, and ccid_desc::wLcdLayout.
Referenced by probe_descriptors().
static int get_endpoint | ( | struct _cci * | cci, | |
const uint8_t * | ptr, | |||
size_t | len | |||
) | [static] |
Definition at line 392 of file cci.c.
References _cci::cci_inp, _cci::cci_intrp, _cci::cci_max_in, _cci::cci_max_intr, _cci::cci_max_out, _cci::cci_outp, sys_le16, and trace.
Referenced by probe_descriptors().
static int probe_descriptors | ( | struct _cci * | cci | ) | [static] |
Definition at line 560 of file cci.c.
References _cci::cci_dev, CCID_DT, fill_ccid_desc(), get_endpoint(), and trace.
Referenced by cci_probe().
static size_t x_rbuflen | ( | struct _xfr * | xfr | ) | [static] |
Definition at line 15 of file cci.c.
References _xfr::x_rxmax.
Referenced by _cci_wait_for_interrupt(), and do_recv().
static size_t x_tbuflen | ( | struct _xfr * | xfr | ) | [static] |
Definition at line 19 of file cci.c.
References _xfr::x_txlen.
Referenced by _PC_to_RDR().