285d04
diff --git a/cmd/bltest/blapitest.c b/cmd/bltest/blapitest.c
285d04
--- a/cmd/bltest/blapitest.c
285d04
+++ b/cmd/bltest/blapitest.c
285d04
@@ -3870,17 +3870,17 @@ main(int argc, char **argv)
285d04
         rv = blapi_selftest(modesToTest, numModesToTest, inoff, outoff,
285d04
                             encrypt, decrypt);
285d04
         PORT_Free(cipherInfo);
285d04
         return rv == SECSuccess ? 0 : 1;
285d04
     }
285d04
 
285d04
     /* Do FIPS self-test */
285d04
     if (bltest.commands[cmd_FIPS].activated) {
285d04
-        CK_RV ckrv = sftk_FIPSEntryOK();
285d04
+        CK_RV ckrv = sftk_FIPSEntryOK(PR_FALSE);
285d04
         fprintf(stdout, "CK_RV: %ld.\n", ckrv);
285d04
         PORT_Free(cipherInfo);
285d04
         if (ckrv == CKR_OK)
285d04
             return SECSuccess;
285d04
         return SECFailure;
285d04
     }
285d04
 
285d04
     /*
285d04
diff --git a/cmd/pk11mode/pk11mode.c b/cmd/pk11mode/pk11mode.c
285d04
--- a/cmd/pk11mode/pk11mode.c
285d04
+++ b/cmd/pk11mode/pk11mode.c
285d04
@@ -318,23 +318,25 @@ static PRBool verbose = PR_FALSE;
285d04
 
285d04
 int
285d04
 main(int argc, char **argv)
285d04
 {
285d04
     CK_C_GetFunctionList pC_GetFunctionList;
285d04
     CK_FUNCTION_LIST_PTR pFunctionList;
285d04
     CK_RV crv = CKR_OK;
285d04
     CK_C_INITIALIZE_ARGS_NSS initArgs;
285d04
+    CK_C_INITIALIZE_ARGS_NSS initArgsRerun; /* rerun selftests */
285d04
     CK_SLOT_ID *pSlotList = NULL;
285d04
     CK_TOKEN_INFO tokenInfo;
285d04
     CK_ULONG slotID = 0; /* slotID == 0 for FIPSMODE */
285d04
 
285d04
     CK_UTF8CHAR *pwd = NULL;
285d04
     CK_ULONG pwdLen = 0;
285d04
     char *moduleSpec = NULL;
285d04
+    char *moduleSpecRerun = NULL;
285d04
     char *configDir = NULL;
285d04
     char *dbPrefix = NULL;
285d04
     char *disableUnload = NULL;
285d04
     PRBool doForkTests = PR_TRUE;
285d04
 
285d04
     PLOptStatus os;
285d04
     PLOptState *opt = PL_CreateOptState(argc, argv, "nvhf:Fd:p:");
285d04
     while (PL_OPT_EOL != (os = PL_GetNextOpt(opt))) {
285d04
@@ -458,18 +460,23 @@ main(int argc, char **argv)
285d04
     initArgs.CreateMutex = NULL;
285d04
     initArgs.DestroyMutex = NULL;
285d04
     initArgs.LockMutex = NULL;
285d04
     initArgs.UnlockMutex = NULL;
285d04
     initArgs.flags = CKF_OS_LOCKING_OK;
285d04
     moduleSpec = PR_smprintf("configdir='%s' certPrefix='%s' "
285d04
                              "keyPrefix='%s' secmod='secmod.db' flags= ",
285d04
                              configDir, dbPrefix, dbPrefix);
285d04
+    moduleSpecRerun = PR_smprintf("configdir='%s' certPrefix='%s' "
285d04
+                             "keyPrefix='%s' secmod='secmod.db' flags=forcePOST ",
285d04
+                             configDir, dbPrefix, dbPrefix);
285d04
     initArgs.LibraryParameters = (CK_CHAR_PTR *)moduleSpec;
285d04
     initArgs.pReserved = NULL;
285d04
+    initArgsRerun = initArgs;
285d04
+    initArgsRerun.LibraryParameters = (CK_CHAR_PTR *)moduleSpecRerun;
285d04
 
285d04
     /*DebugBreak();*/
285d04
     /* FIPSMODE invokes FC_Initialize as pFunctionList->C_Initialize */
285d04
     /* NSS cryptographic module library initialization for the FIPS  */
285d04
     /* Approved mode when FC_Initialize is envoked will perfom       */
285d04
     /* software integrity test, and power-up self-tests before       */
285d04
     /* FC_Initialize returns                                         */
285d04
     crv = pFunctionList->C_Initialize(&initArgs);
285d04
@@ -705,17 +712,17 @@ main(int argc, char **argv)
285d04
         PKM_Error("PKM_HybridMode failed with 0x%08X, %-26s\n", crv,
285d04
                   PKM_CK_RVtoStr(crv));
285d04
         goto cleanup;
285d04
     }
