2016-09-18 19:29:32 +01:00
|
|
|
{ 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
|
2016-06-04 18:55:15 +01:00
|
|
|
|
2019-08-13 22:52:01 +01:00
|
|
|
stdenv.mkDerivation {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "secp256k1";
|
2016-06-04 18:55:15 +01:00
|
|
|
|
2016-09-18 19:29:32 +01:00
|
|
|
# I can't find any version numbers, so we're just using the date of the
|
|
|
|
# last commit.
|
2017-12-21 02:16:13 +00:00
|
|
|
version = "2017-12-18";
|
2016-06-04 18:55:15 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "bitcoin-core";
|
|
|
|
repo = "secp256k1";
|
2017-12-21 02:16:13 +00:00
|
|
|
rev = "f54c6c5083307b18224c953cf5870ea7ffce070b";
|
|
|
|
sha256 = "0bxqmimm627g9klalg1vdbspmn52588v4a6cli3p8bn84ibsnzbm";
|
2016-06-04 18:55:15 +01:00
|
|
|
};
|
|
|
|
|
2016-09-18 19:29:32 +01:00
|
|
|
buildInputs = optionals enableJNI [ jdk ];
|
2016-06-04 18:55:15 +01:00
|
|
|
|
2016-09-18 19:29:32 +01:00
|
|
|
nativeBuildInputs = [ autoreconfHook ];
|
2016-06-04 18:55:15 +01:00
|
|
|
|
2016-09-18 19:29:32 +01:00
|
|
|
configureFlags =
|
2017-12-21 02:16:13 +00:00
|
|
|
[ "--enable-benchmark=no" "--enable-tests=no" "--enable-exhaustive-tests=no" ] ++
|
2016-09-18 19:29:32 +01:00
|
|
|
optionals enableECDH [ "--enable-module-ecdh" "--enable-experimental" ] ++
|
|
|
|
optionals enableRecovery [ "--enable-module-recovery" ] ++
|
|
|
|
optionals enableJNI [ "--enable-jni" ];
|
2016-06-04 18:55:15 +01:00
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Optimized C library for EC operations on curve secp256k1";
|
|
|
|
longDescription = ''
|
2016-09-18 19:29:32 +01:00
|
|
|
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.
|
2016-06-04 18:55:15 +01:00
|
|
|
'';
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://github.com/bitcoin-core/secp256k1";
|
2016-06-04 18:55:15 +01:00
|
|
|
license = with licenses; [ mit ];
|
|
|
|
maintainers = with maintainers; [ chris-martin ];
|
2016-08-02 18:50:55 +01:00
|
|
|
platforms = with platforms; unix;
|
2016-06-04 18:55:15 +01:00
|
|
|
};
|
|
|
|
}
|