Hello,

during the tests of minidriver on Windows Vista there was a problem related to 
the using of OpenSC in multi-threads.

SC context create/release are not thread safe -- they allocate/release memory 
referenced by the pointers fromthe static 'struct sc_card_driver'.
(It concerns also, if present, load/unload of dynamic card driver.)
https://github.com/OpenSC/OpenSC/blob/master/src/libopensc/ctx.c#L749

Static 'struct sc_card_driver' is present in each card-xx.

Currently, in minidriver-write-mode branch, there is a temporary hack, but I 
think that this problem has to be resolved on the OpenSC side.
For example to introduce reference counter into 'sc_card_driver' and use it in 
the sc-context functions.

What would you say?
Do you know other places in the OpenSC code, that needs to be revisited from 
the thread safe point of view?

Kind regards,
Viktor.

_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to