; Keep the libssl.so.3 and libcrypto.so.3 ABI used by the Alpine 3.21 userland. ; Use upstream's supported 3.5 LTS branch and Alpine's corresponding fixes. defpkgbuild(openssl, #:pkgname, "openssl", #:pkgver, "3.5.9", #:pkgrel, 1, #:pkgdesc, "OpenSSL TLS toolkit, libraries and development headers for Vinix", #:arch, [#:x86-64], #:url, "https://openssl-library.org/", #:license, "Apache-2.0", #:depends, ["musl"], #:makedepends, ["linux-headers"], #:source, [ "https://github.com/openssl/openssl/releases/download/openssl-3.5.9/openssl-3.5.9.tar.gz", "https://raw.githubusercontent.com/alpinelinux/aports/f2f8ff7cc28e26fb08d050e3cc19eb44a6f749e9/main/openssl/CVE-2026-88822.patch", "https://raw.githubusercontent.com/alpinelinux/aports/f2f8ff7cc28e26fb08d050e3cc19eb44a6f749e9/main/openssl/CVE-2026-88823.patch", "https://raw.githubusercontent.com/alpinelinux/aports/f2f8ff7cc28e26fb08d050e3cc19eb44a6f749e9/main/openssl/CVE-2026-95691.patch", "https://raw.githubusercontent.com/alpinelinux/aports/f2f8ff7cc28e26fb08d050e3cc19eb44a6f749e9/main/openssl/CVE-2026-95692.patch", "https://raw.githubusercontent.com/alpinelinux/aports/f2f8ff7cc28e26fb08d050e3cc19eb44a6f749e9/main/openssl/CVE-2026-107496.patch"], #:sha256sums, ["603f5602e2eef00d77fbd429d34dcd5822bb301757a1bc9cdb24c670f1eb859a", "50f7cc52fb146703379ca043d17e204c4fda99c684efe3db6d6f3ae1d175bd2a", "a945077c0a978dbfe5af5e4f7174a2151466547f8fb94562f395baa7b6b7c147", "93d8e82fdc995172a6d5cc6952491658106191bd5ac221d34596adbddfcd1afe", "0e328604c0038de6629a29322ae5f02d2f5f5128c2625b57ca64262efab99e05", "77d3759d279c71af59629c4a0fa82d8272a099762f2fa9e3f66d7ca5ed544157"], #:prepare, fn() { for-each(fn(patch) { run("patch", "--batch", "--fuzz=0", "-p1", "-d", "openssl-3.5.9", "-i", string-append("../", patch)) }, list("CVE-2026-88822.patch", "CVE-2026-88823.patch", "CVE-2026-95691.patch", "CVE-2026-95692.patch", "CVE-2026-107496.patch")) run("ln", "-s", get-environment-variable("VPAC_MAKEPKG_ROOT"), "vinix-sysroot") }, #:build, fn() { run("env", "CC=gcc --sysroot=vinix-sysroot -specs=vinix-sysroot/usr/lib/musl-gcc-sysroot.specs", "perl", "openssl-3.5.9/Configure", "linux-x86_64", "--prefix=/usr", "--libdir=lib", "--openssldir=/etc/ssl", "shared", "no-tests", "no-docs", "no-zlib", "no-async", "no-afalgeng") run("env", "-u", "CPATH", "-u", "C_INCLUDE_PATH", "-u", "LIBRARY_PATH", "make", "build_sw") }, #:check, fn() { run("vinix-sysroot/lib/ld-musl-x86_64.so.1", "--library-path", ".:vinix-sysroot/usr/lib", "apps/openssl", "version") run("vinix-sysroot/lib/ld-musl-x86_64.so.1", "--library-path", ".:vinix-sysroot/usr/lib", "apps/openssl", "dgst", "-sha256", "/dev/null") }, #:package, fn() { ; The core command implements 'openssl rehash'. Optional upstream Perl ; convenience scripts require a Perl installation in the guest. run("make", "BIN_SCRIPTS=", "MISC_SCRIPTS=", string-append("DESTDIR=", pkgdir()), "install_sw", "install_ssldirs") run("install", "-Dm644", "openssl-3.5.9/LICENSE.txt", string-append(pkgdir(), "/usr/share/licenses/openssl/LICENSE.txt")) })