Bug in libtowitoko-2.0.7

Michael Loehner michael.loehner at VSA.de
Thu Mar 9 16:33:50 CET 2006


Hello,

I use the pcsclite layer with libtowitoko-2.0.7 / Chipdrive Micro Cardreader 
under SuSE Linux 9.3. 

We develop a Javaapplication, wich uses the Jaccal Libraries to communicate 
with the pcsc layer.

Everything works fine - with one exception: Smartcards with the ATR 82 13 10 
84 are getting corrupted when only inserted into the reader.

Im only a pure (poor :-)) Java-developer, so it was hard to find out whats 
going wrong, but I think I have found the buggy part of code:

File: icc_sync.c
Lines: 521 - 533

/* Check for I2CX card */
	  icc->type = IFD_TOWITOKO_I2C_SHORT;

          ICC_Sync_Read (icc, 0, 1, orig);

	  if (orig[0] == 0xFF)
	    modif[0] = 0x01;
	  else if (orig[0] == 0x00)
	    modif[0] = 0xFE;
	  else
	    modif[0] = ~orig[0];

	  if (ICC_Sync_Write (icc, 0, 1, modif) == ICC_SYNC_OK)
	    ICC_Sync_Write (icc, 0, 1, orig);
	  else
            icc->type = IFD_TOWITOKO_I2C_LONG;

What happens: If a card with the specified ATR is inserted (which btw. is 
normally a healthcare ID-Card in Germany !!!) you try to read and write the 
first byte of the card - somehow this byte is written back as '00' - 
everytime! It should be '82'. Most Applications at hospitals and medics 
refuse to read the card thereafter.

Ether the call of IC_Sync_Write never delivers the expected value, so that you 
do not write back the orig, or you forgot the writing back of the orig in the 
else - case.

Maybe you can fix this bug with the given information, otherwise I'll try to 
give you more infos or can send you a smartcard of the affected type.

Thanks for your great work anyway,

yours sincerely,

Michael Löhner

Software Developer

Anwendungsentwicklung

VSA GmbH
Föhrigstraße 29-31
95482 Gefrees

Tel.: (+49 92 54) 960 262
Fax: (+49 92 54) 960 635

mailto: michael.loehner at vsa.de

www.vsa.de
www.apothekenportal.de


________________________________
I have been told that one of the reasons for the longevity of the Roman 
bridges is that their designers had to stand under them when they were first 
used. It may be time to put a similar discipline into the software field.


More information about the feedback mailing list