summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn M. Schanck <jschanck@mozilla.com>2022-10-31 16:15:23 +0000
committerJohn M. Schanck <jschanck@mozilla.com>2022-10-31 16:15:23 +0000
commit2164d9428c73ae64febd4cad6ba476b3618308de (patch)
treee7fe36421ef6167afcab01fcb89c28b337c5474e
parentcb11c059ef463f8baa516f50e10960aca664b5f6 (diff)
downloadnss-hg-2164d9428c73ae64febd4cad6ba476b3618308de.tar.gz
Bug 1798150 - on-demand initialization of OID tables. r=nss-reviewers,nkulatovaNSS_3_85_BETA1
Differential Revision: https://phabricator.services.mozilla.com/D160714
-rw-r--r--lib/util/secoid.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/util/secoid.c b/lib/util/secoid.c
index d340dd953..b36735c5d 100644
--- a/lib/util/secoid.c
+++ b/lib/util/secoid.c
@@ -2137,7 +2137,11 @@ SECOID_FindOIDByMechanism(unsigned long mechanism)
{
SECOidData *ret;
- PR_ASSERT(oidhash != NULL);
+ PR_ASSERT(oidmechhash != NULL);
+ if (oidmechhash == NULL && SECOID_Init() != SECSuccess) {
+ PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
+ return NULL;
+ }
ret = PL_HashTableLookupConst(oidmechhash, (void *)(uintptr_t)mechanism);
if (ret == NULL) {
@@ -2153,6 +2157,10 @@ SECOID_FindOID(const SECItem *oid)
SECOidData *ret;
PR_ASSERT(oidhash != NULL);
+ if (oidhash == NULL && SECOID_Init() != SECSuccess) {
+ PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
+ return NULL;
+ }
ret = PL_HashTableLookupConst(oidhash, oid);
if (ret == NULL) {