2c5bd7ba15
* bmo#1853737 - Updated code and commit ID for HACL* * bmo#1840510 - update ACVP fuzzed test vector: refuzzed with current NSS * bmo#1827303 - Softoken C_ calls should use system FIPS setting to select NSC_ or FC_ variants * bmo#1774659 - NSS needs a database tool that can dump the low level representation of the database * bmo#1852179 - declare string literals using char in pkixnames_tests.cpp * bmo#1852179 - avoid implicit conversion for ByteString * bmo#1818766 - update rust version for acvp docker * bmo#1852011 - Moving the init function of the mpi_ints before clean-up in ec.c * bmo#1615555 - P-256 ECDH and ECDSA from HACL* * bmo#1840510 - Add ACVP test vectors to the repository * bmo#1849077 - Stop relying on std::basic_string<uint8_t> * bmo#1847845 - Transpose the PPC_ABI check from Makefile to gyp - rebased patches - added nss-fips-test.patch to fix broken test * bmo#1849471 - Update zlib in NSS to 1.3. * bmo#1848183 - softoken: iterate hashUpdate calls for long inputs. * bmo#1813401 - regenerate NameConstraints test certificates (boo#1214980). OBS-URL: https://build.opensuse.org/package/show/mozilla:Factory/mozilla-nss?expand=0&rev=428
85 lines
2.5 KiB
Diff
85 lines
2.5 KiB
Diff
# HG changeset patch
|
|
# User M. Sirringhaus <msirringhaus@suse.de>
|
|
# Date 1584305671 -3600
|
|
# Sun Mar 15 21:54:31 2020 +0100
|
|
# Node ID 715834d4a258c535f3abbf116d69d5e77392593b
|
|
# Parent 4ddd7d49eeed4ea32850daf41a472ccb50dee45e
|
|
commit facacdb9078693d7a4219e84f73ea7b8f977ddc2
|
|
Author: Hans Petter Jansson <hpj@cl.no>
|
|
Patch 32: nss-fips-detect-fips-mode-fixes.patch
|
|
|
|
Index: nss/lib/freebl/nsslowhash.c
|
|
===================================================================
|
|
--- nss.orig/lib/freebl/nsslowhash.c
|
|
+++ nss/lib/freebl/nsslowhash.c
|
|
@@ -2,9 +2,13 @@
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
+#define _GNU_SOURCE 1
|
|
+#include <stdlib.h>
|
|
+
|
|
#ifdef FREEBL_NO_DEPEND
|
|
#include "stubs.h"
|
|
#endif
|
|
+
|
|
#include "prtypes.h"
|
|
#include "prenv.h"
|
|
#include "secerr.h"
|
|
@@ -27,6 +31,22 @@ struct NSSLOWHASHContextStr {
|
|
static NSSLOWInitContext dummyContext = { 0 };
|
|
static PRBool post_failed = PR_TRUE;
|
|
|
|
+static PRBool
|
|
+getFIPSEnv(void)
|
|
+{
|
|
+ char *fipsEnv = secure_getenv("NSS_FIPS");
|
|
+ if (!fipsEnv) {
|
|
+ return PR_FALSE;
|
|
+ }
|
|
+ if ((strcasecmp(fipsEnv, "fips") == 0) ||
|
|
+ (strcasecmp(fipsEnv, "true") == 0) ||
|
|
+ (strcasecmp(fipsEnv, "on") == 0) ||
|
|
+ (strcasecmp(fipsEnv, "1") == 0)) {
|
|
+ return PR_TRUE;
|
|
+ }
|
|
+ return PR_FALSE;
|
|
+}
|
|
+
|
|
NSSLOWInitContext *
|
|
NSSLOW_Init(void)
|
|
{
|
|
@@ -37,7 +57,7 @@ NSSLOW_Init(void)
|
|
#ifndef NSS_FIPS_DISABLED
|
|
/* make sure the FIPS product is installed if we are trying to
|
|
* go into FIPS mode */
|
|
- if (NSS_GetSystemFIPSEnabled()) {
|
|
+ if (NSS_GetSystemFIPSEnabled() || getFIPSEnv()) {
|
|
if (BL_FIPSEntryOK(PR_TRUE, PR_FALSE) != SECSuccess) {
|
|
PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
|
|
post_failed = PR_TRUE;
|
|
Index: nss/lib/sysinit/nsssysinit.c
|
|
===================================================================
|
|
--- nss.orig/lib/sysinit/nsssysinit.c
|
|
+++ nss/lib/sysinit/nsssysinit.c
|
|
@@ -178,16 +178,16 @@ getFIPSMode(void)
|
|
f = fopen("/proc/sys/crypto/fips_enabled", "r");
|
|
if (!f) {
|
|
/* if we don't have a proc flag, fall back to the
|
|
- * environment variable */
|
|
+ * environment variable */
|
|
return getFIPSEnv();
|
|
}
|
|
|
|
size = fread(&d, 1, 1, f);
|
|
fclose(f);
|
|
if (size != 1)
|
|
- return PR_FALSE;
|
|
+ return getFIPSEnv();
|
|
if (d != '1')
|
|
- return PR_FALSE;
|
|
+ return getFIPSEnv();
|
|
return PR_TRUE;
|
|
#else
|
|
return PR_FALSE;
|