OpenSC icon indicating copy to clipboard operation
OpenSC copied to clipboard

pkcs11: leverage sc_wait_for_event to avoid unneccesary queries to card

Open frankmorgner opened this issue 10 months ago • 4 comments

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)

frankmorgner avatar Apr 24 '24 11:04 frankmorgner

Cool.

dengert avatar Apr 24 '24 13:04 dengert

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.

Jakuje avatar Apr 30 '24 14:04 Jakuje

@frankmorgner What is the state of this PR? Do we want this to go into 0.26.0?

xhanulik avatar Aug 28 '24 12:08 xhanulik

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...

frankmorgner avatar Sep 09 '24 12:09 frankmorgner