Juan Antonio Martinez wrote: > Working in new code for DNIe card, I've found a problem: > sc_transmit_apdu() must be overriden to allow secure messaging > routine perform apdu wrapping when SM is on > > I've coded a kind of "virtual channel" that hides SM issues from > my code. Every sc_transmit_apdu() call is translated into > dnie_transmit_apdu() that depending on sm status, encodes apdu > an then redirects to real sc_transmit_apdu() > > Victor's SM trunk does something similar, but at lower level > http://www.opensc-project.org/opensc/browser/branches/vtarasov/opensc-sm.trunk/src/libopensc/apdu.c > ( Victor's code takes also care on apdu chainning when required, but > that's not my case ) > > The problem arises when using standard iso7816 functions. For instance > dnie_card_select_file() fully complains standard, so I'd like to use > iso_ops->select_file().... but code at iso7816.c just call > sc_transmit_apdu()... and SM wrapper won't be called. > The only (and dirty) solution is clone iso_select_file() into my code > > An ideal solution for me (and for the other people that is working with > SM cards) would be adding a new card operation "card_transmit_apdu()", > that defaults in iso7816.c to sc_transmit_apdu(), but can be overriden > when needed. > Most card drivers can stay unchanged (bypassing wrapper), but iso7816.c > should be rewritten to take care on redirection > > What's your opinion on this?. I can send you required patch for > supporting card_operations->card_transmit_apdu() code > Look onto this ancient patch, probably you'll find something useful. Part of it concerns the SM at the 'APDU transmit' level.
https://www.opensc-project.org/svnp/files/trunk/contrib/opensc-0.11.1.trunk.20061204-sm.patch.tgz > Juan Antonio > > > ------------------------------------------------------------------------ > > _______________________________________________ > opensc-devel mailing list > opensc-devel@lists.opensc-project.org > http://www.opensc-project.org/mailman/listinfo/opensc-devel -- Viktor Tarasov <viktor.tara...@opentrust.com> _______________________________________________ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel