git.iko.soy/typeable/nixpkgs
on master help sign in
openssl3: disable build-time feature detection

This enables KTLS support on linux. Signed-off-by: Arthur Gautier <baloo@superbaloo.net>

commit0db4ebbf1f3187b12c44f78a363dff79ca344aad authorArthur Gautier <baloo@superbaloo.net> dateTue 7 Sep 2021, 23:16 (5 years ago) parent7f25b31
2 files changed+28
pkgs/development/libraries/openssl/3.0/openssl-disable-kernel-detection.patch+22 pkgs/development/libraries/openssl/default.nix+6
pkgs/development/libraries/openssl/3.0/openssl-disable-kernel-detection.patchnew file+22
@@ -0,0 +1,22 @@
1+diff --git a/Configure b/Configure
2+index f0ad787bc4..a48d2008c6 100755
3+--- a/Configure
4++++ b/Configure
5+@@ -1688,17 +1688,6 @@ unless ($disabled{devcryptoeng}) {
6+ unless ($disabled{ktls}) {
7+ $config{ktls}="";
8+ if ($target =~ m/^linux/) {
9+- my $usr = "/usr/$config{cross_compile_prefix}";
10+- chop($usr);
11+- if ($config{cross_compile_prefix} eq "") {
12+- $usr = "/usr";
13+- }
14+- my $minver = (4 << 16) + (13 << 8) + 0;
15+- my @verstr = split(" ",`cat $usr/include/linux/version.h | grep LINUX_VERSION_CODE`);
16+-
17+- if ($verstr[2] < $minver) {
18+- disable('too-old-kernel', 'ktls');
19+- }
20+ } elsif ($target =~ m/^BSD/) {
21+ my $cc = $config{CROSS_COMPILE}.$config{CC};
22+ system("printf '#include <sys/types.h>\n#include <sys/ktls.h>' | $cc -E - >/dev/null 2>&1");
pkgs/development/libraries/openssl/default.nix+6
@@ -211,10 +211,16 @@ in {
211211 sha256 = "sha256-We7fy0bCUhTJvTftYHgpe03wHQEiZ/6enu4x9hvHBTY=";
212212 patches = [
213213 ./3.0/nix-ssl-cert-file.patch
214+
215+ # openssl will only compile in KTLS if the current kernel supports it.
216+ # This patch disables build-time detection.
217+ ./3.0/openssl-disable-kernel-detection.patch
218+
214219 (if stdenv.hostPlatform.isDarwin
215220 then ./use-etc-ssl-certs-darwin.patch
216221 else ./use-etc-ssl-certs.patch)
217222 ];
223+
218224 withDocs = true;
219225 };
220226}