Skip to content

Commit

Permalink
nss: make reproducible (#102156)
Browse files Browse the repository at this point in the history
According to
https://hg.mozilla.org/projects/nss/file/c1fad130dce2081a5d6ce9f539c72d999f59afce/build.sh#l129
the FIPS mode is not enabled by default. Yet we generate the .chk files
that are only meant to be used for that mode. I have a sense that those
have been cargo-culted around.

Adding FIPS is still possible but you have to explictily build the lib
with `pkgs.nss.override { enableFIPS = true; }`

More info on what FIPS is:
https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/NSS_Tech_Notes/nss_tech_note6

Other distros wrangling with the same issue:
https://bugzilla.opensuse.org/show_bug.cgi?id=1081723
  • Loading branch information
zimbatm authored Oct 31, 2020
1 parent 6a17829 commit 8f2be9a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions pkgs/development/libraries/nss/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{ stdenv, fetchurl, nspr, perl, zlib, sqlite, darwin, fixDarwinDylibNames, buildPackages, ninja }:
{ stdenv, fetchurl, nspr, perl, zlib, sqlite, darwin, fixDarwinDylibNames, buildPackages, ninja
, # allow FIPS mode. Note that this makes the output non-reproducible.
# https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/NSS_Tech_Notes/nss_tech_note6
enableFIPS ? false
}:

let
nssPEM = fetchurl {
Expand Down Expand Up @@ -83,6 +87,7 @@ in stdenv.mkDerivation rec {
-Dhost_arch=${host} \
-Duse_system_zlib=1 \
--enable-libpkix \
${stdenv.lib.optionalString enableFIPS "--enable-fips"} \
${stdenv.lib.optionalString stdenv.isDarwin "--clang"} \
${stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "--disable-tests"}
Expand Down Expand Up @@ -128,7 +133,8 @@ in stdenv.mkDerivation rec {
postFixup = let
isCross = stdenv.hostPlatform != stdenv.buildPlatform;
nss = if isCross then buildPackages.nss.tools else "$out";
in ''
in
(stdenv.lib.optionalString enableFIPS ''
for libname in freebl3 nssdbm3 softokn3
do '' +
(if stdenv.isDarwin
Expand All @@ -141,7 +147,8 @@ in stdenv.mkDerivation rec {
'') + ''
${nss}/bin/shlibsign -v -i "$libfile"
done
'') +
''
moveToOutput bin "$tools"
moveToOutput bin/nss-config "$dev"
moveToOutput lib/libcrmf.a "$dev" # needed by firefox, for example
Expand Down

0 comments on commit 8f2be9a

Please sign in to comment.