sys-apps/rng-tools: do not specify rng device in init script #481254
authorGokturk Yuksek <gokturk@binghamton.edu>
Tue, 22 Sep 2015 10:09:09 +0000 (06:09 -0400)
committerGokturk Yuksek <gokturk@binghamton.edu>
Thu, 1 Oct 2015 08:08:52 +0000 (04:08 -0400)
Linux hw_random driver provides a unified interface for multiple RNGs
and the RNG source is exposed through /dev/hwrng device node. There is
no need for the init script to look for other device nodes under
/dev. By default, rngd uses /dev/hwrng as the entropy source,
therefore it's not required to specify it on the command line
explicitly.

The creation of /dev/hwrng requires CONFIG_DEVTMPFS support in the
kernel. Due to the way hw_random module is written, some device
managers may fail to create /dev/hwrng successfuly. Mdev, for example,
incorrectly creates /dev/hw_random instead of /dev/hwrng, mistaking
module's own name for the device node's name (see related bug
561102). However, per gentoo wiki [1], CONFIG_DEVTMPFS is part of the
mdev setup and these systems will have two device nodes
(/dev/hw_random and /dev/hwrng) that point to the same device. Even in
such setups, rngd will successfuly find /dev/hwrng.

[1] https://wiki.gentoo.org/index.php?title=Mdev&oldid=246636

Gentoo-Bug: https://bugs.gentoo.org/481254

Package-Manager: portage-2.2.20.1

sys-apps/rng-tools/rng-tools-5-r2.ebuild [new file with mode: 0644]

diff --git a/sys-apps/rng-tools/rng-tools-5-r2.ebuild b/sys-apps/rng-tools/rng-tools-5-r2.ebuild
new file mode 100644 (file)
index 0000000..f32feff
--- /dev/null
@@ -0,0 +1,40 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils autotools systemd toolchain-funcs
+
+DESCRIPTION="Daemon to use hardware random number generators"
+HOMEPAGE="http://gkernel.sourceforge.net/"
+SRC_URI="mirror://sourceforge/gkernel/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~ppc ~x86"
+IUSE="selinux"
+
+DEPEND="dev-libs/libgcrypt:0
+       dev-libs/libgpg-error"
+RDEPEND="${DEPEND}
+       selinux? ( sec-policy/selinux-rngd )"
+
+src_prepare() {
+       echo 'bin_PROGRAMS = randstat' >> contrib/Makefile.am
+       epatch "${FILESDIR}"/test-for-argp.patch
+       epatch "${FILESDIR}"/${P}-fix-textrels-on-PIC-x86.patch #469962
+       epatch "${FILESDIR}"/${P}-man-fill-watermark.patch #555094
+       epatch "${FILESDIR}"/${P}-man-rng-device.patch #555106
+       eautoreconf
+
+       sed -i '/^AR /d' Makefile.in || die
+       tc-export AR
+}
+
+src_install() {
+       default
+       newinitd "${FILESDIR}"/rngd-initd-r1-4.1 rngd
+       newconfd "${FILESDIR}"/rngd-confd-4.1 rngd
+       systemd_dounit "${FILESDIR}"/rngd.service
+}