Summary

FC_Initialize - initialize the PKCS #11 library.

Syntax

CK_RV FC_Initialize(CK_VOID_PTR pInitArgs);

Parameters

pInitArgs
Points to a CK_C_INITIALIZE_ARGS structure.

Description

FC_Initialize initializes the NSS cryptographic module for the FIPS mode of operation. In addition to creating the internal data structures, it performs the FIPS software integrity test and power-up self-tests.

The pInitArgs argument must point to a CK_C_INITIALIZE_ARGS structure whose members should have the following values:

The library parameters string has this format:

"configdir='dir' certPrefix='prefix1' keyPrefix='prefix2' secmod='file' flags= "

Here are some examples.

NSS_NoDB_Init(""), which initializes NSS with no databases:

 "configdir='' certPrefix='' keyPrefix='' secmod='' flags=readOnly,noCertDB,noMod
DB,forceOpen,optimizeSpace "

Mozilla Firefox initializes NSS with this string (on Windows):

 "configdir='C:\\Documents and Settings\\wtc\\Application Data\\Mozilla\\Firefox\\Profiles\\default.7tt' certPrefix='' keyPrefix='' secmod='secmod.db' flags=optimizeSpace  manufacturerID='Mozilla.org' libraryDescription='PSM Internal Crypto Services' cryptoTokenDescription='Generic Crypto Services' dbTokenDescription='Software Security Device' cryptoSlotDescription='PSM Internal Cryptographic Services' dbSlotDescription='PSM Private Keys' FIPSSlotDescription='PSM Internal FIPS-140-1 Cryptographic Services' FIPSTokenDescription='PSM FIPS-140-1 User Private Key Services' minPS=0"

See PKCS #11 Module Specs for complete documentation of the library parameters string.

Return value

FC_Initialize returns the following return codes.

Examples

#include <assert.h>

CK_FUNCTION_LIST_PTR pFunctionList;
CK_RV crv;
CK_C_INITIALIZE_ARGS initArgs;

crv = FC_GetFunctionList(&pFunctionList);
assert(crv == CKR_OK);

initArgs.CreateMutex = NULL;
initArgs.DestroyMutex = NULL;
initArgs.LockMutex = NULL;
initArgs.UnlockMutex = NULL;
initArgs.flags = CKF_OS_LOCKING_OK;
initArgs.LibraryParameters = "...";
initArgs.pReserved = NULL;

/* invoke FC_Initialize as pFunctionList->C_Initialize */
crv = pFunctionList->C_Initialize(&initArgs);

See also