andre@3: /* andre@3: * NSS utility functions andre@3: * andre@3: * This Source Code Form is subject to the terms of the Mozilla Public andre@3: * License, v. 2.0. If a copy of the MPL was not distributed with this andre@3: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ andre@3: andre@3: #include "lowkeyi.h" andre@3: #include "pcert.h" andre@3: #include "keydbi.h" andre@3: #include "lgdb.h" andre@3: #include "secoid.h" andre@3: #include "prenv.h" andre@3: #include "softkver.h" andre@3: andre@3: /* Library identity and versioning */ andre@3: andre@3: #if defined(DEBUG) andre@3: #define _DEBUG_STRING " (debug)" andre@3: #else andre@3: #define _DEBUG_STRING "" andre@3: #endif andre@3: andre@3: /* andre@3: * Version information for the 'ident' and 'what commands andre@3: * andre@3: * NOTE: the first component of the concatenated rcsid string andre@3: * must not end in a '$' to prevent rcs keyword substitution. andre@3: */ andre@3: const char __nss_dbm_rcsid[] = "$Header: NSS " SOFTOKEN_VERSION _DEBUG_STRING andre@3: " " __DATE__ " " __TIME__ " $"; andre@3: const char __nss_dbm_sccsid[] = "@(#)NSS " SOFTOKEN_VERSION _DEBUG_STRING andre@3: " " __DATE__ " " __TIME__; andre@3: andre@3: typedef struct LGPrivateStr { andre@3: NSSLOWCERTCertDBHandle *certDB; andre@3: NSSLOWKEYDBHandle *keyDB; andre@3: PRLock *dbLock; andre@3: PLHashTable *hashTable; andre@3: } LGPrivate; andre@3: andre@3: static char * andre@3: lg_certdb_name_cb(void *arg, int dbVersion) andre@3: { andre@3: const char *configdir = (const char *)arg; andre@3: const char *dbver; andre@3: char *smpname = NULL; andre@3: char *dbname = NULL; andre@3: andre@3: switch (dbVersion) { andre@3: case 8: andre@3: dbver = "8"; andre@3: break; andre@3: case 7: andre@3: dbver = "7"; andre@3: break; andre@3: case 6: andre@3: dbver = "6"; andre@3: break; andre@3: case 5: andre@3: dbver = "5"; andre@3: break; andre@3: case 4: andre@3: default: andre@3: dbver = ""; andre@3: break; andre@3: } andre@3: andre@3: /* make sure we return something allocated with PORT_ so we have properly andre@3: * matched frees at the end */ andre@3: smpname = PR_smprintf(CERT_DB_FMT, configdir, dbver); andre@3: if (smpname) { andre@3: dbname = PORT_Strdup(smpname); andre@3: PR_smprintf_free(smpname); andre@3: } andre@3: return dbname; andre@3: } andre@3: andre@3: static char * andre@3: lg_keydb_name_cb(void *arg, int dbVersion) andre@3: { andre@3: const char *configdir = (const char *)arg; andre@3: const char *dbver; andre@3: char *smpname = NULL; andre@3: char *dbname = NULL; andre@3: andre@3: switch (dbVersion) { andre@3: case 4: andre@3: dbver = "4"; andre@3: break; andre@3: case 3: andre@3: dbver = "3"; andre@3: break; andre@3: case 1: andre@3: dbver = "1"; andre@3: break; andre@3: case 2: andre@3: default: andre@3: dbver = ""; andre@3: break; andre@3: } andre@3: andre@3: smpname = PR_smprintf(KEY_DB_FMT, configdir, dbver); andre@3: if (smpname) { andre@3: dbname = PORT_Strdup(smpname); andre@3: PR_smprintf_free(smpname); andre@3: } andre@3: return dbname; andre@3: } andre@3: andre@3: const char * andre@3: lg_EvaluateConfigDir(const char *configdir,char **appName) andre@3: { andre@3: if (PORT_Strncmp(configdir, MULTIACCESS, sizeof(MULTIACCESS)-1) == 0) { andre@3: char *cdir; andre@3: andre@3: *appName = PORT_Strdup(configdir+sizeof(MULTIACCESS)-1); andre@3: if (*appName == NULL) { andre@3: return configdir; andre@3: } andre@3: cdir = *appName; andre@3: while (*cdir && *cdir != ':') { andre@3: cdir++; andre@3: } andre@3: if (*cdir == ':') { andre@3: *cdir = 0; andre@3: cdir++; andre@3: } andre@3: configdir = cdir; andre@3: } andre@3: return configdir; andre@3: } andre@3: andre@3: static int rdbmapflags(int flags); andre@3: static rdbfunc lg_rdbfunc = NULL; andre@3: static rdbstatusfunc lg_rdbstatusfunc = NULL; andre@3: andre@3: /* NOTE: SHLIB_SUFFIX is defined on the command line */ andre@3: #define RDBLIB SHLIB_PREFIX"rdb."SHLIB_SUFFIX andre@3: andre@3: DB * rdbopen(const char *appName, const char *prefix, andre@3: const char *type, int flags, int *status) andre@3: { andre@3: PRLibrary *lib; andre@3: DB *db; andre@3: char *disableUnload = NULL; andre@3: andre@3: if (lg_rdbfunc) { andre@3: db = (*lg_rdbfunc)(appName,prefix,type,rdbmapflags(flags)); andre@3: if (!db && status && lg_rdbstatusfunc) { andre@3: *status = (*lg_rdbstatusfunc)(); andre@3: } andre@3: return db; andre@3: } andre@3: andre@3: /* andre@3: * try to open the library. andre@3: */ andre@3: lib = PR_LoadLibrary(RDBLIB); andre@3: andre@3: if (!lib) { andre@3: return NULL; andre@3: } andre@3: andre@3: /* get the entry points */ andre@3: lg_rdbstatusfunc = (rdbstatusfunc) PR_FindSymbol(lib,"rdbstatus"); andre@3: lg_rdbfunc = (rdbfunc) PR_FindSymbol(lib,"rdbopen"); andre@3: if (lg_rdbfunc) { andre@3: db = (*lg_rdbfunc)(appName,prefix,type,rdbmapflags(flags)); andre@3: if (!db && status && lg_rdbstatusfunc) { andre@3: *status = (*lg_rdbstatusfunc)(); andre@3: } andre@3: return db; andre@3: } andre@3: andre@3: /* couldn't find the entry point, unload the library and fail */ andre@3: disableUnload = PR_GetEnv("NSS_DISABLE_UNLOAD"); andre@3: if (!disableUnload) { andre@3: PR_UnloadLibrary(lib); andre@3: } andre@3: return NULL; andre@3: } andre@3: andre@3: /* andre@3: * the following data structures are from rdb.h. andre@3: */ andre@3: struct RDBStr { andre@3: DB db; andre@3: int (*xactstart)(DB *db); andre@3: int (*xactdone)(DB *db, PRBool abort); andre@3: int version; andre@3: int (*dbinitcomplete)(DB *db); andre@3: }; andre@3: andre@3: #define DB_RDB ((DBTYPE) 0xff) andre@3: #define RDB_RDONLY 1 andre@3: #define RDB_RDWR 2 andre@3: #define RDB_CREATE 4 andre@3: andre@3: static int andre@3: rdbmapflags(int flags) { andre@3: switch (flags) { andre@3: case NO_RDONLY: andre@3: return RDB_RDONLY; andre@3: case NO_RDWR: andre@3: return RDB_RDWR; andre@3: case NO_CREATE: andre@3: return RDB_CREATE; andre@3: default: andre@3: break; andre@3: } andre@3: return 0; andre@3: } andre@3: andre@3: PRBool andre@3: db_IsRDB(DB *db) andre@3: { andre@3: return (PRBool) db->type == DB_RDB; andre@3: } andre@3: andre@3: int andre@3: db_BeginTransaction(DB *db) andre@3: { andre@3: struct RDBStr *rdb = (struct RDBStr *)db; andre@3: if (db->type != DB_RDB) { andre@3: return 0; andre@3: } andre@3: andre@3: return rdb->xactstart(db); andre@3: } andre@3: andre@3: int andre@3: db_FinishTransaction(DB *db, PRBool abort) andre@3: { andre@3: struct RDBStr *rdb = (struct RDBStr *)db; andre@3: if (db->type != DB_RDB) { andre@3: return 0; andre@3: } andre@3: andre@3: return rdb->xactdone(db, abort); andre@3: } andre@3: andre@3: static DB * andre@3: lg_getRawDB(SDB *sdb) andre@3: { andre@3: NSSLOWCERTCertDBHandle *certDB; andre@3: NSSLOWKEYDBHandle *keyDB; andre@3: andre@3: certDB = lg_getCertDB(sdb); andre@3: if (certDB) { andre@3: return certDB->permCertDB; andre@3: } andre@3: keyDB = lg_getKeyDB(sdb); andre@3: if (keyDB) { andre@3: return keyDB->db; andre@3: } andre@3: return NULL; andre@3: } andre@3: andre@3: CK_RV andre@3: lg_Begin(SDB *sdb) andre@3: { andre@3: DB *db = lg_getRawDB(sdb); andre@3: int ret; andre@3: andre@3: if (db == NULL) { andre@3: return CKR_GENERAL_ERROR; /* shouldn't happen */ andre@3: } andre@3: ret = db_BeginTransaction(db); andre@3: if (ret != 0) { andre@3: return CKR_GENERAL_ERROR; /* could happen */ andre@3: } andre@3: return CKR_OK; andre@3: } andre@3: andre@3: CK_RV andre@3: lg_Commit(SDB *sdb) andre@3: { andre@3: DB *db = lg_getRawDB(sdb); andre@3: int ret; andre@3: andre@3: if (db == NULL) { andre@3: return CKR_GENERAL_ERROR; /* shouldn't happen */ andre@3: } andre@3: ret = db_FinishTransaction(db, PR_FALSE); andre@3: if (ret != 0) { andre@3: return CKR_GENERAL_ERROR; /* could happen */ andre@3: } andre@3: return CKR_OK; andre@3: } andre@3: andre@3: CK_RV andre@3: lg_Abort(SDB *sdb) andre@3: { andre@3: DB *db = lg_getRawDB(sdb); andre@3: int ret; andre@3: andre@3: if (db == NULL) { andre@3: return CKR_GENERAL_ERROR; /* shouldn't happen */ andre@3: } andre@3: ret = db_FinishTransaction(db, PR_TRUE); andre@3: if (ret != 0) { andre@3: return CKR_GENERAL_ERROR; /* could happen */ andre@3: } andre@3: return CKR_OK; andre@3: } andre@3: andre@3: int andre@3: db_InitComplete(DB *db) andre@3: { andre@3: struct RDBStr *rdb = (struct RDBStr *)db; andre@3: if (db->type != DB_RDB) { andre@3: return 0; andre@3: } andre@3: /* we should have added a version number to the RDBS structure. Since we andre@3: * didn't, we detect that we have and 'extended' structure if the rdbstatus andre@3: * func exists */ andre@3: if (!lg_rdbstatusfunc) { andre@3: return 0; andre@3: } andre@3: andre@3: return rdb->dbinitcomplete(db); andre@3: } andre@3: andre@3: andre@3: andre@3: SECStatus andre@3: db_Copy(DB *dest,DB *src) andre@3: { andre@3: int ret; andre@3: DBT key,data; andre@3: ret = (*src->seq)(src, &key, &data, R_FIRST); andre@3: if (ret) { andre@3: return SECSuccess; andre@3: } andre@3: andre@3: do { andre@3: (void)(*dest->put)(dest,&key,&data, R_NOOVERWRITE); andre@3: } while ( (*src->seq)(src, &key, &data, R_NEXT) == 0); andre@3: (void)(*dest->sync)(dest,0); andre@3: andre@3: return SECSuccess; andre@3: } andre@3: andre@3: andre@3: static CK_RV andre@3: lg_OpenCertDB(const char * configdir, const char *prefix, PRBool readOnly, andre@3: NSSLOWCERTCertDBHandle **certdbPtr) andre@3: { andre@3: NSSLOWCERTCertDBHandle *certdb = NULL; andre@3: CK_RV crv = CKR_NETSCAPE_CERTDB_FAILED; andre@3: SECStatus rv; andre@3: char * name = NULL; andre@3: char * appName = NULL; andre@3: andre@3: if (prefix == NULL) { andre@3: prefix = ""; andre@3: } andre@3: andre@3: configdir = lg_EvaluateConfigDir(configdir, &appName); andre@3: andre@3: name = PR_smprintf("%s" PATH_SEPARATOR "%s",configdir,prefix); andre@3: if (name == NULL) goto loser; andre@3: andre@3: certdb = (NSSLOWCERTCertDBHandle*)PORT_ZAlloc(sizeof(NSSLOWCERTCertDBHandle)); andre@3: if (certdb == NULL) andre@3: goto loser; andre@3: andre@3: certdb->ref = 1; andre@3: /* fix when we get the DB in */ andre@3: rv = nsslowcert_OpenCertDB(certdb, readOnly, appName, prefix, andre@3: lg_certdb_name_cb, (void *)name, PR_FALSE); andre@3: if (rv == SECSuccess) { andre@3: crv = CKR_OK; andre@3: *certdbPtr = certdb; andre@3: certdb = NULL; andre@3: } andre@3: loser: andre@3: if (certdb) PR_Free(certdb); andre@3: if (name) PR_smprintf_free(name); andre@3: if (appName) PORT_Free(appName); andre@3: return crv; andre@3: } andre@3: andre@3: static CK_RV andre@3: lg_OpenKeyDB(const char * configdir, const char *prefix, PRBool readOnly, andre@3: NSSLOWKEYDBHandle **keydbPtr) andre@3: { andre@3: NSSLOWKEYDBHandle *keydb; andre@3: char * name = NULL; andre@3: char * appName = NULL; andre@3: andre@3: if (prefix == NULL) { andre@3: prefix = ""; andre@3: } andre@3: configdir = lg_EvaluateConfigDir(configdir, &appName); andre@3: andre@3: name = PR_smprintf("%s" PATH_SEPARATOR "%s",configdir,prefix); andre@3: if (name == NULL) andre@3: return CKR_HOST_MEMORY; andre@3: keydb = nsslowkey_OpenKeyDB(readOnly, appName, prefix, andre@3: lg_keydb_name_cb, (void *)name); andre@3: PR_smprintf_free(name); andre@3: if (appName) PORT_Free(appName); andre@3: if (keydb == NULL) andre@3: return CKR_NETSCAPE_KEYDB_FAILED; andre@3: *keydbPtr = keydb; andre@3: andre@3: return CKR_OK; andre@3: } andre@3: andre@3: /* andre@3: * Accessors for the private parts of the sdb structure. andre@3: */ andre@3: void andre@3: lg_DBLock(SDB *sdb) andre@3: { andre@3: LGPrivate *lgdb_p = (LGPrivate *)sdb->private; andre@3: SKIP_AFTER_FORK(PR_Lock(lgdb_p->dbLock)); andre@3: } andre@3: andre@3: void andre@3: lg_DBUnlock(SDB *sdb) andre@3: { andre@3: LGPrivate *lgdb_p = (LGPrivate *)sdb->private; andre@3: SKIP_AFTER_FORK(PR_Unlock(lgdb_p->dbLock)); andre@3: } andre@3: andre@3: PLHashTable * andre@3: lg_GetHashTable(SDB *sdb) andre@3: { andre@3: LGPrivate *lgdb_p = (LGPrivate *)sdb->private; andre@3: return lgdb_p->hashTable; andre@3: } andre@3: andre@3: NSSLOWCERTCertDBHandle * andre@3: lg_getCertDB(SDB *sdb) andre@3: { andre@3: LGPrivate *lgdb_p = (LGPrivate *)sdb->private; andre@3: andre@3: return lgdb_p->certDB; andre@3: } andre@3: andre@3: NSSLOWKEYDBHandle * andre@3: lg_getKeyDB(SDB *sdb) andre@3: { andre@3: LGPrivate *lgdb_p = (LGPrivate *)sdb->private; andre@3: andre@3: return lgdb_p->keyDB; andre@3: } andre@3: andre@3: PRBool lg_parentForkedAfterC_Initialize; andre@3: andre@3: void lg_SetForkState(PRBool forked) andre@3: { andre@3: lg_parentForkedAfterC_Initialize = forked; andre@3: } andre@3: andre@3: CK_RV andre@3: lg_Close(SDB *sdb) andre@3: { andre@3: LGPrivate *lgdb_p = (LGPrivate *)sdb->private; andre@3: lg_ClearTokenKeyHashTable(sdb); andre@3: if (lgdb_p) { andre@3: if (lgdb_p->certDB) { andre@3: nsslowcert_ClosePermCertDB(lgdb_p->certDB); andre@3: } else if (lgdb_p->keyDB) { andre@3: nsslowkey_CloseKeyDB(lgdb_p->keyDB); andre@3: } andre@3: if (lgdb_p->dbLock) { andre@3: SKIP_AFTER_FORK(PR_DestroyLock(lgdb_p->dbLock)); andre@3: } andre@3: if (lgdb_p->hashTable) { andre@3: PL_HashTableDestroy(lgdb_p->hashTable); andre@3: } andre@3: PORT_Free(lgdb_p); andre@3: } andre@3: PORT_Free(sdb); andre@3: return CKR_OK; andre@3: } andre@3: andre@3: static PLHashNumber andre@3: lg_HashNumber(const void *key) andre@3: { andre@3: return (PLHashNumber) key; andre@3: } andre@3: andre@3: PRIntn andre@3: lg_CompareValues(const void *v1, const void *v2) andre@3: { andre@3: PLHashNumber value1 = (PLHashNumber) v1; andre@3: PLHashNumber value2 = (PLHashNumber) v2; andre@3: return (value1 == value2); andre@3: } andre@3: andre@3: /* andre@3: * helper function to wrap a NSSLOWCERTCertDBHandle or a NSSLOWKEYDBHandle andre@3: * with and sdb structure. andre@3: */ andre@3: CK_RV andre@3: lg_init(SDB **pSdb, int flags, NSSLOWCERTCertDBHandle *certdbPtr, andre@3: NSSLOWKEYDBHandle *keydbPtr) andre@3: { andre@3: SDB *sdb = NULL; andre@3: LGPrivate *lgdb_p = NULL; andre@3: CK_RV error = CKR_HOST_MEMORY; andre@3: andre@3: *pSdb = NULL; andre@3: sdb = (SDB *) PORT_Alloc(sizeof(SDB)); andre@3: if (sdb == NULL) { andre@3: goto loser; andre@3: } andre@3: lgdb_p = (LGPrivate *) PORT_Alloc(sizeof(LGPrivate)); andre@3: if (lgdb_p == NULL) { andre@3: goto loser; andre@3: } andre@3: /* invariant fields */ andre@3: lgdb_p->certDB = certdbPtr; andre@3: lgdb_p->keyDB = keydbPtr; andre@3: lgdb_p->dbLock = PR_NewLock(); andre@3: if (lgdb_p->dbLock == NULL) { andre@3: goto loser; andre@3: } andre@3: lgdb_p->hashTable = PL_NewHashTable(64, lg_HashNumber, lg_CompareValues, andre@3: SECITEM_HashCompare, NULL, 0); andre@3: if (lgdb_p->hashTable == NULL) { andre@3: goto loser; andre@3: } andre@3: andre@3: sdb->private = lgdb_p; andre@3: sdb->version = 0; andre@3: /*sdb->sdb_type = SDB_LEGACY; */ andre@3: sdb->sdb_flags = flags; andre@3: sdb->app_private = NULL; andre@3: sdb->sdb_FindObjectsInit = lg_FindObjectsInit; andre@3: sdb->sdb_FindObjects = lg_FindObjects; andre@3: sdb->sdb_FindObjectsFinal = lg_FindObjectsFinal; andre@3: sdb->sdb_GetAttributeValue = lg_GetAttributeValue; andre@3: sdb->sdb_SetAttributeValue = lg_SetAttributeValue; andre@3: sdb->sdb_CreateObject = lg_CreateObject; andre@3: sdb->sdb_DestroyObject = lg_DestroyObject; andre@3: sdb->sdb_GetMetaData = lg_GetMetaData; andre@3: sdb->sdb_PutMetaData = lg_PutMetaData; andre@3: sdb->sdb_Begin = lg_Begin; andre@3: sdb->sdb_Commit = lg_Commit; andre@3: sdb->sdb_Abort = lg_Abort; andre@3: sdb->sdb_Reset = lg_Reset; andre@3: sdb->sdb_Close = lg_Close; andre@3: sdb->sdb_SetForkState = lg_SetForkState; andre@3: andre@3: *pSdb = sdb; andre@3: return CKR_OK; andre@3: andre@3: loser: andre@3: if (sdb) { andre@3: PORT_Free(sdb); andre@3: } andre@3: if (lgdb_p) { andre@3: if (lgdb_p->dbLock) { andre@3: PR_DestroyLock(lgdb_p->dbLock); andre@3: } andre@3: if (lgdb_p->hashTable) { andre@3: PL_HashTableDestroy(lgdb_p->hashTable); andre@3: } andre@3: PORT_Free(lgdb_p); andre@3: } andre@3: return error; andre@3: andre@3: } andre@3: andre@3: /* andre@3: * OK there are now lots of options here, lets go through them all: andre@3: * andre@3: * configdir - base directory where all the cert, key, and module datbases live. andre@3: * certPrefix - prefix added to the beginning of the cert database example: " andre@3: * "https-server1-" andre@3: * keyPrefix - prefix added to the beginning of the key database example: " andre@3: * "https-server1-" andre@3: * secmodName - name of the security module database (usually "secmod.db"). andre@3: * readOnly - Boolean: true if the databases are to be openned read only. andre@3: * nocertdb - Don't open the cert DB and key DB's, just initialize the andre@3: * Volatile certdb. andre@3: * nomoddb - Don't open the security module DB, just initialize the andre@3: * PKCS #11 module. andre@3: * forceOpen - Continue to force initializations even if the databases cannot andre@3: * be opened. andre@3: */ andre@3: CK_RV andre@3: legacy_Open(const char *configdir, const char *certPrefix, andre@3: const char *keyPrefix, int certVersion, int keyVersion, andre@3: int flags, SDB **certDB, SDB **keyDB) andre@3: { andre@3: CK_RV crv = CKR_OK; andre@3: SECStatus rv; andre@3: PRBool readOnly = (flags == SDB_RDONLY)? PR_TRUE: PR_FALSE; andre@3: volatile char c; /* force a reference that won't get optimized away */ andre@3: andre@3: c = __nss_dbm_rcsid[0] + __nss_dbm_sccsid[0]; andre@3: andre@3: rv = SECOID_Init(); andre@3: if (SECSuccess != rv) { andre@3: return CKR_DEVICE_ERROR; andre@3: } andre@3: nsslowcert_InitLocks(); andre@3: andre@3: if (keyDB) *keyDB = NULL; andre@3: if (certDB) *certDB = NULL; andre@3: andre@3: if (certDB) { andre@3: NSSLOWCERTCertDBHandle *certdbPtr; andre@3: andre@3: crv = lg_OpenCertDB(configdir, certPrefix, readOnly, &certdbPtr); andre@3: if (crv != CKR_OK) { andre@3: goto loser; andre@3: } andre@3: crv = lg_init(certDB, flags, certdbPtr, NULL); andre@3: if (crv != CKR_OK) { andre@3: nsslowcert_ClosePermCertDB(certdbPtr); andre@3: goto loser; andre@3: } andre@3: } andre@3: if (keyDB) { andre@3: NSSLOWKEYDBHandle *keydbPtr; andre@3: andre@3: crv = lg_OpenKeyDB(configdir, keyPrefix, readOnly, &keydbPtr); andre@3: if (crv != CKR_OK) { andre@3: goto loser; andre@3: } andre@3: crv = lg_init(keyDB, flags, NULL, keydbPtr); andre@3: if (crv != CKR_OK) { andre@3: nsslowkey_CloseKeyDB(keydbPtr); andre@3: goto loser; andre@3: } andre@3: if (certDB && *certDB) { andre@3: LGPrivate *lgdb_p = (LGPrivate *)(*certDB)->private; andre@3: lgdb_p->keyDB = keydbPtr; andre@3: } andre@3: } andre@3: andre@3: loser: andre@3: if (crv != CKR_OK) { andre@3: if (keyDB && *keyDB) { andre@3: lg_Close(*keyDB); andre@3: *keyDB = NULL; andre@3: } andre@3: if (certDB && *certDB) { andre@3: lg_Close(*certDB); andre@3: *certDB = NULL; andre@3: } andre@3: } andre@3: return crv; andre@3: } andre@3: andre@3: CK_RV andre@3: legacy_Shutdown(PRBool forked) andre@3: { andre@3: lg_SetForkState(forked); andre@3: nsslowcert_DestroyFreeLists(); andre@3: nsslowcert_DestroyGlobalLocks(); andre@3: SECOID_Shutdown(); andre@3: lg_SetForkState(PR_FALSE); andre@3: return CKR_OK; andre@3: } andre@3: