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.ciocaltea@gmail.com>
[commit subject tweak, uloop_done cleanup]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
return false;
}
- uloop_fd_add(&u->rnd_fd, ULOOP_READ);
+ uloop_fd_add(&u->rnd_fd, ULOOP_WRITE);
return true;
}
ulog_open(ulog_channels, LOG_DAEMON, "urngd");
- if (!urngd_init(&urngd_service))
+ uloop_init();
+ if (!urngd_init(&urngd_service)) {
+ uloop_done();
return -1;
+ }
LOG("v%s started.\n", URNGD_VERSION);
gather_entropy(&urngd_service);
- uloop_init();
uloop_run();
uloop_done();