285d04
 
285d04
     if (doForkTests) {
285d04
         /* testing one more C_Initialize / C_Finalize to exercise getpid()
285d04
          * fork check code */
285d04
-        crv = pFunctionList->C_Initialize(&initArgs);
285d04
+        crv = pFunctionList->C_Initialize(&initArgsRerun);
285d04
         if (crv == CKR_OK) {
285d04
             PKM_LogIt("C_Initialize succeeded\n");
285d04
         } else {
285d04
             PKM_Error("C_Initialize failed with 0x%08X, %-26s\n", crv,
285d04
                       PKM_CK_RVtoStr(crv));
285d04
             goto cleanup;
285d04
         }
285d04
         crv = pFunctionList->C_Finalize(NULL);
285d04
@@ -741,16 +748,19 @@ cleanup:
285d04
         free(configDir);
285d04
     }
285d04
     if (dbPrefix) {
285d04
         free(dbPrefix);
285d04
     }
285d04
     if (moduleSpec) {
285d04
         PR_smprintf_free(moduleSpec);
285d04
     }
285d04
+    if (moduleSpecRerun) {
285d04
+        PR_smprintf_free(moduleSpecRerun);
285d04
+    }
285d04
 
285d04
 #ifdef _WIN32
285d04
     FreeLibrary(hModule);
285d04
 #else
285d04
     disableUnload = PR_GetEnvSecure("NSS_DISABLE_UNLOAD");
285d04
     if (!disableUnload) {
285d04
         PR_UnloadLibrary(lib);
285d04
     }
285d04
diff --git a/lib/freebl/blapii.h b/lib/freebl/blapii.h
285d04
--- a/lib/freebl/blapii.h
285d04
+++ b/lib/freebl/blapii.h
285d04
@@ -24,17 +24,17 @@ typedef SECStatus (*freeblAeadFunc)(void
285d04
                                     void *params, unsigned int paramsLen,
285d04
                                     const unsigned char *aad, unsigned int aadLen,
285d04
                                     unsigned int blocksize);
285d04
 typedef void (*freeblDestroyFunc)(void *cx, PRBool freeit);
285d04
 
285d04
 SEC_BEGIN_PROTOS
285d04
 
285d04
 #ifndef NSS_FIPS_DISABLED
285d04
-SECStatus BL_FIPSEntryOK(PRBool freeblOnly);
285d04
+SECStatus BL_FIPSEntryOK(PRBool freeblOnly, PRBool rerun);
285d04
 PRBool BL_POSTRan(PRBool freeblOnly);
285d04
 #endif
285d04
 
285d04
 #if defined(XP_UNIX) && !defined(NO_FORK_CHECK)
285d04
 
285d04
 extern PRBool bl_parentForkedAfterC_Initialize;
285d04
 
285d04
 #define SKIP_AFTER_FORK(x)                 \
