Package: libacr38u
Version: 1.7.10-1
Severity: important
Tags: patch
Using the Smart Card Reader with my new Regional Health Card and try to access
to a reserved Web area with iceweasel (using opensc middleware to access to
the card) I obtain a failure.
The reason is that the driver receive a "0a" response from the card and
understand it as an APDU reply (wrong!) instead of part of a
WTX message - Waiting Time Extension (correct) sended by the card because it
needs more time.
VERY IMPORTANT: the patch is from Emanuele Pucciarelli, I'm only the
bug finder and the obsessive bug-fix supplicant; I had tried to investigate
the bug but Emanuele was more fast to fix it.
-- System Information:
Debian Release: 5.0.7
APT prefers stable
APT policy: (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.26-2-amd64 (SMP w/8 CPU cores)
Locale: LANG=it_IT.UTF-8, LC_CTYPE=it_IT.UTF-8 (charmap=UTF-8) (ignored: LC_ALL
set to it_IT.UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages libacr38u depends on:
ii libc6 2.7-18lenny6 GNU C Library: Shared libraries
ii libpcsclite1 1.5.5-3 Middleware to access a smart card
ii libusb-0.1-4 2:0.1.12-13 userspace USB programming library
Versions of packages libacr38u recommends:
ii pcscd 1.5.5-3 Middleware to access a smart card
libacr38u suggests no packages.
-- no debconf information
--- a/src/driver/T1Hndlr.c 2009-07-27 09:05:03.000000000 +0200
+++ b/src/driver/T1Hndlr.c 2011-01-01 12:23:22.000000000 +0100
@@ -436,6 +436,7 @@
dwRBufferLen = MAX_BUFFER_SIZE;
rv = T1_ACSTransaction(Lun, ucTBuffer, dwRemaining+4, ucRBuffer, &dwRBufferLen );
+ do {
tv = T1_GetResponseType( ucRBuffer, dwRBufferLen );
#ifdef T1_DEBUG
@@ -462,6 +463,8 @@
break;
}
+ } while (tv == T1_SBLOCK_WTXREQUEST);
+
iPrevSequence = ucRBuffer[1] & 0x40;
#ifdef T1_DEBUG
printf("CASE 2: more data: %s\n", ucRBuffer[1]&0x20? "AVAILABLE":"NOT AVAILABLE");
@@ -498,8 +501,10 @@
do {
/* Create the R-block */
+ unsigned char NR = (~ucRBuffer[1]>>6)&0x01;
+
ucTBuffer[0] = 0x00; /* DF Nad */
- ucTBuffer[1] = (ucRChainNum%2)?0x90:0x80; /* N(R) */
+ ucTBuffer[1] = NR?0x90:0x80; /* N(R) */
ucTBuffer[2] = 0x00; /* Len = 0 */
ucTBuffer[3] = T1CalculateLRC( ucTBuffer, 3 ); /* Lrc */
dwRBufferLen = MAX_BUFFER_SIZE;