nixpkgs/pkgs/tools/security/rng-tools/default.nix

66 lines
2.0 KiB
Nix
Raw Normal View History

{ stdenv, fetchFromGitHub, libtool, autoreconfHook, pkgconfig
2018-10-22 22:48:25 +01:00
, sysfsutils
, argp-standalone
2018-10-22 22:48:25 +01:00
# 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
2018-10-22 22:48:25 +01:00
}:
2018-10-22 22:48:25 +01:00
with stdenv.lib;
2012-11-22 06:05:45 +00:00
stdenv.mkDerivation rec {
pname = "rng-tools";
2019-12-24 15:10:44 +00:00
version = "6.9";
2018-10-22 22:48:25 +01:00
src = fetchFromGitHub {
owner = "nhorman";
repo = "rng-tools";
rev = "v${version}";
2019-12-24 15:10:44 +00:00
sha256 = "065jf26s8zkicb95zc9ilksjdq9gqrh5vcx3mhi6mypbnamn6w98";
2018-10-22 22:48:25 +01:00
};
2012-11-22 06:05:45 +00:00
postPatch = ''
${optionalString withPkcs11 ''
substituteInPlace rngd.c \
--replace /usr/lib64/opensc-pkcs11.so ${opensc}/lib/opensc-pkcs11.so
''}
'';
2012-11-22 06:05:45 +00:00
nativeBuildInputs = [ autoreconfHook libtool pkgconfig ];
2018-10-22 22:48:25 +01:00
configureFlags = [
(withFeature withGcrypt "libgcrypt")
(enableFeature withJitterEntropy "jitterentropy")
(withFeature withNistBeacon "nistbeacon")
(withFeature withPkcs11 "pkcs11")
];
2018-10-22 22:48:25 +01:00
# argp-standalone is only used when libc lacks argp parsing (musl)
2018-10-22 22:48:25 +01:00
buildInputs = [ sysfsutils ]
++ optionals stdenv.hostPlatform.isx86_64 [ argp-standalone ]
++ optionals withGcrypt [ libgcrypt ]
++ optionals withJitterEntropy [ jitterentropy ]
++ optionals withNistBeacon [ curl libxml2 openssl ]
++ optionals withPkcs11 [ libp11 openssl ];
2018-10-22 22:48:25 +01:00
enableParallelBuilding = true;
2012-11-22 06:05:45 +00:00
2018-02-26 23:17:23 +00:00
# For cross-compilation
makeFlags = [ "AR:=$(AR)" ];
doCheck = true;
preCheck = "patchShebangs tests/*.sh";
2012-11-22 06:05:45 +00:00
meta = {
description = "A random number generator daemon";
2018-10-22 22:48:25 +01:00
homepage = https://github.com/nhorman/rng-tools;
license = licenses.gpl2Plus;
platforms = platforms.linux;
maintainers = with maintainers; [ johnazoidberg c0bw3b ];
2012-11-22 06:05:45 +00:00
};
}