From 28707d202e56c9fe12492e3370fb56d920560642 Mon Sep 17 00:00:00 2001 From: Julien Massot Date: Wed, 3 Feb 2021 16:28:37 +0100 Subject: rng-tools: fix rngd_jitter initialization rngd daemon may spam the console when using an older version than 6.11. Backport patches from https://github.com/nhorman/rng-tools/pull/99/commits Signed-off-by: Julien Massot Signed-off-by: Steve Sakoman --- ...-always-read-from-entropy-pipe-before-set.patch | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 meta/recipes-support/rng-tools/rng-tools/0003-rngd_jitter-always-read-from-entropy-pipe-before-set.patch (limited to 'meta/recipes-support/rng-tools/rng-tools/0003-rngd_jitter-always-read-from-entropy-pipe-before-set.patch') diff --git a/meta/recipes-support/rng-tools/rng-tools/0003-rngd_jitter-always-read-from-entropy-pipe-before-set.patch b/meta/recipes-support/rng-tools/rng-tools/0003-rngd_jitter-always-read-from-entropy-pipe-before-set.patch new file mode 100644 index 0000000000..b3bc8028ea --- /dev/null +++ b/meta/recipes-support/rng-tools/rng-tools/0003-rngd_jitter-always-read-from-entropy-pipe-before-set.patch @@ -0,0 +1,38 @@ +From 36bc92ef2789b13183c8895d83665f48b13c2b9e Mon Sep 17 00:00:00 2001 +From: Matthias Schiffer +Date: Wed, 27 Jan 2021 16:22:39 +0100 +Subject: [PATCH] rngd_jitter: always read from entropy pipe before setting + O_NONBLOCK + +Even with AES disabled, we want to make sure that jent_read_entropy() has +already generated some entropy before we consider the the source +initialized. Otherwise "Entropy Generation is slow" log spam will be +emitteded until this has happened, which can take several seconds. + +Signed-off-by: Matthias Schiffer +--- + rngd_jitter.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/rngd_jitter.c b/rngd_jitter.c +index 48f344c..b736cdd 100644 +--- a/rngd_jitter.c ++++ b/rngd_jitter.c +@@ -492,6 +492,17 @@ int init_jitter_entropy_source(struct rng *ent_src) + message_entsrc(ent_src,LOG_CONS|LOG_INFO, "libgcrypt not available. Disabling AES in JITTER source\n"); + ent_src->rng_options[JITTER_OPT_USE_AES].int_val = 0; + #endif ++ } else { ++ /* ++ * Make sure that an entropy gathering thread has generated ++ * at least some entropy before setting O_NONBLOCK and finishing ++ * the entropy source initialization. ++ * ++ * This avoids "Entropy Generation is slow" log spamming that ++ * would otherwise happen until jent_read_entropy() has run ++ * for the first time. ++ */ ++ xread_jitter(&i, 1, ent_src); + } + message_entsrc(ent_src,LOG_DAEMON|LOG_INFO, "Enabling JITTER rng support\n"); + return 0; -- cgit 1.2.3-korg