From: Nadav Har'El <n...@scylladb.com>
Committer: Nadav Har'El <n...@scylladb.com>
Branch: master
rng: ignore zero bytes sent by an entropy source
If we get zero bytes from an entropy source, we should obviously do
nothing with this input. But it's not clear that entropy_processor()
really ignores zero bytes as expected, so let's explicitly ignore
such input.
Signed-off-by: Nadav Har'El <n...@scylladb.com>
Message-Id: <1479377119-18146-1-git-send-email-...@scylladb.com>
Reviewed-by: Pekka Enberg <penb...@scylladb.com>
---
diff --git a/bsd/sys/dev/random/live_entropy_sources.cc
b/bsd/sys/dev/random/live_entropy_sources.cc
--- a/bsd/sys/dev/random/live_entropy_sources.cc
+++ b/bsd/sys/dev/random/live_entropy_sources.cc
@@ -171,6 +171,9 @@ live_entropy_sources_feed(int rounds, event_proc_f
entropy_processor)
/* FIXME: Whine loudly if this didn't work. */
n = les->rsource->read(buf, sizeof(buf));
n = MIN(n, HARVESTSIZE);
+ if (n == 0) {
+ continue;
+ }
event.somecounter = get_cyclecount();
event.size = n;
@@ -209,4 +212,4 @@ SYSINIT(random_adaptors, SI_SUB_DRIVERS, SI_ORDER_FIRST,
live_entropy_sources_init, NULL);
SYSUNINIT(random_adaptors, SI_SUB_DRIVERS, SI_ORDER_FIRST,
live_entropy_sources_deinit, NULL);
-#endif
\ No newline at end of file
+#endif
--
You received this message because you are subscribed to the Google Groups "OSv
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.