New package: rng-tools-5

This commit is contained in:
Andrea Brancaleoni 2015-04-24 20:43:58 +02:00
parent 94a6608cf4
commit 77322d2937
4 changed files with 68 additions and 0 deletions

View file

@ -0,0 +1,2 @@
#!/bin/sh
killall rngd

View file

@ -0,0 +1,14 @@
#!/bin/sh
RNGD_OPTS=""
[ -r conf ] && . ./conf
a=0
n=$(nproc)
while [ $a -lt $n ]
do
rngd $RNGD_OPTS
a=`expr $a + 1`
done
exec chpst -b rng-tools pause

View file

@ -0,0 +1,36 @@
From: Leonardo Chiquitto <leonardo@ngdn.org>
Subject: Check for signals in update_kernel_random()
When running as a daemon, a signal handler is installed to catch
SIGINT/SIGTERM. This handler sets a flag that's tested in the main
loop. However, rngd loops in update_kernel_random() as well, where
the flag was not tested.
This patch adds the check to update_kernel_random() so that the
daemon exits properly after receiving a SIGINT/SIGTERM signal.
Index: rngd.c
===================================================================
--- rngd.c
+++ rngd.c
@@ -218,6 +218,8 @@ static int update_kernel_random(int rand
for (p = buf; p + random_step <= &buf[FIPS_RNG_BUFFER_SIZE];
p += random_step) {
+ if (!server_running)
+ return 0;
random_add_entropy(p, random_step);
random_sleep();
}
@@ -239,10 +241,10 @@ static void do_loop(int random_step)
{
int rc;
+ retry_same:
if (!server_running)
return;
- retry_same:
if (iter->disabled)
continue; /* failed, no work */

View file

@ -0,0 +1,16 @@
# Template file for 'rng-tools'
pkgname=rng-tools
version=5
revision=1
build_style=gnu-configure
makedepends="libgcrypt-devel"
short_desc="Random number generator related utilities"
maintainer="Andrea Brancaleoni <miwaxe@gmail.com>"
license="GPL-3"
homepage="http://sourceforge.net/projects/gkernel"
distfiles="${SOURCEFORGE_SITE}/gkernel/${pkgname}-${version}.tar.gz"
checksum=60a102b6603bbcce2da341470cad42eeaa9564a16b4490e7867026ca11a3078e
post_install() {
vsv rngd
}