We ran into a similar problem with PKCS #11 modules that
NSS and some other libraries share.  When one of the libraries
calls C_Finalize on the shared PKCS #11 module, it prevents
the other libraries from using the PKCS #11 module.

Some possible solutions to this problem:

1. Change cURL to call NSS_IsInitialized.  If
NSS_Initialized returns PR_FALSE, then cURL knows
it needs to initialize and shut down NSS.  If NSS_IsInitialized
returns PR_TRUE, cURL won't initialize and shut down NSS.

2. Add a function to cURL that cURL users can call
to indicate that cURL isn't responsible for initializing
and shutting down NSS.

3. Change NSS_Init so that instead of doing nothing
when NSS is already initialized:

http://mxr.mozilla.org/security/source/security/nss/lib/nss/nssinit.c#448
448     if (nss_IsInitted) {
449         return SECSuccess;
450     }

it increments an initialization count.  Then, NSS_Shutdown
decrements the initialization count, and only shuts down
NSS when the count reaches 0.

Wan-Teh
_______________________________________________
dev-tech-crypto mailing list
dev-tech-crypto@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-crypto

Reply via email to