diff --git a/src/pkcs11/pkcs11-global.c b/src/pkcs11/pkcs11-global.c index 71e13831..c51f2fb9 100644 --- a/src/pkcs11/pkcs11-global.c +++ b/src/pkcs11/pkcs11-global.c @@ -451,13 +451,8 @@ CK_RV C_GetSlotList(CK_BBOOL tokenPresent, /* only slots with token prese pSlotList==NULL_PTR? "plug-n-play":"refresh"); /* Slot list can only change in v2.20 */ - if (pSlotList == NULL_PTR) { + if (pSlotList == NULL_PTR) sc_ctx_detect_readers(context); - for (i=0; iflags &= ~SC_PKCS11_SLOT_FLAG_SEEN; - } - } card_detect_all(); @@ -488,21 +483,6 @@ CK_RV C_GetSlotList(CK_BBOOL tokenPresent, /* only slots with token prese prev_reader = slot->reader; } - /* Slot list can only change in v2.20 */ - if (pSlotList == NULL_PTR) { - /* slot->id is derived from its location in the list virtual_slots. - * When the slot list changes, so does slot->id, so we reindex the - * slots here the same way it is done in `create_slot()` - * - * TODO use a persistent CK_SLOT_ID, e.g. by using something like - * `slot->id = sc_crc32(slot, sizeof *slot);` (this example, however, - * is currently not thread safe). */ - for (i=0; iid = (CK_SLOT_ID) list_locate(&virtual_slots, slot); - } - } - if (pSlotList == NULL_PTR) { sc_log(context, "was only a size inquiry (%lu)\n", numMatches); *pulCount = numMatches; diff --git a/src/pkcs11/slot.c b/src/pkcs11/slot.c index 423457b4..12dea459 100644 --- a/src/pkcs11/slot.c +++ b/src/pkcs11/slot.c @@ -115,6 +115,7 @@ CK_RV create_slot(sc_reader_t *reader) } slot->login_user = -1; + slot->id = (CK_SLOT_ID) list_locate(&virtual_slots, slot); init_slot_info(&slot->slot_info, reader); sc_log(context, "Initializing slot with id 0x%lx", slot->id); @@ -125,7 +126,6 @@ CK_RV create_slot(sc_reader_t *reader) slot->slot_info.hardwareVersion.major = reader->version_major; slot->slot_info.hardwareVersion.minor = reader->version_minor; } - slot->id = (CK_SLOT_ID) list_locate(&virtual_slots, slot); return CKR_OK; }