2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, libtool, autoreconfHook, pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
, sysfsutils
|
|
|
|
, argp-standalone
|
|
|
|
# WARNING: DO NOT USE BEACON GENERATED VALUES AS SECRET CRYPTOGRAPHIC KEYS
|
|
|
|
# https://www.nist.gov/programs-projects/nist-randomness-beacon
|
|
|
|
, curl ? null, libxml2 ? null, openssl ? null, withNistBeacon ? false
|
|
|
|
# Systems that support RDRAND but not AES-NI require libgcrypt to use RDRAND as an entropy source
|
|
|
|
, libgcrypt ? null, withGcrypt ? true
|
|
|
|
, jitterentropy ? null, withJitterEntropy ? true
|
|
|
|
, libp11 ? null, opensc ? null, withPkcs11 ? true
|
|
|
|
}:
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
with lib;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "rng-tools";
|
2021-02-13 14:23:35 +00:00
|
|
|
version = "6.11";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "nhorman";
|
|
|
|
repo = "rng-tools";
|
|
|
|
rev = "v${version}";
|
2021-02-13 14:23:35 +00:00
|
|
|
sha256 = "sha256-qheJaeVX2zuv0mvKEd6wcbSHFjiJE0t5hVCJiRSKm3M=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ autoreconfHook libtool pkg-config ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
(withFeature withGcrypt "libgcrypt")
|
|
|
|
(enableFeature withJitterEntropy "jitterentropy")
|
|
|
|
(withFeature withNistBeacon "nistbeacon")
|
|
|
|
(withFeature withPkcs11 "pkcs11")
|
|
|
|
];
|
|
|
|
|
|
|
|
# argp-standalone is only used when libc lacks argp parsing (musl)
|
|
|
|
buildInputs = [ sysfsutils ]
|
|
|
|
++ optionals stdenv.hostPlatform.isx86_64 [ argp-standalone ]
|
|
|
|
++ optionals withGcrypt [ libgcrypt ]
|
|
|
|
++ optionals withJitterEntropy [ jitterentropy ]
|
|
|
|
++ optionals withNistBeacon [ curl libxml2 openssl ]
|
|
|
|
++ optionals withPkcs11 [ libp11 openssl ];
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2022-01-27 00:19:43 +00:00
|
|
|
makeFlags = [
|
|
|
|
"AR:=$(AR)" # For cross-compilation
|
|
|
|
] ++ optionals (withPkcs11) [
|
|
|
|
"PKCS11_ENGINE=${opensc}/lib/opensc-pkcs11.so" # Overrides configure script paths
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
preCheck = "patchShebangs tests/*.sh";
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "A random number generator daemon";
|
|
|
|
homepage = "https://github.com/nhorman/rng-tools";
|
|
|
|
license = licenses.gpl2Plus;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ johnazoidberg c0bw3b ];
|
|
|
|
};
|
|
|
|
}
|