Bug 1606992 - Permit sftk_PBELockInit being called multiple times. r=kjacobs NSS_3_49_BRANCH
authorKai Engert <kaie@kuix.de>
Fri, 17 Jan 2020 15:40:59 +0000
branchNSS_3_49_BRANCH
changeset 15485 b2a5ce7d8dda2e2b48913a4464754fc8f5e9e5ba
parent 15484 77dbabd40023804dc6c6b8ee8ed8b9f784a4e8e1
child 15486 4ad60009006ebf8fc64cee2208638ae066a130e9
push id3652
push userjjones@mozilla.com
push dateThu, 23 Jan 2020 18:04:18 +0000
reviewerskjacobs
bugs1606992
Bug 1606992 - Permit sftk_PBELockInit being called multiple times. r=kjacobs Differential Revision: https://phabricator.services.mozilla.com/D60236
lib/softoken/lowpbe.c
--- a/lib/softoken/lowpbe.c
+++ b/lib/softoken/lowpbe.c
@@ -568,18 +568,19 @@ static struct {
     HASH_HashType hashType;
     int iterations;
     int keyLen;
 } PBECache = { NULL, NULL, NULL, NULL };
 
 void
 sftk_PBELockInit(void)
 {
-    PORT_Assert(!PBECache.lock);
-    PBECache.lock = PZ_NewLock(nssIPBECacheLock);
+    if (!PBECache.lock) {
+        PBECache.lock = PZ_NewLock(nssIPBECacheLock);
+    }
 }
 
 static void
 sftk_clearPBECacheItemsLocked(void)
 {
     if (PBECache.hashPBKDF2) {
         SECITEM_ZfreeItem(PBECache.hashPBKDF2, PR_TRUE);
         PBECache.hashPBKDF2 = NULL;