ivpn-service: support quantum resistance (#523461)
This commit is contained in:
@@ -13,13 +13,16 @@
|
||||
iptables,
|
||||
gawk,
|
||||
util-linux,
|
||||
nix-update-script,
|
||||
liboqs,
|
||||
}:
|
||||
buildGoModule (finalAttrs: {
|
||||
pname = "ivpn-service";
|
||||
version = "3.15.6";
|
||||
|
||||
buildInputs = [ wirelesstools ];
|
||||
buildInputs = [
|
||||
wirelesstools
|
||||
(finalAttrs.passthru.liboqs)
|
||||
];
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
src = fetchFromGitHub {
|
||||
@@ -62,7 +65,9 @@ buildGoModule (finalAttrs: {
|
||||
--replace-fail 'dnscryptproxyBinPath = path.Join(installDir, "dnscrypt-proxy/dnscrypt-proxy")' \
|
||||
'dnscryptproxyBinPath = "${dnscrypt-proxy}/bin/dnscrypt-proxy"' \
|
||||
--replace-fail 'v2rayBinaryPath = path.Join(installDir, "v2ray/v2ray")' \
|
||||
'v2rayBinaryPath = "${v2ray}/bin/v2ray"'
|
||||
'v2rayBinaryPath = "${v2ray}/bin/v2ray"' \
|
||||
--replace-fail 'kemHelperBinaryPath = path.Join(installDir, "kem/kem-helper")' \
|
||||
'kemHelperBinaryPath = "${placeholder "out"}/bin/kem-helper"'
|
||||
'';
|
||||
|
||||
ldflags = [
|
||||
@@ -72,8 +77,17 @@ buildGoModule (finalAttrs: {
|
||||
"-X github.com/ivpn/desktop-app/daemon/version._time=1970-01-01"
|
||||
];
|
||||
|
||||
postBuild = ''
|
||||
$CC -O2 -pthread \
|
||||
References/common/kem-helper/main.c \
|
||||
References/common/kem-helper/base64.c \
|
||||
-loqs -Wl,-z,stack-size=5242880 \
|
||||
-o kem-helper
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
mv $out/bin/{daemon,ivpn-service}
|
||||
install -Dm755 kem-helper $out/bin/kem-helper
|
||||
'';
|
||||
|
||||
postFixup = ''
|
||||
@@ -94,7 +108,34 @@ buildGoModule (finalAttrs: {
|
||||
}
|
||||
'';
|
||||
|
||||
passthru.updateScript = nix-update-script { };
|
||||
# IVPN pins this to an older incompatible version, so we vendor it at that
|
||||
# Lives in passthru so end-users can override it
|
||||
passthru.liboqs = liboqs.overrideAttrs (
|
||||
final: prev: {
|
||||
version = "0.10.0";
|
||||
src = fetchFromGitHub {
|
||||
owner = "open-quantum-safe";
|
||||
repo = "liboqs";
|
||||
tag = "${final.version}";
|
||||
hash = "sha256-BFDa5NUr02lFPcT4Hnb2rjGAi+2cXvh1SHLfqX/zLlI=";
|
||||
};
|
||||
# the main derivations patches don't apply onto the older version
|
||||
patches = [ ];
|
||||
# manually do what the main derivations pkg-config patch does (unbreak invalid path)
|
||||
postPatch = ''
|
||||
substituteInPlace src/liboqs.pc.in \
|
||||
--replace-fail 'libdir=''${prefix}/@CMAKE_INSTALL_LIBDIR@' \
|
||||
'libdir=@CMAKE_INSTALL_FULL_LIBDIR@' \
|
||||
--replace-fail 'includedir=''${prefix}/@CMAKE_INSTALL_INCLUDEDIR@' \
|
||||
'includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@'
|
||||
'';
|
||||
# This matches IVPNs build script at $src/daemon/References/common/kem-helper/build.sh
|
||||
cmakeFlags = (prev.cmakeFlags or [ ]) ++ [
|
||||
"-DOQS_USE_OPENSSL=OFF"
|
||||
"-DOQS_MINIMAL_BUILD=KEM_kyber_1024;KEM_classic_mceliece_348864"
|
||||
];
|
||||
}
|
||||
);
|
||||
|
||||
meta = {
|
||||
description = "Official IVPN Desktop app service daemon";
|
||||
|
||||
Reference in New Issue
Block a user