285d04
diff --git a/lib/freebl/blapit.h b/lib/freebl/blapit.h
285d04
--- a/lib/freebl/blapit.h
285d04
+++ b/lib/freebl/blapit.h
285d04
@@ -223,16 +223,21 @@ typedef int __BLAPI_DEPRECATED __attribu
285d04
  *
285d04
  * If we arbitrarily set p = 10^-18 (1 chance in trillion trillion operation)
285d04
  * we get GCMIV_RANDOM_BIRTHDAY_BITS = -(-18)/.301 -1 = 59 (.301 = log10 2)
285d04
  * GCMIV_RANDOM_BIRTHDAY_BITS should be at least 59, call it a round 64. NOTE:
285d04
  * the variable IV size for TLS is 64 bits, which explains why it's not safe
285d04
  * to use a random value for the nonce in TLS. */
285d04
 #define GCMIV_RANDOM_BIRTHDAY_BITS 64
285d04
 
285d04
+/* flag to tell BLAPI_Verify* to rerun the post and integrity tests */
285d04
+#define BLAPI_FIPS_RERUN_FLAG '\377'  /* 0xff, 255 invalide code for UFT8/ASCII */
285d04
+#define BLAPI_FIPS_RERUN_FLAG_STRING "\377"  /* The above as a C string */
285d04
+
285d04
+
285d04
 /***************************************************************************
285d04
 ** Opaque objects
285d04
 */
285d04
 
285d04
 struct DESContextStr;
285d04
 struct RC2ContextStr;
285d04
 struct RC4ContextStr;
285d04
 struct RC5ContextStr;
285d04
diff --git a/lib/freebl/fipsfreebl.c b/lib/freebl/fipsfreebl.c
285d04
--- a/lib/freebl/fipsfreebl.c
285d04
+++ b/lib/freebl/fipsfreebl.c
285d04
@@ -2211,29 +2211,37 @@ bl_startup_tests(void)
285d04
 }
285d04
 
285d04
 /*
285d04
  * this is called from the freebl init entry points that controll access to
285d04
  * all other freebl functions. This prevents freebl from operating if our
285d04
  * power on selftest failed.
285d04
  */
285d04
 SECStatus
285d04
-BL_FIPSEntryOK(PRBool freebl_only)
285d04
+BL_FIPSEntryOK(PRBool freebl_only, PRBool rerun)
285d04
 {
285d04
 #ifdef NSS_NO_INIT_SUPPORT
285d04
     /* this should only be set on platforms that can't handle one of the INIT
285d04
     * schemes.  This code allows those platforms to continue to function,
285d04
     * though they don't meet the strict NIST requirements. If NSS_NO_INIT_SUPPORT
285d04
     * is not set, and init support has not been properly enabled, freebl
285d04
     * will always fail because of the test below
285d04
     */
285d04
     if (!self_tests_freebl_ran) {
285d04
         bl_startup_tests();
285d04
     }
285d04
 #endif
285d04
+    if (rerun) {
285d04
+        /* reset the flags */
285d04
+        self_tests_freebl_ran = PR_FALSE;
285d04
+        self_tests_success = PR_FALSE;
285d04
+        self_tests_success = PR_FALSE;
285d04
+        self_tests_freebl_success = PR_FALSE;
285d04
+        bl_startup_tests();
285d04
+    }
285d04
     /* if the general self tests succeeded, we're done */
285d04
     if (self_tests_success) {
285d04
         return SECSuccess;
285d04
     }
285d04
     /* standalone freebl can initialize */
285d04
     if (freebl_only && self_tests_freebl_success) {
285d04
         return SECSuccess;
285d04
     }
285d04
diff --git a/lib/freebl/nsslowhash.c b/lib/freebl/nsslowhash.c
285d04
--- a/lib/freebl/nsslowhash.c
285d04
+++ b/lib/freebl/nsslowhash.c
285d04
@@ -55,17 +55,17 @@ NSSLOW_Init(void)
285d04
 #ifdef FREEBL_NO_DEPEND
285d04
     (void)FREEBL_InitStubs();
285d04
 #endif
285d04
 
285d04
 #ifndef NSS_FIPS_DISABLED
285d04
     /* make sure the FIPS product is installed if we are trying to
285d04
      * go into FIPS mode */
285d04
     if (nsslow_GetFIPSEnabled()) {
285d04
-        if (BL_FIPSEntryOK(PR_TRUE) != SECSuccess) {
285d04
+        if (BL_FIPSEntryOK(PR_TRUE, PR_FALSE) != SECSuccess) {
285d04
             PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
285d04
             post_failed = PR_TRUE;
285d04
             return NULL;
285d04
         }
285d04
     }
285d04
 #endif
285d04
     post_failed = PR_FALSE;
285d04
 
285d04
diff --git a/lib/freebl/shvfy.c b/lib/freebl/shvfy.c
285d04
--- a/lib/freebl/shvfy.c
285d04
+++ b/lib/freebl/shvfy.c
285d04
@@ -282,52 +282,62 @@ readItem(PRFileDesc *fd, SECItem *item)
285d04
         PORT_Free(item->data);
285d04
         item->data = NULL;
285d04
         item->len = 0;
285d04
         return SECFailure;
285d04
     }
285d04
     return SECSuccess;
285d04
 }
