Re: Using existing NSS/NSPR DLLs from Firefox in another app on OS/2

Walter Meinl <[email protected]> Tue, 9 Feb 2010 13:33:31 -0800 (PST)
Newsgroups gmane.comp.mozilla.devel.nspr
Organization http://groups.google.com
Message-ID <48969a85-9eca-4b56-a2b5-890825430c11@d27g2000yqn.googlegroups.com>
On Feb 9, 9: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();
>
> }
>
> --
> [Reverse the parts of the e-mail address to reply.]

I have no clue about it, but googling around, I got hints that the
problem might be that your app doesn't find the secmod.db database
when firefox isn't running, just a guess. You maybe get answers in the
mozilla.dev.tech.crypto group. I don't think that your problem is OS/2
only.
Walter