let’s try to summarize the problem: NSS seems dead or in a strange state after 
a second call to CERT functions 

context: Windows Visual 2010, nss 3.14.1, inside a thread, code within one dll

what I do:
1/ in one method (no problem)
GetCert()
{
        PR_Init((PRThreadType)0, (PRThreadPriority)0, (PRUintn)0);
        NSS_Init("c:/some_path");
        CERTCertDBHandle *certHandle = CERT_GetDefaultCertDB();
        if (certHandle) {
                CERTCertificate *cert = CERT_FindCertByNickname(certHandle, 
"735bb6e8-1793-4fb2-9da7-80f00f5de108");    
        }
}

2/ in a second method (a little bit later)

ComputeSignature(unsigned char* message, int messageSize)
{
        if ( !NSS_IsInitialized() ) { // POINT 1
                NSS_Init ("c:/some_path");  // POINT 2
        }
        CERTCertDBHandle *certHandle = CERT_GetDefaultCertDB(); // return NULL
        CERTCertificate *cert = CERT_FindCertByNickname(certHandle, _certName);
}

Symptoms
- At point 1, NSS is not initialized
- At point 2, in the function PK11_InitSlotLists, I found that various static 
variable are not valid (i.e. pk11_seedSlotList == { head=0x00000000 
tail=0x00000000 lock=0x00000000 }, => NSS stay in a strange state 
- Should I do not call GetCert() => no problem in ComputeSignature()
- I did try various init, NSS_InitContext, NSS_NoDB_Init, NSS_Initialize 
without success

According to me this seems to be either a bug or a mistake. I found a similar 
problem (Red Hat Bugzilla – Bug 707599: replication with TLS does not work)
Thanks you for any help
Michel
-- 
dev-tech-crypto mailing list
dev-tech-crypto@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-crypto

Reply via email to