Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 351694 Details for
Bug 474406
app-crypt/ccid-1.4.11: pcsc_transmit failed: not transacted (0x80100016) error for Omnikey 3121 card reader
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for src/commands.c
ccid-1.4.11-omnikey3121.patch (text/plain), 4.35 KB, created by
Ulrich Müller
on 2013-06-22 22:40:09 UTC
(
hide
)
Description:
Patch for src/commands.c
Filename:
MIME Type:
Creator:
Ulrich Müller
Created:
2013-06-22 22:40:09 UTC
Size:
4.35 KB
patch
obsolete
>Support extended APDU for OmniKey 3021/3121 >Max Vozeler <max.vozeler@lsexperts.de> >http://permalink.gmane.org/gmane.comp.lib.muscle/7761 > >This adds support for a custom escape command that allows >OmniKey Cardman 3021/3121 (and likely other Omnikey readers) >to handle extended T=1 APDUs. > >Forward ported to ccid-1.4.11 ><ulm@gentoo.org> > >--- ccid-1.4.11-orig/src/commands.c >+++ ccid-1.4.11/src/commands.c >@@ -1151,8 +1151,13 @@ RESPONSECODE CmdXfrBlock(unsigned int re > break; > > case CCID_CLASS_SHORT_APDU: >- return_value = CmdXfrBlockTPDU_T0(reader_index, >- tx_length, tx_buffer, rx_length, rx_buffer); >+ if ((CARDMAN3121 == ccid_descriptor->readerID) && (protocol == T_1)) >+ return_value = CmdXfrBlockTPDU_T1(reader_index, tx_length, >+ tx_buffer, rx_length, rx_buffer); >+ else >+ return_value = CmdXfrBlockTPDU_T0(reader_index, >+ tx_length, tx_buffer, rx_length, rx_buffer); >+ > break; > > case CCID_CLASS_EXTENDED_APDU: >@@ -1188,7 +1193,8 @@ RESPONSECODE CmdXfrBlock(unsigned int re > RESPONSECODE CCID_Transmit(unsigned int reader_index, unsigned int tx_length, > const unsigned char tx_buffer[], unsigned short rx_length, unsigned char bBWI) > { >- unsigned char cmd[10+tx_length]; /* CCID + APDU buffer */ >+ unsigned char cmd[11+tx_length]; /* CCID + APDU buffer */ >+ size_t cmdlen; > _ccid_descriptor *ccid_descriptor = get_ccid_descriptor(reader_index); > status_t ret; > >@@ -1235,17 +1241,34 @@ RESPONSECODE CCID_Transmit(unsigned int > } > #endif > >- cmd[0] = 0x6F; /* XfrBlock */ >- i2dw(tx_length, cmd+1); /* APDU length */ >- cmd[5] = ccid_descriptor->bCurrentSlotIndex; /* slot number */ >- cmd[6] = (*ccid_descriptor->pbSeq)++; >- cmd[7] = bBWI; /* extend block waiting timeout */ >- cmd[8] = rx_length & 0xFF; /* Expected length, in character mode only */ >- cmd[9] = (rx_length >> 8) & 0xFF; >+ if ((CARDMAN3121 == ccid_descriptor->readerID) >+ && (SCARD_PROTOCOL_T1 == ccid_descriptor->cardProtocol)) >+ { >+ cmd[0] = 0x6B; /* Escape */ >+ i2dw(tx_length+1, cmd+1); /* APDU length */ >+ cmd[5] = ccid_descriptor->bCurrentSlotIndex; /* slot number */ >+ cmd[6] = (*ccid_descriptor->pbSeq)++; >+ cmd[7] = cmd[8] = cmd[9] = 0x00; /* RFU */ >+ cmd[10] = 0x1A; /* custom cmd "send TPDU" */ >+ >+ cmdlen = 11; >+ } >+ else >+ { >+ cmd[0] = 0x6F; /* XfrBlock */ >+ i2dw(tx_length, cmd+1); /* APDU length */ >+ cmd[5] = ccid_descriptor->bCurrentSlotIndex; /* slot number */ >+ cmd[6] = (*ccid_descriptor->pbSeq)++; >+ cmd[7] = bBWI; /* extend block waiting timeout */ >+ cmd[8] = rx_length & 0xFF; /* Expected length, in character mode only */ >+ cmd[9] = (rx_length >> 8) & 0xFF; >+ >+ cmdlen = 10; >+ } > >- memcpy(cmd+10, tx_buffer, tx_length); >+ memcpy(cmd+cmdlen, tx_buffer, tx_length); > >- ret = WritePort(reader_index, 10+tx_length, cmd); >+ ret = WritePort(reader_index, cmdlen+tx_length, cmd); > CHECK_STATUS(ret) > > return IFD_SUCCESS; >@@ -1260,7 +1283,7 @@ RESPONSECODE CCID_Transmit(unsigned int > RESPONSECODE CCID_Receive(unsigned int reader_index, unsigned int *rx_length, > unsigned char rx_buffer[], unsigned char *chain_parameter) > { >- unsigned char cmd[10+CMD_BUF_SIZE]; /* CCID + APDU buffer */ >+ unsigned char cmd[11+CMD_BUF_SIZE]; /* CCID + APDU buffer */ > unsigned int length; > RESPONSECODE return_value = IFD_SUCCESS; > status_t ret; >@@ -1453,7 +1476,13 @@ time_request: > > length = dw2i(cmd, 1); > if (length <= *rx_length) >+ { > *rx_length = length; >+ >+ if ((CARDMAN3121 == ccid_descriptor->readerID) >+ && (SCARD_PROTOCOL_T1 == ccid_descriptor->cardProtocol)) >+ *rx_length--; >+ } > else > { > DEBUG_CRITICAL2("overrun by %d bytes", length - *rx_length); >@@ -1468,7 +1497,13 @@ time_request: > return_value = IFD_COMMUNICATION_ERROR; > } > else >- memcpy(rx_buffer, cmd+10, length); >+ { >+ if ((CARDMAN3121 == ccid_descriptor->readerID) >+ && (SCARD_PROTOCOL_T1 == ccid_descriptor->cardProtocol)) >+ memcpy(rx_buffer, cmd+11, length-1); >+ else >+ memcpy(rx_buffer, cmd+10, length); >+ } > > /* Extended case? > * Only valid for RDR_to_PC_DataBlock frames */ >@@ -1650,6 +1685,12 @@ static RESPONSECODE CmdXfrBlockTPDU_T0(u > } > else > #endif >+ if (CARDMAN3121 == ccid_descriptor->readerID) >+ { >+ DEBUG_CRITICAL3("Ignoring dwMaxCCDMessageLength (tx=%d, max=%d)", >+ tx_length, ccid_descriptor->dwMaxCCIDMessageLength-10); >+ } >+ else > { > DEBUG_CRITICAL3("Command too long (%d bytes) for max: %d bytes", > tx_length, ccid_descriptor->dwMaxCCIDMessageLength-10);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 474406
: 351694