PATCH: pcsc cleanup/improvement

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

PATCH: pcsc cleanup/improvement

Martin Paljak
Attached patch does several things. In addition to fixing some
annoying indentation issues, the patch does the following:
1) the latest pcsc-lite uses reader.h to declare the pcsc part 10
related constants (and now also data structures) configure checks for
the presence of reader.h (shamelessly stolen from ccid driver). Also,
as it is now part of pcsc v2 the old name doesn't apply so function
names are prefixed with part10 instead.
2) opensc api currently uses many concepts from pcsc that actually
shouldn't matter that much or are not used in the code:
* error SC_CARD_RESET has a meaning only in the pcsc world and is
unknown for other drivers. Also, the only sensible thing to do when
such situation occurs is to use SCardReconnect to 'acknowledge the
reset and continue'. This function is currently never used. The card
reset error has no meaning to higher level applications (like
pkcs11+mozilla). What the patch doesn't do but what i suggest: remove
the SC_CARD_RESET error code from opensc.h. This is bug #27.
* the action argument for sc_disconnect comes from pcsc api too, but
is never used and has no meaning outside of the scope of pcsc.
* reader is always connected in shared mode but exclusive mode is also
possible. For some very paranoid setups this might be a useful option.
If some other application uses the reader in exclusive mode and opensc
tries to access the reader too we currently fail with an unknwon
error. This patch makes it a generic reader error.

In addition to fixing the card reset error this patch makes all pcsc
'modes' and actions configurable. The default configuration results in
same behavior as current code, with the exception that we reset the
card when a disconnect is done.

One can play with those options to get scenarios that might be interesting:
turning on lock_login and exclusive reader access mode in very
paranoid application setups
turning on reset after each transaction and leaving off lock login
will result in very slow performance but is similar to the Estonian
idcard CSP on windows that does a reset after each transaction it does
with the card.

And: anyone knows about the windows kludge on line 192 ?

Comments ?

Martin Paljak
[hidden email]
+372.5156495 - phone

opensc-devel mailing list
[hidden email]

pcsc-cleanup.patch (30K) Download Attachment