Skip to content
Snippets Groups Projects
README 2.45 KiB
Newer Older
TTXS - A CCID firmware implementation
Niibe Yutaka's avatar
Niibe Yutaka committed
What's this?
============

This is an implementation of firmware for smartcard reader.  It uses
standard USB CCID protocol.  It also can run with serial line instead
of USB.

The protocol for serial line is unfortunately not standardized.  In
this implementation, it follows the protocol of Microchip's
SEC1110/SEC1210.


Building the firmware
=====================

Niibe Yutaka's avatar
Niibe Yutaka committed
For ST Nucleo L432 on USB
-------------------------

$ cd src
$ ./configure --enable-usb
$ make


For ST Nucleo F103 on serial line
---------------------------------

Niibe Yutaka's avatar
Niibe Yutaka committed
$ cd src
Niibe Yutaka's avatar
Niibe Yutaka committed
$ ./configure --enable-serial --target=ST_NUCLEO_F103
Niibe Yutaka's avatar
Niibe Yutaka committed
Flashing the firmware
=====================

Niibe Yutaka's avatar
Niibe Yutaka committed
For ST Nucleo L432
------------------

Here is an example using OpenOCD.
Niibe Yutaka's avatar
Niibe Yutaka committed

$ openocd -f interface/stlink-v2-1.cfg -f target/stm32l4x.cfg \
          -c "program build/ttxs.elf verify reset exit"

Niibe Yutaka's avatar
Niibe Yutaka committed
For ST Nucleo F103
------------------

$ openocd -f interface/stlink-v2-1.cfg -f target/stm32f1x.cfg \
          -c "program build/ttxs.elf verify reset exit"

Niibe Yutaka's avatar
Niibe Yutaka committed
Serial line configuration for PC/SC-lite:
 
=============  /etc/reader.conf.d/libccidtwin
DEVICENAME        /dev/ttyACM0:SEC1210
FRIENDLYNAME      "TTXS serial"
LIBPATH           /usr/lib/pcsc/drivers/serial/libccidtwin.so
=============

Niibe Yutaka's avatar
Niibe Yutaka committed
Debugging with pcscd:
# LIBCCID_ifdLogLevel=0xffff pcscd -f --debug

When test without pcscd:
# stty -F /dev/ttyACM0 raw cstopb -parenb cs8 115200
Niibe Yutaka's avatar
Niibe Yutaka committed
USB configuration:
Niibe Yutaka's avatar
Niibe Yutaka committed
In my Debian system, I put this lines to the file
/etc/udev/rules.d/61-ttxs.rules:
===============================
SUBSYSTEM=="usb", ATTR{idVendor}="234b", ATTR{idProduct}=="0005", MODE="664", \
ENV{ID_SMARTCARD_READER}="1", ENV{ID_SMARTCARD_READER_DRIVER}="gnupg"
===============================
Niibe Yutaka's avatar
Niibe Yutaka committed

Niibe Yutaka's avatar
Niibe Yutaka committed
This software is only tested against OpenPGP card.

OpenPGP card ATR is:

    3b ; TS
       da ; T0  : TA1 TC1 TD1 available, historycal bytes = 10-byte long
          18 ; TA1 : F = 372 (max 5MHz), D = 8
          ff ; TC1 : guard time = 1 etu for T=1, 2 etu for T=0
          81 ; TD1 : TD2 available, T=1
               b1 ; TD2 : TA3, TB3, TD3 available, T=1
                    fe ; TA3 : IFSC = 254
                    75 ; TB3 : BWI = 7, CWI = 5
                    1f ; TD3 : TA4 available, T=15
                         03 ; TA4 : 3.3V and 5V, no clock stopping 
       00 31 f5 73 c0 01 60 00 90 00; historycal bytes
    1c ; check byte

Absence of TA2 means, it is in the "negotiable mode" to accept a PTS
(Protocol Type Selection) command.