OpenSC
OpenSC copied to clipboard
pkcs11: leverage sc_wait_for_event to avoid unneccesary queries to card
card_detect_all() is now used as global entry point even to reader specific card detection (card_detect() is removed). This enforces a constant update of reader_states so that no events are silently dropped. This removes the need for having a timer in C_GetSlotInfo() for avoiding too many queries. If the reader implementation (i.e. reader-*.c) does not implement wait_for_event, then all slots will be queried on request just like it used to be.
fixes https://github.com/OpenSC/OpenSC/issues/3107
Checklist
- [x] PKCS#11 module is tested
- [ ] Windows is tested (pkcs11-tool with --test-hotplug, --test, --test-threads)
- [ ] Linux is tested (pkcs11-tool with --test-hotplug, --test, --test-threads)
- [ ] macOS is tested (pkcs11-tool with --test-hotplug, --test, --test-threads)
Cool.
Code wise I do not see any issue, but some tests look like failing (even after the rerun of the previous failure) so it clearly needs some more investigation and testing.
@frankmorgner What is the state of this PR? Do we want this to go into 0.26.0?
This is a critical step, I would like to see this tested on the different platforms (i.e. PC/SC providers). I have extended the above check list accordingly. As I don't currently have much time for testing, I don't believe this will be ready in time for 0.26.0, even though I would love to see this included...