Re: Using existing NSS/NSPR DLLs from Firefox in another app on OS/2
Wan-Teh Chang <[email protected]> Tue, 9 Feb 2010 16:24:50 -0800
| Newsgroups | gmane.comp.mozilla.devel.nspr |
|---|---|
| Message-ID | <[email protected]> |
On Tue, Feb 9, 2010 at 12:16 AM, Marty <[email protected]> wrote: > I'm trying to use the NSS/NSPR DLLs from Firefox on OS/2 for another > application (libpurple, an instant messaging library). I'm linking up with > them correctly (as far as I can tell), and initializing them in a standard > way, but when I call SECMOD_AddNewModule, I get a GPF unless Firefox is > already running on the system. When I have Firefox running, everything > seems to work well and I can make SSL connections through NSS successfully. > > My app is GCC and GLIB-based. Is it possible that the CRTL within the NSS > DLLs are not getting initialized correctly? Or is there some other problem > in my initialization process? Here is the code snippet that starts things > up: > > static void > ssl_nss_init_nss(void) > { > char *lib; > > PR_Init(PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 1); > NSS_NoDB_Init("."); > > lib = g_strdup("nssckbi.dll"); > SECMOD_AddNewModule("Builtins", lib, 0, 0); > /* GPF right on the above line if Firefox isn't running. */ > > g_free(lib); > NSS_SetDomesticPolicy(); > > SSL_CipherPrefSetDefault(TLS_DHE_RSA_WITH_AES_256_CBC_SHA, 1); > SSL_CipherPrefSetDefault(TLS_DHE_DSS_WITH_AES_256_CBC_SHA, 1); > SSL_CipherPrefSetDefault(TLS_RSA_WITH_AES_256_CBC_SHA, 1); > SSL_CipherPrefSetDefault(TLS_DHE_DSS_WITH_RC4_128_SHA, 1); > SSL_CipherPrefSetDefault(TLS_DHE_RSA_WITH_AES_128_CBC_SHA, 1); > SSL_CipherPrefSetDefault(TLS_DHE_DSS_WITH_AES_128_CBC_SHA, 1); > SSL_CipherPrefSetDefault(SSL_RSA_WITH_RC4_128_SHA, 1); > SSL_CipherPrefSetDefault(TLS_RSA_WITH_AES_128_CBC_SHA, 1); > SSL_CipherPrefSetDefault(SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, 1); > SSL_CipherPrefSetDefault(SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA, 1); > SSL_CipherPrefSetDefault(SSL_DHE_RSA_WITH_DES_CBC_SHA, 1); > SSL_CipherPrefSetDefault(SSL_DHE_DSS_WITH_DES_CBC_SHA, 1); > > _identity = PR_GetUniqueIdentity("Purple"); > _nss_methods = PR_GetDefaultIOMethods(); > } Hi Marty, dev-tech-crypto is the right mailing list for NSS questions. In any case, your code looks correct to me. When you initialize NSS with NSS_NoDB_Init(), secmod.db won't be created, so the issue Walter Meinl mentioned should be irrelevant. Is your code running inside the Firefox process or as a separate process? I'm sorry I may not be able to help much because I'm not familiar with OS/2. For example, I don't know what "the CRTL within the NSS DLLs" means. Wan-Teh