285d04
 
285d04
-static PRBool blapi_SHVerifyFile(const char *shName, PRBool self);
285d04
+static PRBool blapi_SHVerifyFile(const char *shName, PRBool self, PRBool rerun);
285d04
 
285d04
 static PRBool
285d04
-blapi_SHVerify(const char *name, PRFuncPtr addr, PRBool self)
285d04
+blapi_SHVerify(const char *name, PRFuncPtr addr, PRBool self, PRBool rerun)
285d04
 {
285d04
     PRBool result = PR_FALSE; /* if anything goes wrong,
285d04
                    * the signature does not verify */
285d04
     /* find our shared library name */
285d04
     char *shName = PR_GetLibraryFilePathname(name, addr);
285d04
     if (!shName) {
285d04
         goto loser;
285d04
     }
285d04
-    result = blapi_SHVerifyFile(shName, self);
285d04
+    result = blapi_SHVerifyFile(shName, self, rerun);
285d04
 
285d04
 loser:
285d04
     if (shName != NULL) {
285d04
         PR_Free(shName);
285d04
     }
285d04
 
285d04
     return result;
285d04
 }
285d04
 
285d04
 PRBool
285d04
 BLAPI_SHVerify(const char *name, PRFuncPtr addr)
285d04
 {
285d04
-    return blapi_SHVerify(name, addr, PR_FALSE);
285d04
+    PRBool rerun = PR_FALSE;
285d04
+    if (name && *name == BLAPI_FIPS_RERUN_FLAG) {
285d04
+        name++;
285d04
+        rerun = PR_TRUE;
285d04
+    }
285d04
+    return blapi_SHVerify(name, addr, PR_FALSE, rerun);
285d04
 }
285d04
 
285d04
 PRBool
285d04
 BLAPI_SHVerifyFile(const char *shName)
285d04
 {
285d04
-    return blapi_SHVerifyFile(shName, PR_FALSE);
285d04
+    PRBool rerun = PR_FALSE;
285d04
+    if (shName && *shName == BLAPI_FIPS_RERUN_FLAG) {
285d04
+        shName++;
285d04
+        rerun = PR_TRUE;
285d04
+    }
285d04
+    return blapi_SHVerifyFile(shName, PR_FALSE, rerun);
285d04
 }
285d04
 
285d04
 static PRBool
