Created attachment 134083 [details] [review]
A patch to fix the slot list caching problem
# Current behavior
1. load p11-kit-proxy.so as PKCS#11 module;
2. get the list of slots along with their descriptions (slot info);
3. insert a token or a smart card;
4. repeat step 2: no new tokens are found.
# Expected behavior
1.2.3. (same as above)
4. repeat step 2: the inserted token is found, it's description is available.
In order to make token insert and remove operations observable, it's
necessary to call C_GetSlotList() with NULL pointer argument. The
latter is a signal for each underlying PKCS#11 module to update the
slot and token status information.
The following is stated in the PKCS #11 Cryptographic Token Interface
Base Specification Version 2.40, 5.5 Slot and token management
"The set of slots accessible through a Cryptoki library is checked at
the time that C_GetSlotList, for list length prediction (NULL
pSlotList argument) is called. If an application calls C_GetSlotList
with a non-NULL pSlotList, and *then* the user adds or removes a
hardware device, the changed slot list will only be visible and
effective if C_GetSlotList is called again with NULL."