Brian Ryner wrote:
Hi,

Is it possible to use the HASH_* NSS functions before NSS_Init has been
called? I'd like to defer the full initialization while still being able to
run an MD5 hash.

You must initialize NSS.  However, there is a
way to initialize NSS for such simple things:
NSS_NoDB_Init.  Please try this sample code.

  #include "nss.h"

  PRBool inited_nss = PR_FALSE;

  if (!NSS_IsInitialized()) {
      NSS_NoDB_Init(NULL);
      inited_nss = PR_TRUE;
  }

  /* call the HASH_* NSS functions */
  ...

  if (inited_nss) {
      NSS_Shutdown();
  }

So, if the app has already initialized NSS,
you just go ahead and use NSS functions.  Else,
you have to initialize NSS (in the "no database"
mode) first, and have to shut down NSS.

This sample code assumes that this thread is
the only thread that may initialize NSS in the
app.

Wan-Teh
_______________________________________________
dev-tech-crypto mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-crypto

Reply via email to