Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CCID unknown when updating file in smartcard (extended APDU) #54

Closed
nunomarks opened this issue Jan 2, 2019 · 13 comments
Closed

CCID unknown when updating file in smartcard (extended APDU) #54

nunomarks opened this issue Jan 2, 2019 · 13 comments

Comments

@nunomarks
Copy link

nunomarks commented Jan 2, 2019

When performing an update on a file with a 32Kb APDU, the following error is shown on pcscd logs:

...
pcscd[14964]: 00000000 commands.c:1523:CCID_Receive Unknown CCID error: 0xC3
pcscd[14964]: 00000029 ifdwrapper.c:543:IFDTransmit() Card not transacted: 612
pcscd[14964]: 00000006 winscard.c:1626:SCardTransmit() Card not transacted: 0x80100016
...

I'm using the following reader:

Reader 0: ACS ACR1252 Dual Reader [ACR1252 Dual Reader PICC] 00 00

And the card capabilities are as follows:

  Tag: 7, len: 3 (card capabilities)
  Selection methods: 84
    - DF selection by full DF name
    - Short EF identifier supported
  Data coding byte: 01
    - Behaviour of write functions: one-time write
    - Value 'FF' for the first byte of BER-TLV tag fields: invalid
    - Data unit in quartets: 2
  Command chaining, length fields and logical channels: E0
    - Command chaining
    - Extended Lc and Le fields
    - RFU (should not happen)
    - Logical channel number assignment: No logical channel
    - Maximum number of logical channels: 1

Which means the card supports extended APDUs. I also have the NFC reader documentation and it supports extended Lc and Le fields.

Is this an issue?

Cheers.

@LudovicRousseau
Copy link
Owner

Please provide the information as described at https://ccid.apdu.fr/#support

@nunomarks
Copy link
Author

Requested information:

CCID Driver version: 1.4.30-1
PCSClite version: 1.8.24-1

Output of the command /usr/sbin/pcscd --version:

pcsc-lite version 1.8.24.
Copyright (C) 1999-2002 by David Corcoran <[email protected]>.
Copyright (C) 2001-2015 by Ludovic Rousseau <[email protected]>.
Copyright (C) 2003-2004 by Damien Sauveron <[email protected]>.
Report bugs to <[email protected]>.
Enabled features: Linux x86_64-pc-linux-gnu libsystemd serial usb libudev usbdropdir=/usr/lib/pcsc/drivers ipcdir=/var/run/pcscd configdir=/etc/reader.conf.d

OS:

 Linux 4.15.0-20-generic #21-Ubuntu SMP Tue Apr 24 06:16:15 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Standard compatible PC with following hardware:

H/W path       Device      Class          Description
=====================================================
                           system         Computer
/0                         bus            Motherboard
/0/0                       memory         7854MiB System memory
/0/1                       processor      Intel(R) Core(TM) i5-3230M CPU @ 2.60GHz
/0/100                     bridge         3rd Gen Core processor DRAM Controller
/0/100/2                   display        3rd Gen Core processor Graphics Controller
/0/100/14                  bus            7 Series/C210 Series Chipset Family USB xHCI Host Controller
/0/100/16                  communication  7 Series/C216 Chipset Family MEI Controller #1
/0/100/16.3                communication  7 Series/C210 Series Chipset Family KT Controller
/0/100/19      enp0s25     network        82579LM Gigabit Network Connection
/0/100/1a                  bus            7 Series/C216 Chipset Family USB Enhanced Host Controller #2
/0/100/1b                  multimedia     7 Series/C216 Chipset Family High Definition Audio Controller
/0/100/1c                  bridge         7 Series/C216 Chipset Family PCI Express Root Port 1
/0/100/1c/0                generic        MMC/SD Host Controller
/0/100/1c.1                bridge         7 Series/C210 Series Chipset Family PCI Express Root Port 2
/0/100/1c.2                bridge         7 Series/C210 Series Chipset Family PCI Express Root Port 3
/0/100/1c.2/0  wlp4s0      network        Centrino Wireless-N 2230
/0/100/1c.5                bridge         7 Series/C210 Series Chipset Family PCI Express Root Port 6
/0/100/1c.5/0              bus            uPD720200 USB 3.0 Host Controller
/0/100/1d                  bus            7 Series/C216 Chipset Family USB Enhanced Host Controller #1
/0/100/1f                  bridge         QM77 Express Chipset LPC Controller
/0/100/1f.2                storage        7 Series Chipset Family 6-port SATA Controller [AHCI mode]
/0/2           scsi2       storage        
/0/2/0.0.0     /dev/cdrom  disk           DVD-RAM UJ8E2

Smartcard reader name: ACR1252U USB NFC Reader III
Smartcard reader manufacturer: ACS
Smartcard: STARCOS version 3.5 from G&D (NFC smartcard)

Log file: log.txt
GDB backtrace: gdb_backtrace.txt

Tell me if something is missing.

Cheers.

@nunomarks
Copy link
Author

Also I should note, if it's a normal-sized APDU (not extended), it works.

@LudovicRousseau
Copy link
Owner

I would say that the reader is not really CCID-compliant.
You can try to use the driver from ACS https://packages.ubuntu.com/bionic/libacsccid1

@nunomarks
Copy link
Author

I've tried that driver from ACS, and it still doesn't work.

@LudovicRousseau
Copy link
Owner

You should report the problem to ACS. I am pretty sure it is not a bug in my CCID driver.
Maybe they will know how to solve the problem with the ACS ACR1252 Dual Reader

@nunomarks
Copy link
Author

nunomarks commented Jan 3, 2019

By the way, how do I make pcscd use the ACS driver? It shows this in its logs:

00000004 [140363357824576] readerfactory.c:1075:RFInitializeReader() Attempting startup of ACS ACR1252 Dual Reader [ACR1252 Dual Reader SAM] 01 00 using /usr/local/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Linux/libccid.so
00000002 [140363357824576] readerfactory.c:864:RFLoadReader() Reusing already loaded driver for /usr/local/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Linux/libccid.so
00000010 [140363357824576] readerfactory.c:950:RFBindFunctions() Loading IFD Handler 3.0
00000018 [140363357824576] ifdhandler.c:110:CreateChannelByNameOrChannel() Lun: 10000, device: usb:072f/223b:libudev:1:/dev/bus/usb/003/007

ACS driver is installed at /usr/lib/pcsc/drivers/ifd-acsccid.bundle/Contents/Linux/libacsccid.so

@LudovicRousseau
Copy link
Owner

Have you installed the ACS driver?
What is the result of the command ls /usr/lib/pcsc/drivers/?

@nunomarks
Copy link
Author

Yes I did, but the problem is that pcsc is installed in two distinct directories:

/usr/local/lib/pcsc/
/usr/lib/pcsc/

@nunomarks
Copy link
Author

I've used the later pcsc binary (which uses ACS driver) and the result is the same.. Guess the only alternative is to contact ACS.

@LudovicRousseau
Copy link
Owner

I guess you built pcsc-lite yourself and installed it in /usr/local/
That isa bad idea if you want to use Ubuntu packages for the drivers.

Uninstall pcsc-lite from /usr/local/
And install the Ubuntu packages pcscd and libpcsclite1 instead.

@nunomarks
Copy link
Author

nunomarks commented Jan 4, 2019

Tried that solution, didn't work.

In the meantime I contacted ACS and they said it could be a problem with the firmware, but they are not sure.

Thanks for the help Ludovic.

@LudovicRousseau
Copy link
Owner

I see you created acshk/acsccid#15
Closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants