Hi. I'm developing an extension which, for other reasons already
contains a C++ component using NSS for several tasks.

Lately, I decided to add another task: Since we distribute a PKCS11
module with our application, I decided to install it on Firefox
startup without prompting the user.

nsIDOMPKCS11 would be useful (despite prompting) if it included any
method of guessing if the module is already installed for this user,
but as long as it doen't have any, user would be prompted at any
startup, so I discarded this approximation.

I got into the implementation of nsPkcs11::Addmodule to find that it
uses

SECMOD_AddNewModule(moduleName, fullPath,
                                       mechFlags, cipherFlags);
   if (srv == SECSuccess) {

to add the new module, and

SECMODModule *module = SECMOD_FindModule(moduleName);

to guess if it is installed.

I wrote a function in my component just to tell me if the module is
installed, here is the code:


/* long   IsPKCS11Installed(in string name); */
NS_IMETHODIMP ClauerCrypto::IsPKCS11Installed(const char *name,
PRInt32 *_retval)
{

  SECMODModule *module = NULL;

 cout<<"Looking for  "<<name<<endl;

  module = SECMOD_FindModule(name);

  if (module) {
    cout<<"YES  "<<name<<endl;
  }
  else{
    cout<<"NO  "<<name<<endl;
  }

  *_retval = 0;
  return NS_OK;

}


but calling SECMOD_FindModule(name); ends with a segmentation fault as
firefox starts, but everything works by commenting out this call.
xulrunner binary doesn't depend on libnss3, which includes this
symbol. ¿Is it possible that I'm calling this function before the
library is loaded?
¿Why could this happen?

Thanks in advance for all your help.
_______________________________________________
dev-tech-crypto mailing list
dev-tech-crypto@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-crypto

Reply via email to