urng: add micro non-physical true RNG based on timing jitter
authorPetr Štetiar <ynezz@true.cz>
Mon, 20 May 2019 12:02:20 +0000 (14:02 +0200)
committerPetr Štetiar <ynezz@true.cz>
Tue, 11 Jun 2019 06:06:28 +0000 (08:06 +0200)
μrngd is OpenWrt's micro non-physical true random number generator based
on timing jitter.

Using the Jitter RNG core, the rngd provides an entropy source that
feeds into the Linux /dev/random device if its entropy runs low. It
updates the /dev/random entropy estimator such that the newly provided
entropy unblocks /dev/random.

The seeding of /dev/random also ensures that /dev/urandom benefits from
entropy. Especially during boot time, when the entropy of Linux is low,
the Jitter RNGd provides a source of sufficient entropy.

Tested-by: Lucian Cristian <lucian.cristian@gmail.com>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
package/system/urngd/Makefile [new file with mode: 0644]
package/system/urngd/files/urngd.init [new file with mode: 0644]

diff --git a/package/system/urngd/Makefile b/package/system/urngd/Makefile
new file mode 100644 (file)
index 0000000..218d602
--- /dev/null
@@ -0,0 +1,48 @@
+include $(TOPDIR)/rules.mk
+PKG_LICENSE:=GPL-2.0 BSD-3-Clause
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/cmake.mk
+define Package/$(PKG_NAME)
+  SECTION:=utils
+  CATEGORY:=Base system
+  TITLE:=OpenWrt non-physical true random number generator based on timing jitter
+  DEPENDS:=+libubox
+define Package/$(PKG_NAME)/description
+  urngd is OpenWrt's micro non-physical true random number generator based on
+  timing jitter.
+  Using the Jitter RNG core, the rngd provides an entropy source that feeds into
+  the Linux /dev/random device if its entropy runs low. It updates the
+  /dev/random entropy estimator such that the newly provided entropy unblocks
+  /dev/random.
+  The seeding of /dev/random also ensures that /dev/urandom benefits from
+  entropy. Especially during boot time, when the entropy of Linux is low, the
+  Jitter RNGd provides a source of sufficient entropy.
+define Package/$(PKG_NAME)/install
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME)
+       $(INSTALL_DIR) $(1)/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/sbin/$(PKG_NAME)
+$(eval $(call BuildPackage,$(PKG_NAME)))
diff --git a/package/system/urngd/files/urngd.init b/package/system/urngd/files/urngd.init
new file mode 100644 (file)
index 0000000..7531ca8
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh /etc/rc.common
+start_service() {
+       procd_open_instance
+       procd_set_param command "$PROG"
+       procd_close_instance
+reload_service() {
+       procd_send_signal $PROG