summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support
diff options
context:
space:
mode:
authorJoe Slater <joe.slater@windriver.com>2018-01-25 12:44:49 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-02-06 11:06:27 +0000
commit5f0c4c785d7c6daa25cfd5e4ff939afb0ff2294a (patch)
tree0723cd0303f4cb6fae43af8afad43a4aab706ba5 /meta/recipes-support
parent1d22ecc138dd0edb209e0873576dde11a1794691 (diff)
downloadpoky-5f0c4c785d7c6daa25cfd5e4ff939afb0ff2294a.tar.gz
rng-tools: modify 'read error' message
Expand messages output if entropy data cannot be read. (From OE-Core rev: 23cf9be2065d6ea01f6d10cbed64a590c31e5bfc) Signed-off-by: Joe Slater <joe.slater@windriver.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-support')
-rw-r--r--meta/recipes-support/rng-tools/rng-tools/read_error_msg.patch98
-rw-r--r--meta/recipes-support/rng-tools/rng-tools_5.bb1
2 files changed, 99 insertions, 0 deletions
diff --git a/meta/recipes-support/rng-tools/rng-tools/read_error_msg.patch b/meta/recipes-support/rng-tools/rng-tools/read_error_msg.patch
new file mode 100644
index 0000000000..8aa13bf8b8
--- /dev/null
+++ b/meta/recipes-support/rng-tools/rng-tools/read_error_msg.patch
@@ -0,0 +1,98 @@
1rng-tools: modify 'read error' message
2
3Make the 'read error' message more descriptive.
4
5Copied from https://bugzilla.redhat.com/attachment.cgi?id=1295857
6and modified in one place to apply successfully. Error message during
7bootstrap modified to show device name.
8
9Upstream-Status: pending
10
11Signed-off-by: Joe Slater <joe.slater@windriver.com>
12
13
14--- a/rngd.c
15+++ b/rngd.c
16@@ -247,8 +247,11 @@ static void do_loop(int random_step)
17 continue; /* failed, no work */
18
19 retval = iter->xread(buf, sizeof buf, iter);
20- if (retval)
21+ if (retval) {
22+ message(LOG_DAEMON|LOG_ERR,
23+ "Error reading from entropy source\n");
24 continue; /* failed, no work */
25+ }
26
27 work_done = true;
28
29--- a/rngd_entsource.c
30+++ b/rngd_entsource.c
31@@ -63,10 +63,8 @@ int xread(void *buf, size_t size, struct
32 size -= r;
33 }
34
35- if (size) {
36- message(LOG_DAEMON|LOG_ERR, "read error\n");
37+ if (size)
38 return -1;
39- }
40 return 0;
41 }
42
43@@ -152,7 +150,7 @@ error_out:
44 }
45
46 /* Initialize entropy source */
47-static int discard_initial_data(struct rng *ent_src)
48+static int discard_initial_data(struct rng *ent_src, int *buf)
49 {
50 /* Trash 32 bits of what is probably stale (non-random)
51 * initial state from the RNG. For Intel's, 8 bits would
52@@ -164,10 +162,12 @@ static int discard_initial_data(struct r
53 xread(tempbuf, sizeof(tempbuf), ent_src);
54
55 /* Return 32 bits of bootstrap data */
56- xread(tempbuf, sizeof(tempbuf), ent_src);
57+ if (xread(tempbuf, sizeof(tempbuf), ent_src) != 0)
58+ return -1;
59
60- return tempbuf[0] | (tempbuf[1] << 8) |
61+ *buf = tempbuf[0] | (tempbuf[1] << 8) |
62 (tempbuf[2] << 16) | (tempbuf[3] << 24);
63+ return 0;
64 }
65
66 /*
67@@ -175,6 +175,8 @@ static int discard_initial_data(struct r
68 */
69 int init_entropy_source(struct rng *ent_src)
70 {
71+ int bootstrap;
72+
73 ent_src->rng_fd = open(ent_src->rng_name, O_RDONLY);
74 if (ent_src->rng_fd == -1) {
75 return 1;
76@@ -182,7 +184,11 @@ int init_entropy_source(struct rng *ent_
77 src_list_add(ent_src);
78 /* Bootstrap FIPS tests */
79 ent_src->fipsctx = malloc(sizeof(fips_ctx_t));
80- fips_init(ent_src->fipsctx, discard_initial_data(ent_src));
81+ if (discard_initial_data(ent_src, &bootstrap) != 0) {
82+ message(LOG_ERR|LOG_INFO, "Read failure in %s during bootstrap\n",ent_src->rng_name);
83+ return 1;
84+ }
85+ fips_init(ent_src->fipsctx, bootstrap);
86 return 0;
87 }
88
89--- a/rngtest.c
90+++ b/rngtest.c
91@@ -335,6 +335,7 @@ static int discard_initial_data(void)
92
93 return tempbuf[0] | (tempbuf[1] << 8) |
94 (tempbuf[2] << 16) | (tempbuf[3] << 24);
95+
96 }
97
98 static void do_rng_fips_test_loop( void )
diff --git a/meta/recipes-support/rng-tools/rng-tools_5.bb b/meta/recipes-support/rng-tools/rng-tools_5.bb
index 4a66bed643..b3c9fd9745 100644
--- a/meta/recipes-support/rng-tools/rng-tools_5.bb
+++ b/meta/recipes-support/rng-tools/rng-tools_5.bb
@@ -7,6 +7,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/gkernel/${BP}.tar.gz \
7 file://0002-Add-argument-to-control-the-libargp-dependency.patch \ 7 file://0002-Add-argument-to-control-the-libargp-dependency.patch \
8 file://underquote.patch \ 8 file://underquote.patch \
9 file://rng-tools-5-fix-textrels-on-PIC-x86.patch \ 9 file://rng-tools-5-fix-textrels-on-PIC-x86.patch \
10 file://read_error_msg.patch \
10 file://init \ 11 file://init \
11 file://default \ 12 file://default \
12 file://rngd.service \ 13 file://rngd.service \