[OpenWrt-Devel] [PATCH RFC 1/5] urng: add micro non-physical true RNG based on timing jitter

Petr Štetiar ynezz at true.cz
Mon May 20 12:13:21 EDT 2019


μ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.

Signed-off-by: Petr Štetiar <ynezz at true.cz>
---
 package/system/urngd/Makefile         | 48 +++++++++++++++++++++++++++++++++++
 package/system/urngd/files/urngd.init | 21 +++++++++++++++
 2 files changed, 69 insertions(+)
 create mode 100644 package/system/urngd/Makefile
 create mode 100755 package/system/urngd/files/urngd.init

diff --git a/package/system/urngd/Makefile b/package/system/urngd/Makefile
new file mode 100644
index 000000000000..95647487cbbf
--- /dev/null
+++ b/package/system/urngd/Makefile
@@ -0,0 +1,48 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=urngd
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL=https://github.com/ynezz/openwrt-urngd
+PKG_SOURCE_DATE:=2019-05-20
+PKG_SOURCE_VERSION:=7146f0c33c4f68883e60169066a4a863ae388fc5
+PKG_MIRROR_HASH:=839b1b23163bc907625ed6c6122faec9404cb72d8587ece796a9cec1422b6077
+
+PKG_LICENSE:=GPL-2.0 BSD-3-Clause
+PKG_LICENSE_FILES:=
+
+PKG_BUILD_PARALLEL:=1
+
+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
+endef
+
+define Package/$(PKG_NAME)/description
+  μ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.
+endef
+
+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)
+endef
+
+$(eval $(call BuildPackage,$(PKG_NAME)))
diff --git a/package/system/urngd/files/urngd.init b/package/system/urngd/files/urngd.init
new file mode 100755
index 000000000000..ab1d5cf9d46a
--- /dev/null
+++ b/package/system/urngd/files/urngd.init
@@ -0,0 +1,21 @@
+#!/bin/sh /etc/rc.common
+
+START=00
+
+USE_PROCD=1
+NAME=urngd
+PROG=/sbin/urngd
+
+start_service() {
+	procd_open_instance
+	procd_set_param command "$PROG"
+	procd_close_instance
+}
+
+stop() {
+	service_stop $PROG
+}
+
+reload() {
+	service_reload $PROG
+}
-- 
1.9.1


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


More information about the openwrt-devel mailing list