From 07bce9657c2975f11baaed7f920ccd7592c7efbd Mon Sep 17 00:00:00 2001 From: quapka Date: Thu, 25 Jul 2024 15:23:51 +0200 Subject: Build Gcrypt shim through Nix --- flake.nix | 3 ++- nix/gcryptshim.nix | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 nix/gcryptshim.nix diff --git a/flake.nix b/flake.nix index 2b7cd8d..e423566 100644 --- a/flake.nix +++ b/flake.nix @@ -122,6 +122,7 @@ cryptoppShim = import ./nix/cryptoppshim.nix { inherit pkgs cryptopp; }; opensslShimBuilder = { version, hash }: import ./nix/opensslshim.nix { inherit pkgs; openssl = (openssl { version = version; hash = hash;}); }; boringsslShim = import ./nix/boringsslshim.nix { inherit pkgs; boringssl = patched_boringssl; }; + gcryptShim = import ./nix/gcryptshim.nix { inherit pkgs libgcrypt libgpg-error; }; mbedtlsShim = import ./nix/mbedtlsshim.nix { pkgs = pkgs; }; ippcryptoShim = import ./nix/ippcryptoshim.nix { pkgs = pkgs; ipp-crypto = customPkgs.ipp-crypto; }; @@ -150,12 +151,12 @@ jniLibsPath = "standalone/src/main/resources/cz/crcs/ectester/standalone/libs/jni/"; preConfigure = '' - cp ${boringsslShim.out}/lib/boringssl_provider.so standalone/src/main/resources/cz/crcs/ectester/standalone/libs/jni/ cp ${tomcryptShim.out}/lib/tomcrypt_provider.so ${jniLibsPath} cp ${botanShim.out}/lib/botan_provider.so ${jniLibsPath} cp ${cryptoppShim.out}/lib/cryptopp_provider.so ${jniLibsPath} cp ${opensslShim.out}/lib/openssl_provider.so ${jniLibsPath} cp ${boringsslShim.out}/lib/boringssl_provider.so ${jniLibsPath} + cp ${gcryptShim.out}/lib/gcrypt_provider.so ${jniLibsPath} cp ${commonLibs}/lib/* ${jniLibsPath} ''; diff --git a/nix/gcryptshim.nix b/nix/gcryptshim.nix new file mode 100644 index 0000000..bfe027b --- /dev/null +++ b/nix/gcryptshim.nix @@ -0,0 +1,25 @@ +{ + pkgs + , libgcrypt + , libgpg-error +}: +with pkgs; stdenv.mkDerivation { + name = "Gcrypt Shim"; + src = ../standalone/src/main/resources/cz/crcs/ectester/standalone/libs/jni; + + buildInputs = [ + libgcrypt + libgpg-error + pkg-config + jdk11_headless + ]; + + buildPhase = '' + make gcrypt + ''; + + installPhase = '' + mkdir --parents $out/lib + cp gcrypt_provider.so $out/lib/ + ''; +} -- cgit v1.3.1