Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

101.19. nss-3.130

Mozilla Network Security Services — TLS, PKCS #11 and certificate libraries

Version 3.130, release 1
Shelf crypto — Cryptographic libraries, PKCS#11, smartcards and TPM
Phase 41_system (System), 327 of 1047 in build order
Licence MPL-2.0
Homepage https://firefox-source-docs.mozilla.org/security/nss/index.html
Build time 0.7 SBU
Installed size 8.1 MiB in 277 files
Recipe ports/core/crypto/nss/kpkgbuild

About

NSS, Mozilla’s Network Security Services, is the TLS, PKCS #11 and certificate library of the Mozilla programs: firefox-esr, librewolf and thunderbird build on it. chromium and qt6-qtwebengine, whose TLS is BoringSSL, use it for the user’s certificate and key database and for PKCS #11 tokens, and libreoffice’s signing, volume_key and libcacard build on it too. It runs on nspr and keeps certificate databases in SQLite. The port installs the libraries, the headers, nss.pc and nss-config, and the tools certutil, cmsutil, crlutil, modutil, pk12util, signtool, signver and ssltap.

Sources

Dependencies

Depends on: nspr, sqlite, zlib, p11-kit.

Required by (9): chromium, firefox-esr, libblockdev, libcacard, libreoffice, librewolf, qt6-qtwebengine, thunderbird, volume_key.

Patches

build.sh applies these; kpkg applies nothing by itself.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install nss'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/crypto/nss.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/crypto/nss
echo 'afab9f82c78bfa3e7e8b4a61ac31922675c58203f67ff385a2714df7fe9bd5c5  nss-3.130.tar.gz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/nss
SRC=$SRC_ROOT/nss-3.130
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf nss-3.130.tar.gz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the recipe’s helpers _tag and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

patch -p1 -i "$PORT_SRC/nss-standalone.patch"

cd nss
make BUILD_OPT=1 USE_64=1 \
	NSPR_INCLUDE_DIR=/usr/include/nspr \
	USE_SYSTEM_ZLIB=1 ZLIB_LIBS=-lz \
	NSS_USE_SYSTEM_SQLITE=1 \
	NSS_ENABLE_WERROR=0 \
	NSS_DISABLE_GTESTS=1 \
	DSO_LDOPTS="-shared -m64 -Wl,--gc-sections -Wl,-z,defs $LDFLAGS" \
	XCFLAGS="$CFLAGS"

cd ../dist
install -d "$PKG/usr/lib/pkgconfig" "$PKG/usr/bin" "$PKG/usr/include/nss"
install -m755 Linux*/lib/*.so "$PKG/usr/lib/"
install -m644 Linux*/lib/*.chk "$PKG/usr/lib/"
cp -RL public/nss/* private/nss/* "$PKG/usr/include/nss/"
chmod 644 "$PKG"/usr/include/nss/*
install -m755 Linux*/bin/nss-config "$PKG/usr/bin/"
install -m755 Linux*/bin/{certutil,cmsutil,crlutil,modutil,pk12util,signtool,signver,ssltap} \
	"$PKG/usr/bin/"
install -m644 Linux*/lib/pkgconfig/nss.pc "$PKG/usr/lib/pkgconfig/"
rm -f "$PKG/usr/lib/libnssckbi.so" "$PKG/usr/lib/libnssckbi-testlib.so"
ln -sf pkcs11/p11-kit-trust.so "$PKG/usr/lib/libnssckbi.so"

install -Dm644 "$SRC/nss/COPYING" "$PKG/usr/share/licenses/$name/COPYING"

The switches, and why each is set:

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/nss, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf nss-3.130-1.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/nss, and runs the triggers its paths call for.

Contents

Installed programs: certutil, cmsutil, crlutil, modutil, nss-config, pk12util, signtool, signver, ssltap.

Installed libraries: libfreebl3.so, libfreeblpriv3.so, libnss3.so, libnssckbi.so, libnssdbm3.so, libnsssysinit.so, libnssutil3.so, libsmime3.so, libsoftokn3.so, libssl3.so.

Installed directories: /usr/include/nss, /usr/share/licenses/nss.

Short descriptions

nss.pc Network Security Services

Notes

NSS has no install target, so build.sh copies from dist/. The libraries are under a directory named for the build host, dist/Linux<kernel major.minor>_x86_64_gcc_glibc_PTH_64_OPT.OBJ/ (NSS writes glibc whatever the C library), and the copies use the glob Linux* because the kernel release in the name is the build machine’s.

The .chk files are installed beside the libraries they sign. They hold the self-test signatures of libsoftokn3, libfreebl3, libfreeblpriv3 and libnssdbm3, and in FIPS mode NSS refuses to load a library whose signature is missing.

libnssckbi.so is the module NSS loads as its Builtin Roots. The port removes NSS’s own, which carries Mozilla’s root list compiled in, and installs in its place a symlink to p11-kit’s trust module, pkcs11/p11-kit-trust.so, so a program using NSS’s builtin roots trusts the same anchors as GnuTLS and the rest of the system; see TLS trust anchors. Firefox, LibreWolf and Thunderbird compile their builtin roots into the browser itself and keep their own store.