43 lines
1.0 KiB
Plaintext
43 lines
1.0 KiB
Plaintext
|
diff -up ./mozilla/security/nss/lib/freebl/nsslowhash.c.kernelfipsmode ./mozilla/security/nss/lib/freebl/nsslowhash.c
|
||
|
--- ./mozilla/security/nss/lib/freebl/nsslowhash.c.kernelfipsmode 2008-11-27 16:20:44.000000000 +0100
|
||
|
+++ ./mozilla/security/nss/lib/freebl/nsslowhash.c 2009-04-14 22:58:19.000000000 +0200
|
||
|
@@ -267,6 +267,27 @@ struct NSSLOWHASHContextStr {
|
||
|
|
||
|
};
|
||
|
|
||
|
+static int nsslow_GetFIPSEnabled(void) {
|
||
|
+#ifdef LINUX
|
||
|
+ FILE *f;
|
||
|
+ char d;
|
||
|
+ size_t size;
|
||
|
+
|
||
|
+ f = fopen("/proc/sys/crypto/fips_enabled", "r");
|
||
|
+ if (!f)
|
||
|
+ return 0;
|
||
|
+
|
||
|
+ size = fread(&d, 1, 1, f);
|
||
|
+ fclose(f);
|
||
|
+ if (size != 1)
|
||
|
+ return 0;
|
||
|
+ if (d != '1')
|
||
|
+ return 0;
|
||
|
+#endif
|
||
|
+ return 1;
|
||
|
+}
|
||
|
+
|
||
|
+
|
||
|
static int post = 0;
|
||
|
|
||
|
static NSSLOWInitContext dummyContext = { 0 };
|
||
|
@@ -284,7 +305,9 @@ NSSLOW_Init(void)
|
||
|
|
||
|
|
||
|
if (!post) {
|
||
|
- crv = freebl_fipsPowerUpSelfTest();
|
||
|
+ crv = CKR_OK;
|
||
|
+ if (nsslow_GetFIPSEnabled())
|
||
|
+ crv = freebl_fipsPowerUpSelfTest();
|
||
|
if (crv != CKR_OK) {
|
||
|
return NULL;
|
||
|
}
|