imported changes from mozilla NSS:

- Bug 1755555 - Hold tokensLock through nssToken_GetSlot calls in nssTrustDomain_GetActiveSlots. r=rrelyea (a36477f0)
- Bug 1370866 - Check return value of PK11Slot_GetNSSToken. r=djackson (d7e8c2df)
- Bug 1751157 - Throw illegal_parameter alert for illegal extensions in handshake message. r=djackson (8fd5ca0c)
This commit is contained in:
roytam1 2022-02-25 13:02:18 +08:00
commit c403014cbe
14 changed files with 282 additions and 106 deletions

View file

@ -13,6 +13,7 @@
#include "pki3hack.h"
#include "secerr.h"
#include "dev.h"
#include "dev3hack.h"
#include "utilpars.h"
#include "pkcs11uri.h"
@ -1266,8 +1267,14 @@ SECMOD_WaitForAnyTokenEvent(SECMODModule *mod, unsigned long flags,
}
/* if we are in the delay period for the "isPresent" call, reset
* the delay since we know things have probably changed... */
if (slot && slot->nssToken && slot->nssToken->slot) {
nssSlot_ResetDelay(slot->nssToken->slot);
if (slot) {
NSSToken *nssToken = PK11Slot_GetNSSToken(slot);
if (nssToken) {
if (nssToken->slot) {
nssSlot_ResetDelay(nssToken->slot);
}
(void)nssToken_Destroy(nssToken);
}
}
return slot;
@ -1500,8 +1507,12 @@ SECMOD_OpenNewSlot(SECMODModule *mod, const char *moduleSpec)
if (slot) {
/* if we are in the delay period for the "isPresent" call, reset
* the delay since we know things have probably changed... */
if (slot->nssToken && slot->nssToken->slot) {
nssSlot_ResetDelay(slot->nssToken->slot);
NSSToken *nssToken = PK11Slot_GetNSSToken(slot);
if (nssToken) {
if (nssToken->slot) {
nssSlot_ResetDelay(nssToken->slot);
}
(void)nssToken_Destroy(nssToken);
}
/* force the slot info structures to properly reset */
(void)PK11_IsPresent(slot);
@ -1631,8 +1642,12 @@ SECMOD_CloseUserDB(PK11SlotInfo *slot)
PR_smprintf_free(sendSpec);
/* if we are in the delay period for the "isPresent" call, reset
* the delay since we know things have probably changed... */
if (slot->nssToken && slot->nssToken->slot) {
nssSlot_ResetDelay(slot->nssToken->slot);
NSSToken *nssToken = PK11Slot_GetNSSToken(slot);
if (nssToken) {
if (nssToken->slot) {
nssSlot_ResetDelay(nssToken->slot);
}
(void)nssToken_Destroy(nssToken);
/* force the slot info structures to properly reset */
(void)PK11_IsPresent(slot);
}