NSS Library Init: Difference between revisions

Jump to navigation Jump to search
Line 43: Line 43:
3. NSS_ShutdownContext() can be called once per context. If NSS_ShutdownContext is called a second time on the same context, an error is returned. NSS_ShutdownContext() will shut down NSS if there are no more active contexts returned by NSS_InitContext() and NSS_Init() has not been called.
3. NSS_ShutdownContext() can be called once per context. If NSS_ShutdownContext is called a second time on the same context, an error is returned. NSS_ShutdownContext() will shut down NSS if there are no more active contexts returned by NSS_InitContext() and NSS_Init() has not been called.


4. An application that initialized NSS with NSS_Init() can call NSS_LibraryShutdown() with NULL. This will close out the NSS_Init() call, but will only shutdown NSS if all the active contexts are also closed. (What if NSS_Init has been called multiple times? Clearly spelled out in item 2-- 'as it does today.... calls are idempotent...' I'd be happy to take suggestions on how to wordsmith it better. I started to adjust the current words, but found I couldn't improve on them--[[User:Nelsonb|MisterTLS]] 22:00, 1 September 2009 (UTC) )
4. An application that initialized NSS with NSS_Init() can call NSS_LibraryShutdown() with NULL. This will close out the NSS_Init() call, but will only shutdown NSS if all the active contexts are also closed. (Note that NSS_Init() is still idempotent. This means that multiple calls to NSS_Init() before an NSS_Shutdown or and NSS_LibraryShutdown will still only result in a single NSS_Init call as far as shutdowns are concerned).
 
5. NSS_Shutdown() will operate as it does today. NSS will completely shutdown, active contexts will be closed.


5. NSS_Shutdown() will operate as it does today. NSS will completely shutdown, all active contexts will be closed.


Signature for the new functions:
Signature for the new functions:


  typedef struct NSSInitContextStr NSSInitContext; /* opaque */
  typedef struct NSSInitContextStr NSSInitContext; /* opaque */
typedef struct NSSInitStringStr NSSInitString;
struct NSSInitStringStr {
    int len; /* must be set to the length of NSSInitString. future versions.
              * of NSS may allow longer versions of this context, but need to
              * work with existing apps. */
    PRBool passwordRequired;
    int    minimumPasswordLength;
    char * manufactureID;          /* variable names for strings match the */
    char * libraryDescription;      /*  parameter name in softoken */
    char * cryptoTokenDescription;
    char * dbTokenDescription;
    char * FIPSTokenDescription;
    char * cryptoSlotDescription;
    char * dbSlotDescription;
    char * FIPSSlotDescription;
};


  NSSInitContext *NSS_InitContext(const char *configdir,
  NSSInitContext *NSS_InitContext(const char *configdir,
         const char *certPrefix, const char *keyPrefix,
         const char *certPrefix, const char *keyPrefix,
         const char *secmodName, PRUint32 flags);
         const char *secmodName, NSSInitStrings *initStrings, PRUint32 flags);


  SECStatus NSS_ShutdownContext(NSSInitContext *);
  SECStatus NSS_ShutdownContext(NSSInitContext *);
Line 67: Line 83:


#Application calls NSS_Init(). NSS_Init uses configdir to decide what PKCS #11 modules to load and what databases softoken opens.
#Application calls NSS_Init(). NSS_Init uses configdir to decide what PKCS #11 modules to load and what databases softoken opens.
#Library then calls NSS_Init(). Library ends up using whatever application already openned (in general, this ok, it make sense the the application controls what databases are used by all libraries it uses).
#Library then calls NSS_Init(). Library ends up using whatever application already opened (in general, this ok, it make sense the the application controls what databases are used by all libraries it uses).
#*at this point only the application specified databases are open
#*at this point only the application specified databases are open
#Library noticed that NSS was initializied already and does not call shutdown (hopefully).
#Library noticed that NSS was initializied already and does not call shutdown (hopefully).
439

edits

Navigation menu