summary refs log tree commit diff
path: root/pkgs/tools/security/secp256k1/default.nix
diff options
context:
space:
mode:
authorChris Martin <ch.martin@gmail.com>2016-09-18 14:29:32 -0400
committerChris Martin <ch.martin@gmail.com>2016-11-29 09:36:53 -0500
commitd7afb872cda9a94a1f19e328e376ed64aeacef1b (patch)
tree2c4389f6fd6ac72870bef3de7e808536e875182b /pkgs/tools/security/secp256k1/default.nix
parentc9b8a6585df2f3ac0c8713b4efc4eaaf72e7b52f (diff)
downloadnixpkgs-d7afb872cda9a94a1f19e328e376ed64aeacef1b.tar
nixpkgs-d7afb872cda9a94a1f19e328e376ed64aeacef1b.tar.gz
nixpkgs-d7afb872cda9a94a1f19e328e376ed64aeacef1b.tar.bz2
nixpkgs-d7afb872cda9a94a1f19e328e376ed64aeacef1b.tar.lz
nixpkgs-d7afb872cda9a94a1f19e328e376ed64aeacef1b.tar.xz
nixpkgs-d7afb872cda9a94a1f19e328e376ed64aeacef1b.tar.zst
nixpkgs-d7afb872cda9a94a1f19e328e376ed64aeacef1b.zip
secp256k1: 2016-05-30 -> 2016-11-27, more flags (#18637)
Diffstat (limited to 'pkgs/tools/security/secp256k1/default.nix')
-rw-r--r--pkgs/tools/security/secp256k1/default.nix43
1 files changed, 30 insertions, 13 deletions
diff --git a/pkgs/tools/security/secp256k1/default.nix b/pkgs/tools/security/secp256k1/default.nix
index 1b982bf06d1..83a23744c2e 100644
--- a/pkgs/tools/security/secp256k1/default.nix
+++ b/pkgs/tools/security/secp256k1/default.nix
@@ -1,32 +1,49 @@
-{ stdenv, fetchFromGitHub, autoconf, automake, libtool, ... }:
+{ stdenv, fetchFromGitHub, autoreconfHook, jdk
+
+# Enable ECDSA pubkey recovery module
+, enableRecovery ? true
+
+# Enable ECDH shared secret computation (disabled by default because it is
+# experimental)
+, enableECDH ? false
+
+# Enable libsecp256k1_jni (disabled by default because it requires a jdk,
+# which is a large dependency)
+, enableJNI ? false
+
+}:
+
+let inherit (stdenv.lib) optionals; in
 
 stdenv.mkDerivation rec {
   name = "secp256k1-${version}";
 
-  # I can't find any version numbers, so we're just using the date
-  # of the last commit.
-  version = "2016-05-30";
+  # I can't find any version numbers, so we're just using the date of the
+  # last commit.
+  version = "2016-11-27";
 
   src = fetchFromGitHub {
     owner = "bitcoin-core";
     repo = "secp256k1";
-    rev = "b3be8521e694eaf45dd29baea035055183c42fe2";
-    sha256 = "1pgsy72w87yxbiqn96hnm8alsfx3rj7d9jlzdsypyf6i1rf6w4bq";
+    rev = "2928420c1b8e1feee8c20dff4e3cc41a0de2fc22";
+    sha256 = "1djsr2vrhh88353czlwb8bwlyabf008w1f7xg0fs3q33rf42w5gm";
   };
 
-  buildInputs = [ autoconf automake libtool ];
+  buildInputs = optionals enableJNI [ jdk ];
 
-  configureFlags = [ "--enable-module-recovery" ];
+  nativeBuildInputs = [ autoreconfHook ];
 
-  preConfigure = "./autogen.sh";
+  configureFlags =
+    optionals enableECDH [ "--enable-module-ecdh" "--enable-experimental" ] ++
+    optionals enableRecovery [ "--enable-module-recovery" ] ++
+    optionals enableJNI [ "--enable-jni" ];
 
   meta = with stdenv.lib; {
     description = "Optimized C library for EC operations on curve secp256k1";
     longDescription = ''
-      Optimized C library for EC operations on curve secp256k1.
-      Part of Bitcoin Core. This library is a work in progress
-      and is being used to research best practices. Use at your
-      own risk.
+      Optimized C library for EC operations on curve secp256k1. Part of
+      Bitcoin Core. This library is a work in progress and is being used
+      to research best practices. Use at your own risk.
     '';
     homepage = https://github.com/bitcoin-core/secp256k1;
     license = with licenses; [ mit ];