summaryrefslogtreecommitdiffstats
path: root/meta-agl-core/recipes-support/rng-tools/rng-tools/0003-rngd_jitter-always-read-from-entropy-pipe-before-set.patch
diff options
context:
space:
mode:
authorJulien Massot <julien.massot@iot.bzh>2021-01-28 08:36:05 +0000
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2021-02-04 15:38:11 +0000
commit446c37c2d9e1337ccbfecef8dbf7a2de73fbc035 (patch)
treee834125586ae381e8893457cbd62c354157609b5 /meta-agl-core/recipes-support/rng-tools/rng-tools/0003-rngd_jitter-always-read-from-entropy-pipe-before-set.patch
parentdd86e53d3eabcb5cd30b3ddda82b4c2de22c8c38 (diff)
meta-agl-core: fix entropy gathering on rng-tools 6.9
Bug-AGL: SPEC-3775 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, while waiting for an update of rng-tools (>= 6.11) in poky repository. Change-Id: Icf55a648d4c30a3c94d2afaee91e6c0a2207a130 Signed-off-by: Julien Massot <julien.massot@iot.bzh> Change-Id: I08d1856ca6bd0be76b3c7fe0a962d73cebe8bef7 Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl/+/25970 Tested-by: Jenkins Job builder account ci-image-build: Jenkins Job builder account ci-image-boot-test: Jenkins Job builder account Reviewed-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
Diffstat (limited to 'meta-agl-core/recipes-support/rng-tools/rng-tools/0003-rngd_jitter-always-read-from-entropy-pipe-before-set.patch')
-rw-r--r--meta-agl-core/recipes-support/rng-tools/rng-tools/0003-rngd_jitter-always-read-from-entropy-pipe-before-set.patch38
1 files changed, 38 insertions, 0 deletions
diff --git a/meta-agl-core/recipes-support/rng-tools/rng-tools/0003-rngd_jitter-always-read-from-entropy-pipe-before-set.patch b/meta-agl-core/recipes-support/rng-tools/rng-tools/0003-rngd_jitter-always-read-from-entropy-pipe-before-set.patch
new file mode 100644
index 000000000..b3bc8028e
--- /dev/null
+++ b/meta-agl-core/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 <matthias.schiffer@tq-group.com>
+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 <matthias.schiffer@tq-group.com>
+---
+ 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;