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
openssl-4.0.3.tar.gz(52.7 MiB)
sha256325b5c806167c13b40b1ffeadfe0248197c00eccc4cf123ec1e28d2d2fd216d9
upstream: https://openssl.org/source/openssl-4.0.3.tar.gz
archive copy: sources-1/crypto--openssl-4.0.3.tar.gz
Dependencies
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:
export CFLAGS="${CFLAGS/-O2/-O3}"— Compile at-O3. OpenSSL’s own Linux configurations build at-O3, and an exportedCFLAGSreplaces their flags whole, so the tree’s-O2would otherwise win. The substitution raises the level inside the tree’s flags and keeps the rest of them (see Every port).--openssldir=/etc/ssl— Readopenssl.cnfand the default certificate locations from/etc/ssl, the directory whereca-certificateswrites/etc/ssl/cert.pem. Every program linked against OpenSSL then trusts the system’s roots with no setting of its own.enable-ec_nistp_64_gcc_128— Build the optimised implementations of the NIST P-224, P-256, P-384 and P-521 curves that use the compiler’s 128-bit integer type. They are off by default; upstream’sINSTALL.mdsupports them only on a little-endian processor that tolerates misaligned access, with a compiler that has__uint128_t, which x86-64 with GCC is.enable-camellia,enable-seed,enable-rfc3779,enable-argon2— The Camellia and SEED ciphers, the RFC 3779 certificate extensions for IP addresses and AS numbers, and the Argon2 key-derivation function. All four are on by default in OpenSSL 4, so naming them restates the default.enable-ktls— Build kernel TLS support, off by default: once a TLS session is set up, libssl can hand the record encryption to the kernel’stlsmodule, sosendfileandsplicework on a TLS socket.no-mdc2,no-ec2m,no-sm2,no-sm4— Leave out the MDC-2 hash, elliptic curves over binary fields, and the SM2 signature and SM4 cipher algorithms.openssl list -disabledon the built tree lists them, beside the ones upstream leaves out by default.shared— Buildlibsslandlibcryptoas shared libraries as well as the static archives, which are built either way and ship.threads— Build with thread support, so the libraries may be used from several threads at once. It is the default on Linux.zlib— Build zlib compression and decompression into libcrypto, linked against zlib, which is independs. Upstream’s default is off.MANSUFFIX=ssl— Install the manual pages with ansslsuffix on the section, aspasswd.1sslandrand.1ssl. OpenSSL’s command pages have generic names, and the suffix keeps them from colliding with another package’s page of the same name.install_sw— Install the programs, libraries, headers and pkg-config files.install_ssldirs— Create/etc/sslwith itscerts,privateandmiscdirectories, and installopenssl.cnf,ct_log_list.cnfand theCA.plandtsgetscripts.install_man_docs— Install the manual pages.make installwould also runinstall_html_docs; the HTML manual is left out, and the tree’s prune removes HTML under/usr/share/docfrom every package in any case.
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.