зеркало из https://github.com/mozilla/gecko-dev.git
Only call C_WaitForSlotEvent if the module is PKCS #11 v2.01 or later.
bug 196811 r=wtc sr=julien
This commit is contained in:
Родитель
61e7926e90
Коммит
aa8a2c0490
|
@ -336,6 +336,7 @@ SECMOD_LoadPKCS11Module(SECMODModule *mod) {
|
|||
mod->isThreadSafe = PR_FALSE;
|
||||
}
|
||||
}
|
||||
mod->cryptokiVersion = info.cryptokiVersion;
|
||||
|
||||
/* If we don't have a common name, get it from the PKCS 11 module */
|
||||
if ((mod->commonName == NULL) || (mod->commonName[0] == 0)) {
|
||||
|
|
|
@ -859,7 +859,7 @@ SECMOD_UpdateSlotList(SECMODModule *mod)
|
|||
{
|
||||
CK_RV crv;
|
||||
CK_ULONG count;
|
||||
int i, oldCount;
|
||||
CK_ULONG i, oldCount;
|
||||
PRBool freeRef = PR_FALSE;
|
||||
void *mark = NULL;
|
||||
CK_ULONG *slotIDs = NULL;
|
||||
|
@ -882,7 +882,7 @@ SECMOD_UpdateSlotList(SECMODModule *mod)
|
|||
PZ_Unlock(mod->refLock);
|
||||
return SECSuccess;
|
||||
}
|
||||
if (count < mod->slotCount) {
|
||||
if (count < (CK_ULONG)mod->slotCount) {
|
||||
/* shouldn't happen with a properly functioning PKCS #11 module */
|
||||
PORT_SetError( SEC_ERROR_INCOMPATIBLE_PKCS11 );
|
||||
goto loser;
|
||||
|
@ -1060,9 +1060,13 @@ SECMOD_WaitForAnyTokenEvent(SECMODModule *mod, unsigned long flags,
|
|||
CK_RV crv;
|
||||
PK11SlotInfo *slot;
|
||||
|
||||
if (!pk11_getFinalizeModulesOption()) {
|
||||
if (!pk11_getFinalizeModulesOption() ||
|
||||
((mod->cryptokiVersion.major == 2) &&
|
||||
(mod->cryptokiVersion.minor < 1))) {
|
||||
/* if we are sharing the module with other software in our
|
||||
* address space, we can't reliably use C_WaitForSlotEvent() */
|
||||
* address space, we can't reliably use C_WaitForSlotEvent(),
|
||||
* and if the module is version 2.0, C_WaitForSlotEvent() doesn't
|
||||
* exist */
|
||||
return secmod_HandleWaitForSlotEvent(mod, flags, latency);
|
||||
}
|
||||
/* first the the PKCS #11 call */
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "nssilckt.h"
|
||||
#include "secoid.h"
|
||||
#include "secasn1.h"
|
||||
#include "pkcs11t.h"
|
||||
|
||||
/* find a better home for these... */
|
||||
extern const SEC_ASN1Template SECKEY_PointerToEncryptedPrivateKeyInfoTemplate[];
|
||||
|
@ -97,6 +98,7 @@ struct SECMODModuleStr {
|
|||
int cipherOrder; /* order for cipher operations */
|
||||
unsigned long evControlMask; /* control the running and shutdown of slot
|
||||
* events (SECMOD_WaitForAnyTokenEvent) */
|
||||
CK_VERSION cryptokiVersion; /* version of this library */
|
||||
};
|
||||
|
||||
/* evControlMask flags */
|
||||
|
|
Загрузка…
Ссылка в новой задаче