285d04
-blapi_SHVerifyFile(const char *shName, PRBool self)
285d04
+blapi_SHVerifyFile(const char *shName, PRBool self, PRBool rerun)
285d04
 {
285d04
     char *checkName = NULL;
285d04
     PRFileDesc *checkFD = NULL;
285d04
     PRFileDesc *shFD = NULL;
285d04
     void *hashcx = NULL;
285d04
     const SECHashObject *hashObj = NULL;
285d04
     SECItem signature = { 0, NULL, 0 };
285d04
     SECItem hash;
285d04
@@ -346,17 +356,17 @@ blapi_SHVerifyFile(const char *shName, P
285d04
     unsigned char hashBuf[HASH_LENGTH_MAX];
285d04
 
285d04
     PORT_Memset(&key, 0, sizeof(key));
285d04
     hash.data = hashBuf;
285d04
     hash.len = sizeof(hashBuf);
285d04
 
285d04
     /* If our integrity check was never ran or failed, fail any other
285d04
      * integrity checks to prevent any token going into FIPS mode. */
285d04
-    if (!self && (BL_FIPSEntryOK(PR_FALSE) != SECSuccess)) {
285d04
+    if (!self && (BL_FIPSEntryOK(PR_FALSE, rerun) != SECSuccess)) {
285d04
         return PR_FALSE;
285d04
     }
285d04
 
285d04
     if (!shName) {
285d04
         goto loser;
285d04
     }
285d04
 
285d04
     /* figure out the name of our check file */
285d04
@@ -536,17 +546,17 @@ BLAPI_VerifySelf(const char *name)
285d04
 {
285d04
     if (name == NULL) {
285d04
         /*
285d04
          * If name is NULL, freebl is statically linked into softoken.
285d04
          * softoken will call BLAPI_SHVerify next to verify itself.
285d04
          */
285d04
         return PR_TRUE;
285d04
     }
285d04
-    return blapi_SHVerify(name, (PRFuncPtr)decodeInt, PR_TRUE);
285d04
+    return blapi_SHVerify(name, (PRFuncPtr)decodeInt, PR_TRUE, PR_FALSE);
285d04
 }
285d04
 
285d04
 #else /* NSS_FIPS_DISABLED */
285d04
 
285d04
 PRBool
285d04
 BLAPI_SHVerifyFile(const char *shName)
285d04
 {
285d04
     return PR_FALSE;
285d04
diff --git a/lib/softoken/fipstest.c b/lib/softoken/fipstest.c
285d04
--- a/lib/softoken/fipstest.c
285d04
+++ b/lib/softoken/fipstest.c
285d04
@@ -684,22 +684,25 @@ sftk_fips_HKDF_PowerUpSelfTest(void)
285d04
 
285d04
 static PRBool sftk_self_tests_ran = PR_FALSE;
285d04
 static PRBool sftk_self_tests_success = PR_FALSE;
285d04
 
285d04
 /*
285d04
  * This function is called at dll load time, the code tha makes this
285d04
  * happen is platform specific on defined above.
285d04
  */
285d04
-static void
285d04
-sftk_startup_tests(void)
285d04
+void sftk_startup_tests_with_rerun(PRBool rerun)
285d04
 {
285d04
     SECStatus rv;
285d04
-    const char *libraryName = SOFTOKEN_LIB_NAME;
285d04
-
285d04
+    /*const char *nlibraryName = SOFTOKEN_LIB_NAME;
285d04
+    const char *rlibraryName = BLAPI_FIPS_RERUN_FLAG_STRING SOFTOKEN_LIB_NAME; */
285d04
+    const char *libraryName = rerun ?
285d04
+               BLAPI_FIPS_RERUN_FLAG_STRING SOFTOKEN_LIB_NAME :
285d04
+               SOFTOKEN_LIB_NAME;
285d04
+    
285d04
     PORT_Assert(!sftk_self_tests_ran);
285d04
     PORT_Assert(!sftk_self_tests_success);
285d04
     sftk_self_tests_ran = PR_TRUE;
285d04
     sftk_self_tests_success = PR_FALSE; /* just in case */
285d04
 
285d04
     /* need to initiallize the oid library before the RSA tests */
285d04
     rv = SECOID_Init();
285d04
     if (rv != SECSuccess) {
285d04
@@ -746,35 +749,46 @@ sftk_startup_tests(void)
285d04
     rv = sftk_fips_pbkdf_PowerUpSelfTests();
285d04
     if (rv != SECSuccess) {
285d04
         return;
285d04
     }
285d04
 
285d04
     sftk_self_tests_success = PR_TRUE;
285d04
 }
285d04
 
285d04
+static void
285d04
+sftk_startup_tests(void)
285d04
+{
285d04
+    sftk_startup_tests_with_rerun(PR_FALSE);
285d04
+}
285d04
+
285d04
 /*
285d04
  * this is called from nsc_Common_Initizialize entry points that gates access
285d04
  * to * all other pkcs11 functions. This prevents softoken operation if our
285d04
  * power on selftest failed.
285d04
  */
285d04
 CK_RV
285d04
-sftk_FIPSEntryOK()
285d04
+sftk_FIPSEntryOK(PRBool rerun)
285d04
 {
285d04
 #ifdef NSS_NO_INIT_SUPPORT
285d04
     /* this should only be set on platforms that can't handle one of the INIT
285d04
      * schemes.  This code allows those platforms to continue to function,
285d04
      * though they don't meet the strict NIST requirements. If NSS_NO_INIT_SUPPORT
285d04
      * is not set, and init support has not been properly enabled, softken
285d04
      * will always fail because of the test below
285d04
      */
285d04
     if (!sftk_self_tests_ran) {
285d04
         sftk_startup_tests();
285d04
     }
285d04
 #endif
285d04
+    if (rerun) {
285d04
+        sftk_self_tests_ran = PR_FALSE;
285d04
+        sftk_self_tests_success = PR_FALSE;
285d04
+        sftk_startup_tests_with_rerun(PR_TRUE);
285d04
+    }
285d04
     if (!sftk_self_tests_success) {
285d04
         return CKR_DEVICE_ERROR;
285d04
     }
285d04
     return CKR_OK;
285d04
 }
285d04
 #else
285d04
 #include "pkcs11t.h"
285d04
 CK_RV
285d04
diff --git a/lib/softoken/fipstokn.c b/lib/softoken/fipstokn.c
285d04
--- a/lib/softoken/fipstokn.c
285d04
+++ b/lib/softoken/fipstokn.c
285d04
@@ -524,25 +524,32 @@ fc_log_init_error(CK_RV crv)
285d04
 }
285d04
 
285d04
 /* FC_Initialize initializes the PKCS #11 library. */
285d04
 CK_RV
285d04
 FC_Initialize(CK_VOID_PTR pReserved)
285d04
 {
285d04
     const char *envp;
285d04
     CK_RV crv;
285d04
+    PRBool rerun;
285d04
 
285d04
     if ((envp = PR_GetEnv("NSS_ENABLE_AUDIT")) != NULL) {
285d04
         sftk_audit_enabled = (atoi(envp) == 1);
285d04
     }
285d04
 
285d04
+    /* if we have the forcePOST flag on, rerun the integrity checks */
285d04
+    /* we need to know this before we fully parse the arguments in
285d04
+     * nsc_CommonInitialize, so read it now */
285d04
+    rerun = sftk_RawArgHasFlag("flags", "forcePost", pReserved);
285d04
+
285d04
     /* At this point we should have already done post and integrity checks.
285d04
      * if we haven't, it probably means the FIPS product has not been installed
285d04
-     * or the tests failed. Don't let an application try to enter FIPS mode */
285d04
-    crv = sftk_FIPSEntryOK();
285d04
+     * or the tests failed. Don't let an application try to enter FIPS mode. This
285d04
+     * also forces the tests to be rerun if forcePOST is set. */
285d04
+    crv = sftk_FIPSEntryOK(rerun);
285d04
     if (crv != CKR_OK) {
285d04
         sftk_fatalError = PR_TRUE;
285d04
         fc_log_init_error(crv);
285d04
         return crv;
285d04
     }
285d04
 
285d04
     sftk_ForkReset(pReserved, &crv;;
285d04
 
285d04
diff --git a/lib/softoken/pkcs11i.h b/lib/softoken/pkcs11i.h
285d04
--- a/lib/softoken/pkcs11i.h
285d04
+++ b/lib/softoken/pkcs11i.h
285d04
@@ -869,16 +869,17 @@ extern CK_RV sftk_MechAllowsOperation(CK
285d04
  * acquiring a reference to the keydb from the slot */
285d04
 NSSLOWKEYPrivateKey *sftk_FindKeyByPublicKey(SFTKSlot *slot, SECItem *dbKey);
285d04
 
285d04
 /*
285d04
  * parameter parsing functions
285d04
  */
285d04
 CK_RV sftk_parseParameters(char *param, sftk_parameters *parsed, PRBool isFIPS);
285d04
 void sftk_freeParams(sftk_parameters *params);
285d04
+PRBool sftk_RawArgHasFlag(const char *entry, const char *flag, const void *pReserved);
285d04
 
285d04
 /*
285d04
  * narrow objects
285d04
  */
285d04
 SFTKSessionObject *sftk_narrowToSessionObject(SFTKObject *);
285d04
 SFTKTokenObject *sftk_narrowToTokenObject(SFTKObject *);
285d04
 
285d04
 /*
285d04
diff --git a/lib/softoken/sftkpars.c b/lib/softoken/sftkpars.c
285d04
--- a/lib/softoken/sftkpars.c
285d04
+++ b/lib/softoken/sftkpars.c
285d04
@@ -244,8 +244,21 @@ sftk_freeParams(sftk_parameters *params)
285d04
     FREE_CLEAR(params->configdir);
285d04
     FREE_CLEAR(params->secmodName);
285d04
     FREE_CLEAR(params->man);
285d04
     FREE_CLEAR(params->libdes);
285d04
     FREE_CLEAR(params->tokens);
285d04
     FREE_CLEAR(params->updatedir);
285d04
     FREE_CLEAR(params->updateID);
285d04
 }
285d04
+
285d04
+PRBool
285d04
+sftk_RawArgHasFlag(const char *entry, const char *flag, const void *pReserved)
285d04
+{
285d04
+    CK_C_INITIALIZE_ARGS *init_args = (CK_C_INITIALIZE_ARGS *)pReserved;
285d04
+
285d04
+    /* if we don't have any params, the flag isn't set */
285d04
+    if ((!init_args || !init_args->LibraryParameters)) {
285d04
+        return PR_FALSE;
285d04
+    }
285d04
+
285d04
+    return NSSUTIL_ArgHasFlag(entry, flag, (const char *)init_args->LibraryParameters);
285d04
+}
285d04
diff --git a/lib/softoken/softoken.h b/lib/softoken/softoken.h
285d04
--- a/lib/softoken/softoken.h
285d04
+++ b/lib/softoken/softoken.h
285d04
@@ -52,17 +52,17 @@ extern unsigned char *CBC_PadBuffer(PLAr
285d04
                                     unsigned int inlen, unsigned int *outlen,
285d04
                                     int blockSize);
285d04
 
285d04
 /****************************************/
285d04
 /*
285d04
 ** Power-Up selftests are required for FIPS.
285d04
 */
285d04
 /* make sure Power-up selftests have been run. */
285d04
-extern CK_RV sftk_FIPSEntryOK(void);
285d04
+extern CK_RV sftk_FIPSEntryOK(PRBool rerun);
285d04
 
285d04
 /*
285d04
 ** make known fixed PKCS #11 key types to their sizes in bytes
285d04
 */
285d04
 unsigned long sftk_MapKeySize(CK_KEY_TYPE keyType);
285d04
 
285d04
 /*
285d04
 ** FIPS 140-2 auditing