pkcs11testmodule.cpp should ensure tokenPresent doesn't change in between calls to Test_C_GetSlotList()

NEW
Unassigned

Status

()

Core
Security: PSM
P3
normal
a year ago
a year ago

People

(Reporter: Cykesiopka, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [psm-backlog], URL)

(Reporter)

Description

a year ago
The C_GetSlotList() function on a PKCS #11 module can potentially be called multiple times by calling code (such as NSS) to first determine the number of slots the module has, and to get a list of slot IDs using that number.

Currently, the implementation of the function in pkcs11testmodule.cpp does this:
> CK_ULONG slotCount = (!limitToTokensPresent || tokenPresent ? 1 : 0) + 1;
... to determine the number of slots.

The cyclic behaviour of slot 1 of the test module means `tokenPresent` may change in between calls to C_GetSlotList(). As such, the slot list that the calling code ends up with may not be correct.

This doesn't seem to be a problem at the moment, but it would be better if this could be addressed.
You need to log in before you can comment on or make changes to this bug.