From: Frank M. <fra...@gm...> - 2018-12-30 00:35:48
|
We don't need to share a mutex across processes, because we don't share contexts across the process boundaries. Consequently, when initializing the card in process A with a PIN, that PIN doesn't show up in the sc_pkcs15_card_t object of process B if the card was already visible for B. You should never be able to use the newly initialized card in B (without calling C_Finalize()/C_Initialize()). However, calling C_WaitForSlotEvent() and C_GetTokenInfo() from B should not interfere with A initializing the card. This may be a bug within OpenSC. You should check in the logs which APDUs B actually sends while A is initializing. In general, locking in PC/SC should be done based on the command that's issued to avoid interference (sc_lock()/sc_unlock()), which is why A should not be interrupted during pkcs15_initialize() or pkcs15_init_pin(). Whether or not unpowering the card is useful or harming, depends on the card. If you want to get more details, send the logs and show your code. -- Frank Morgner Virtual Smart Card Architecture http://vsmartcard.sourceforge.net OpenPACE http://openpace.sourceforge.net IFD Handler for libnfc Devices http://sourceforge.net/projects/ifdnfc |