libchipcard, PC/SC ifdhandlers and 64bit systems

Henryk Plötz <[email protected]>
Newsgroups gmane.comp.lib.libchipcard.devel
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Moin,

although it's nearly two months since I got my new machine with x64_64
architecture (Intel Core2 Duo, Gentoo amd64) I have yet to get
libchipcard working (and thus HBCI through gnucash) working again.

After trying some constellations which I didn't believe to work in the
first place and don't want to bother anyone with I have now arrived at
a fallback configuration which I think should work, but doesn't.

This is libchipcard3 3.0.2 (on Gentoo Linux 2006.1, compiled for
x86_64) with Ludovic Rousseau's ccid ifdhandler version 1.2.1 and an
Omnikey Cardman 5121.

The error message I get when trying to transmit an APDU is
commands.c:1091:CmdXfrBlockTPDU_T0() Command too long (-891425008 bytes) for max: 261 bytes

This indicates that the tx_length parameter in CmdXfrBlockTPDU (in
libccid) has been passed a ridiculously wrong value. This function
gets its tx_length straight from the DWORD TxLength parameter of
IFDHTransmitToICC() and gdb shows that the value is already wrong there:

Breakpoint 1, IFDHTransmitToICC (Lun=0, SendPci={Protocol = 47236763568210, Length = 0}, 
    TxBuffer=0x4 <Address 0x4 out of bounds>, TxLength=140736596930320,
    RxBuffer=0x7fff8028233c "+\001", RxLength=0x7fff80282330, RecvPci=0x2af62a82be29) at ifdhandler.c:909
909     {
(gdb) print sizeof(DWORD)
$1 = 8
(gdb) print sizeof(unsigned int)
$2 = 4
(gdb)


IFDHTransmitToICC() in turn is called (through some magic) in 
src/drivers/ifd/driverifd.c in libchipcard on line 423 as dct->transmitFn
which in driverifd_p.h is defined to be of type CCIDTRANSMIT_PTR where 
TxBufferLen is defined as GWEN_TYPE_UINT32.

So obviously there's some confusion about the length of the arguments.
I didn't find a specification as to what DWORD is defined to mean in the
PC/SC context so I don't know who is to blame here.

- -- 
Henryk Plötz
Grüße aus Berlin
~ Help Microsoft fight software piracy: Give Linux to a friend today! ~
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6-ecc01.6 (GNU/Linux)

iD8DBQFGJxoHvI90l8kWns8RAkeVAJ9KH9NOJuEOB8J0jS34p95hR0Qf+gCggqBU
hF1vXPEjFXMh2kExpLUZNm0=
=nQVg
-----END PGP SIGNATURE-----

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.