From 356fdcfaf6e126835ac3bd7f410a3fa4d4a6877b Mon Sep 17 00:00:00 2001
From: lsh123 <aleksey@aleksey.com>
Date: Sat, 13 Jan 2024 18:07:49 -0500
Subject: [PATCH] (xmlsec-nss) Ensure NSS algorithms are initialized (#754)

---
 src/nss/crypto.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/nss/crypto.c b/src/nss/crypto.c
index 6455ec72..7ba0c77a 100644
--- a/src/nss/crypto.c
+++ b/src/nss/crypto.c
@@ -361,8 +361,16 @@ xmlSecCryptoGetFunctions_nss(void) {
 
 static void
 xmlSecNssUpdateAvailableCryptoTransforms(xmlSecCryptoDLFunctionsPtr functions) {
+    SECStatus rv;
     xmlSecAssert(functions != NULL);
 
+    /* in theory NSS should be already initialized but just in case */
+    rv = SECOID_Init();
+    if (rv != SECSuccess) {
+        xmlSecNssError("SECOID_Init", NULL);
+        return;
+    }
+
     /******************************* AES ********************************/
     /* cbc */
     if (xmlSecNssCryptoCheckAlgorithm(SEC_OID_AES_128_CBC) == 0) {
