Revert "pkcs11: fixed slotIDs when a new slot list is requested"
This reverts commit 7fb72ccf7b
.
This commit is contained in:
parent
cd5c91b8ef
commit
31d8c2dfd1
|
@ -451,13 +451,8 @@ CK_RV C_GetSlotList(CK_BBOOL tokenPresent, /* only slots with token prese
|
||||||
pSlotList==NULL_PTR? "plug-n-play":"refresh");
|
pSlotList==NULL_PTR? "plug-n-play":"refresh");
|
||||||
|
|
||||||
/* Slot list can only change in v2.20 */
|
/* Slot list can only change in v2.20 */
|
||||||
if (pSlotList == NULL_PTR) {
|
if (pSlotList == NULL_PTR)
|
||||||
sc_ctx_detect_readers(context);
|
sc_ctx_detect_readers(context);
|
||||||
for (i=0; i<list_size(&virtual_slots); i++) {
|
|
||||||
slot = (sc_pkcs11_slot_t *) list_get_at(&virtual_slots, i);
|
|
||||||
slot->flags &= ~SC_PKCS11_SLOT_FLAG_SEEN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
card_detect_all();
|
card_detect_all();
|
||||||
|
|
||||||
|
@ -488,21 +483,6 @@ CK_RV C_GetSlotList(CK_BBOOL tokenPresent, /* only slots with token prese
|
||||||
prev_reader = slot->reader;
|
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; i<list_size(&virtual_slots); i++) {
|
|
||||||
slot = (sc_pkcs11_slot_t *) list_get_at(&virtual_slots, i);
|
|
||||||
slot->id = (CK_SLOT_ID) list_locate(&virtual_slots, slot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pSlotList == NULL_PTR) {
|
if (pSlotList == NULL_PTR) {
|
||||||
sc_log(context, "was only a size inquiry (%lu)\n", numMatches);
|
sc_log(context, "was only a size inquiry (%lu)\n", numMatches);
|
||||||
*pulCount = numMatches;
|
*pulCount = numMatches;
|
||||||
|
|
|
@ -115,6 +115,7 @@ CK_RV create_slot(sc_reader_t *reader)
|
||||||
}
|
}
|
||||||
|
|
||||||
slot->login_user = -1;
|
slot->login_user = -1;
|
||||||
|
slot->id = (CK_SLOT_ID) list_locate(&virtual_slots, slot);
|
||||||
init_slot_info(&slot->slot_info, reader);
|
init_slot_info(&slot->slot_info, reader);
|
||||||
sc_log(context, "Initializing slot with id 0x%lx", slot->id);
|
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.major = reader->version_major;
|
||||||
slot->slot_info.hardwareVersion.minor = reader->version_minor;
|
slot->slot_info.hardwareVersion.minor = reader->version_minor;
|
||||||
}
|
}
|
||||||
slot->id = (CK_SLOT_ID) list_locate(&virtual_slots, slot);
|
|
||||||
|
|
||||||
return CKR_OK;
|
return CKR_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue