From 03d69128b233c4bab40cc85daa326ad1657d18e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Tue, 18 Feb 2020 12:17:45 +0100 Subject: [PATCH] nettle: runtime selection of HW-accelerated code > Include multiple versions of certain functions in the library, > and select the ones to use at run-time, depending on available > processor features. Supported for ARM and x86_64. The current version seems to accelerate AES and SHA families. Size increase on x86_64 is <10k in our case. It can make quite some performance difference; I tried $ time ./result-dev/bin/nettle-hash -a sha256 /some/file/around/2G And the total CPU time went down from 8.5s to 2s (single thread). Now it matches the time of openssl $ time openssl sha256 /some/file/around/2G Of course, in real life it will be much harder to notice a difference... Platforms without support for this (e.g. i686) seem to still build fine, and ARMv7 cross-build also succeeds for me, so hopefully all is OK. --- pkgs/development/libraries/nettle/generic.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/development/libraries/nettle/generic.nix b/pkgs/development/libraries/nettle/generic.nix index 064ef344398..9939cbf6067 100644 --- a/pkgs/development/libraries/nettle/generic.nix +++ b/pkgs/development/libraries/nettle/generic.nix @@ -16,6 +16,8 @@ stdenv.mkDerivation ({ nativeBuildInputs = [ gnum4 ]; propagatedBuildInputs = [ gmp ]; + configureFlags = [ "--enable-fat" ]; # runtime selection of HW-accelerated code + doCheck = (stdenv.hostPlatform.system != "i686-cygwin" && !stdenv.isDarwin); enableParallelBuilding = true;