summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--src/haveged.c10
-rw-r--r--src/haveged.h2
3 files changed, 16 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index c37151d..6874624 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,8 @@
-v1.9.16 (TBD)
+v1.9.16 (Dec 31, 2021)
+* Allow newuname syscall [Jirka Hladky]
+* Fix: haveged cannot be run as an application if also running as a daemon [Günther Brunthaler]
+* Add entropy unconditionally at start and then every 60 seconds [Jirka Hladky]
+* New parameter --once to refill entropy once and quit immediatelly [Jirka Hladky]
v1.9.15 (Sep 30, 2021)
* Check for sys/auxv.h before using it. [Peter Seiderer]
diff --git a/src/haveged.c b/src/haveged.c
index 9ec1004..b74c9d0 100644
--- a/src/haveged.c
+++ b/src/haveged.c
@@ -79,6 +79,7 @@ static struct pparams defaults = {
.buffersz = 0,
.detached = 0,
.foreground = 0,
+ .once = 0,
.d_cache = 0,
.i_cache = 0,
.run_level = 0,
@@ -151,6 +152,7 @@ int main(int argc, char **argv)
"i", "inst", "1", SETTINGR("Instruction cache size [KB], with fallback to: ", GENERIC_ICACHE),
"f", "file", "1", "Sample output file, default: '" OUTPUT_DEFAULT "', '-' for stdout",
"F", "Foreground", "0", "Run daemon in foreground",
+ "e", "once", "0", "Provide entropy to the kernel once and quit immediatelly",
"r", "run", "1", "0=daemon, 1=config info, >1=<r>KB sample",
"n", "number", "1", "Output size in [k|m|g|t] bytes, 0 = unlimited to stdout",
"o", "onlinetest", "1", "[t<x>][c<x>] x=[a[n][w]][b[w]] 't'ot, 'c'ontinuous, default: ta8b",
@@ -280,6 +282,10 @@ int main(int argc, char **argv)
params->setup |= RUN_IN_FG;
params->foreground = 1;
break;
+ case 'e':
+ params->setup |= RUN_ONCE;
+ params->once = 1;
+ break;
case 'b':
params->buffersz = ATOU(optarg) * 1024;
if (params->buffersz<4)
@@ -640,7 +646,7 @@ static void run_daemon( /* RETURN: nothing */
t[1] = time(NULL);
if (t[1] - t[0] > 60) {
- /* add entropy on daemon start unconditionally */
+ /* add entropy on daemon start and then every 60 seconds unconditionally */
nbytes = poolSize / 2;
r = (nbytes+sizeof(H_UINT)-1)/sizeof(H_UINT);
if (havege_rng(h, (H_UINT *)output->buf, r)<1)
@@ -650,6 +656,8 @@ static void run_daemon( /* RETURN: nothing */
output->entropy_count = nbytes * 8;
if (ioctl(random_fd, RNDADDENTROPY, output) == -1)
printf("Warning: RNDADDENTROPY failed!");
+ if (params->once == 1)
+ return;
t[0] = t[1];
continue;
}
diff --git a/src/haveged.h b/src/haveged.h
index 6f38c17..e3dff92 100644
--- a/src/haveged.h
+++ b/src/haveged.h
@@ -32,6 +32,7 @@ struct pparams {
H_UINT buffersz; /* size of collection buffer (kb) */
H_UINT detached; /* non-zero if daemonized */
H_UINT foreground; /* non-zero if running in foreground */
+ H_UINT once; /* 1: refill entropy once and quit immediatelly */
H_UINT run_level; /* type of run 0=daemon,1=setup,2=pip,sample kb */
H_UINT d_cache; /* size of data cache (kb) */
H_UINT i_cache; /* size of instruction cache (kb) */
@@ -67,6 +68,7 @@ struct pparams {
#define SET_LWM 0x040
#define MULTI_CORE 0x080
#define CMD_MODE 0x100
+#define RUN_ONCE 0x200
/**
* Default tests settings
*/