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

51.1. openssl-4.0.3

Management tools and libraries relating to cryptography

Version 4.0.3, release 1
Shelf crypto — Cryptographic libraries, PKCS#11, smartcards and TPM
Phase 30_foundation (Build Foundation), 23 of 127 in build order
Licence Apache-2.0
Homepage https://www.openssl.org
Build time 2.6 SBU
Installed size 33.5 MiB in 6820 files
Recipe ports/core/crypto/openssl/kpkgbuild

About

OpenSSL is the TLS library and general cryptography library most of the tree links: curl, git, python3’s ssl and hashlib, openssh, wpa_supplicant, cryptsetup, libarchive, krb5, nodejs and rust among them. Its openssl program is used by the build as well: the linux port generates the kernel’s module-signing key with openssl req when the build has none (see Module signing), and wireless-regdb checks, with openssl smime -verify, that the regulatory database it builds from db.txt matches upstream’s signature.

This port is OpenSSL 4, whose libraries are libssl.so.4 and libcrypto.so.4, and every port builds against it. A program that cannot use OpenSSL 4 loads the 3.5 runtime from the separate openssl3 slot instead; see A second version beside the first. The certificate store it reads is described in TLS trust anchors.

Sources

Dependencies

Depends on: perl, zlib.

Required by (149): afflib, aircrack-ng, atuin, baresip, bpftool, calibre, calligra, cargo-c, clamav, cmake, cryptsetup, curl, cyrus-sasl, dcmtk, ddnet, falkon, flashrom, freedv-gui, freerdp, gcompris, gdal, git, gocryptfs, gst-plugins-bad, gst-plugins-good, hfsprogs, hostapd, hplip, htslib, imhex, impression, iperf3, isync, john, karchive, kdeconnect, keysmith, khealthcertificate, kitinerary, kodi, krb5, krdp, kunifiedpush, lagrange, ldns, libarchive, libcamera, libetpan, libevent, libewf, libfido2, libfprint, libgit2, libimobiledevice, libktorrent, libnice, libnvme, libquotient, libre, libreoffice, librepcb, libsrt, libsrtp, libssh, libssh2, libstrophe, libtorrent-rasterbar, libtpms, libvncserver, libwebsockets, libzip, linux, lua54-luasec, luanti, lynx, messagelib, minizip-ng, mosh, mosquitto, mtxclient, mupdf, neon, net-snmp, netcdf-c, netsurf, newsboat, ngircd, ngtcp2, nheko, nmap, nodejs, nut, nvme-cli, octave, opencpn, openldap, openrct2, opensc, openscad, openssh, openvpn, orcaslicer, partclone, pdf4qt, perf, perl-net-ssleay, pipewire, plasma-nm, poco, podofo, postgresql, ppp, prosody, prusaslicer, python3, python3-cryptography, qbittorrent, qca, qt6-qtbase, remmina, rizin, rsync, rtl-433, ruby, rust, socat, spice, spice-gtk, strawberry, sudo, supertuxkart, swtpm, tcpdump, thrift, tokodon, tpm2-tools, tpm2-tss, transmission, typst, unshield, valkey, w3m, wesnoth, wireless-regdb, wpa_supplicant, xh, xmlrpc-c, xwayland, yara.

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/30_foundation/phase.env && kpkg install openssl'

What kpkg does

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

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/openssl
echo '325b5c806167c13b40b1ffeadfe0248197c00eccc4cf123ec1e28d2d2fd216d9  openssl-4.0.3.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/openssl
SRC=$SRC_ROOT/openssl-4.0.3
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf openssl-4.0.3.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 five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

export CFLAGS="${CFLAGS/-O2/-O3}" CXXFLAGS="${CXXFLAGS/-O2/-O3}"
./config \
	--prefix=/usr \
	--libdir=lib \
	--openssldir=/etc/ssl \
	enable-ec_nistp_64_gcc_128 \
	enable-camellia \
	enable-seed \
	enable-rfc3779 \
	enable-ktls \
	enable-argon2 \
	no-mdc2 \
	no-ec2m \
	no-sm2 \
	no-sm4 \
	shared \
	threads \
	zlib

make depend
make
make MANSUFFIX=ssl DESTDIR=$PKG install_sw install_ssldirs install_man_docs

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/openssl, 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 openssl-4.0.3-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/openssl, and runs the triggers its paths call for.

Contents

Installed programs: openssl.

Installed libraries: libcrypto.a, libcrypto.so, libssl.a, libssl.so.

Installed directories: /etc/ssl/misc, /etc/ssl/private, /usr/include/openssl, /usr/lib/cmake/OpenSSL, /usr/lib/ossl-modules, /usr/share/licenses/openssl.

Short descriptions

openssl OpenSSL command line program
libcrypto.pc OpenSSL cryptography library
libssl.pc Secure Sockets Layer and cryptography libraries
openssl.pc Secure Sockets Layer and cryptography libraries and tools

Notes

The legacy provider is a loadable module, /usr/lib/ossl-modules/legacy.so. It belongs to this port only: the openssl3 slot is built no-module and carries its legacy provider inside libcrypto.so.3, so a process holding the 3.5 library never loads a module built for OpenSSL 4.