From: Cristian Ciocaltea <cristian.ciocal...@gmail.com>

The OpenWrt Jitter RNG daemon is currently unable to continuously
provide entropy, except once on process startup.

This patch brings the following fixes:
- poll /dev/random for unblocking write operations, instead of read
- register the low entropy callback after uloop initialization, not
  before

Signed-off-by: Cristian Ciocaltea <cristian.ciocal...@gmail.com>
---
 urngd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/urngd.c b/urngd.c
index d8ed159..91dc72c 100644
--- a/urngd.c
+++ b/urngd.c
@@ -180,7 +180,7 @@ static bool urngd_init(struct urngd *u)
                return false;
        }
 
-       uloop_fd_add(&u->rnd_fd, ULOOP_READ);
+       uloop_fd_add(&u->rnd_fd, ULOOP_WRITE);
 
        return true;
 }
@@ -227,6 +227,7 @@ int main(int argc, char **argv)
 
        ulog_open(ulog_channels, LOG_DAEMON, "urngd");
 
+       uloop_init();
        if (!urngd_init(&urngd_service))
                return -1;
 
@@ -234,7 +235,6 @@ int main(int argc, char **argv)
 
        gather_entropy(&urngd_service);
 
-       uloop_init();
        uloop_run();
        uloop_done();
 
-- 
2.17.1


_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to