aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDermot Bradley <dermot_bradley@yahoo.com>2021-01-22 15:05:12 +0000
committerLeo <thinkabit.ukim@gmail.com>2021-01-22 18:29:28 +0000
commit54565b0f96501118e883214dbc88b78f4f0fa9d5 (patch)
treea5a3c30c08ed80e8ede2176ddb11495b9ff7ac23
parentcd7ad45e7ea8aceec59c1dcf341a759848bef8aa (diff)
downloadaports-54565b0f96501118e883214dbc88b78f4f0fa9d5.tar.gz
aports-54565b0f96501118e883214dbc88b78f4f0fa9d5.tar.bz2
aports-54565b0f96501118e883214dbc88b78f4f0fa9d5.tar.xz
main/rng-tools: fix entropy sources list
Ensures that the output of "rngd --list" includes entropy sources that are enabled but not initialised.
-rw-r--r--main/rng-tools/02-fix-list-for-enabled-sources.patch62
-rw-r--r--main/rng-tools/APKBUILD6
2 files changed, 66 insertions, 2 deletions
diff --git a/main/rng-tools/02-fix-list-for-enabled-sources.patch b/main/rng-tools/02-fix-list-for-enabled-sources.patch
new file mode 100644
index 0000000000..480b9fdd60
--- /dev/null
+++ b/main/rng-tools/02-fix-list-for-enabled-sources.patch
@@ -0,0 +1,62 @@
+From: Dermot Bradley <dermot_bradley@yahoo.com>
+Date: Thu, 21 Jan 2021 19:47 +0000
+Subject: [PATCH] Add output to list option for entropy sources that failed init
+
+When we --list entropy source, it may be that a source is enabled at build
+time, but fails at run time due to lack of hw, etc. Those don't get
+reported with the --list option, so lets add them in for complete reporting.
+
+This patch is already present in upstream master and so can be removed
+in future after version update.
+
+---
+
+diff -aur a/rngd.c b/rngd.c
+--- a/rngd.c
++++ b/rngd.c
+@@ -857,6 +857,7 @@
+ found = 1;
+ message(LOG_CONS|LOG_INFO, "%d: %s (%s)\n", i,
+ entropy_sources[i].rng_name, entropy_sources[i].rng_sname);
++ entropy_sources[i].failed_init = false;
+ }
+ if (!found)
+ message(LOG_CONS|LOG_INFO, "None");
+@@ -874,9 +875,11 @@
+ ent_src->fipsctx = malloc(sizeof(fips_ctx_t));
+ fips_init(ent_src->fipsctx, discard_initial_data(ent_src));
+ message_entsrc(ent_src, LOG_DAEMON|LOG_INFO, "Initialized\n");
++ ent_src->failed_init = false;
+ } else {
+ message_entsrc(ent_src, LOG_DAEMON|LOG_ERR, "Initialization Failed\n");
+ ent_src->disabled = true;
++ ent_src->failed_init = true;
+ }
+ }
+ }
+@@ -891,6 +894,14 @@
+ message(LOG_CONS|LOG_INFO, "%d: %s (%s)\n", i,
+ entropy_sources[i].rng_name, entropy_sources[i].rng_sname);
+ }
++ message(LOG_CONS|LOG_INFO, "Available entropy sources that failed initalization:\n");
++ for (i=0; i < ENT_MAX; i++)
++ if (entropy_sources[i].init && entropy_sources[i].disabled == true && entropy_sources[i].failed_init == true) {
++ rc = 1;
++ message(LOG_CONS|LOG_INFO, "%d: %s (%s)\n", i,
++ entropy_sources[i].rng_name, entropy_sources[i].rng_sname);
++ }
++
+ quiet = true;
+ close_all_entropy_sources();
+ return rc;
+diff -aur a/rngd.h b/rngd.h
+--- a/rngd.h
++++ b/rngd.h
+@@ -140,6 +140,7 @@
+ char *rng_fname;
+ int rng_fd;
+ bool disabled;
++ bool failed_init;
+ int failures;
+ int success;
+ size_t ent_gathered;
diff --git a/main/rng-tools/APKBUILD b/main/rng-tools/APKBUILD
index b3d60995ff..cdddc667ed 100644
--- a/main/rng-tools/APKBUILD
+++ b/main/rng-tools/APKBUILD
@@ -4,7 +4,7 @@
# Maintainer: Dermot Bradley <dermot_bradley@yahoo.com>
pkgname=rng-tools
pkgver=6.11
-pkgrel=0
+pkgrel=1
pkgdesc="Random number generator daemon"
url="https://github.com/nhorman/rng-tools"
arch="all"
@@ -36,6 +36,7 @@ source="rng-tools-$pkgver.tar.gz::https://github.com/nhorman/rng-tools/archive/V
rngd-extra.confd
rngd-extra.initd
01-fix-jitter-format-warning.patch
+ 02-fix-list-for-enabled-sources.patch
"
prepare() {
@@ -109,4 +110,5 @@ sha512sums="0058ca5d0c1ddb554284fe8e6b9c0b85f130e0b9e0b9f0f0219f434302766e07c321
08d268b7c00ce5ec2ad69c1b75a53e24e43cabe1dca309c6d693f8681e84b09688bbb8e85594d456cf34b891172e7e6c4f22b5c96c4a76f1e73a6475d70acc1e rngd.initd
ee33fd5fbdb0bdad8cb4373f71dc2e2cfdbc554151516daef915f7e6c26e694befd982128794147fb73b15e2ebdbc530b85f9051545967674451cdef23aa1b3d rngd-extra.confd
63a8c2cc6aa9be1705ce356988b5f7458d576bb349ae2b388713c971083e407e4877507878f9216304221e99767853d5ca85ac87d2faac99b6e942670e44c891 rngd-extra.initd
-9dbcf618d1cb1c4ec8941676d18979c8b221c2377c421d539e5a7104d6fc6c13f0744b467079d3caf21976a50fcde60a4879c5ebad9fb3e74e282970ab438fe0 01-fix-jitter-format-warning.patch"
+9dbcf618d1cb1c4ec8941676d18979c8b221c2377c421d539e5a7104d6fc6c13f0744b467079d3caf21976a50fcde60a4879c5ebad9fb3e74e282970ab438fe0 01-fix-jitter-format-warning.patch
+ca96e33f9523a0a3c3b27ff99341b6cff44bab8570647cf2dc853988a245c961e0abb6c125517b4333e9813ae3ea0f53b5acb829862bfbd99e6891c4198d39b0 02-fix-list-for-enabled-sources.patch"