This patch allow to select between /dev/hwrng and /dev/urandom.

Also updates rng-tools to the last version.

Signed off by: José Vázquez Fernández <ppvazquez...@gmail.com>

diff --git a/utils/rng-tools/Config.in b/utils/rng-tools/Config.in
new file mode 100644
index 0000000..4f7b4d3
--- /dev/null
+++ b/utils/rng-tools/Config.in
@@ -0,0 +1,19 @@
+menu "Configuration"
+       depends on PACKAGE_rng-tools
+
+config RNGD_URANDOM
+       bool
+       default y
+       prompt "Collect entropy from pseudorandom number generator"
+       help
+         This is the default option for the most of the boards.
+
+config RNGD_HWRNG
+       bool
+       default n
+       prompt "Collect entropy from hardware random number generator"
+       help
+         Use this option only if your board has an enabled
+         hardware random number generator, otherwise use the 
+         pseudorandom number generator.
+endmenu
diff --git a/utils/rng-tools/Makefile b/utils/rng-tools/Makefile
index 474589c..f9f2add 100644
--- a/utils/rng-tools/Makefile
+++ b/utils/rng-tools/Makefile
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=rng-tools
-PKG_VERSION:=3
+PKG_VERSION:=4
 PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://downloads.sourceforge.net/project/gkernel/rng-tools/3/
-PKG_MD5SUM:=fa305916ec101c85c0065aeceb81a38d
+PKG_SOURCE_URL:=http://downloads.sourceforge.net/project/gkernel/rng-tools/4/
+PKG_MD5SUM:=ae89dbfcf08bdfbea19066cfbf599127
 
 PKG_FIXUP:=autoreconf
 
@@ -23,8 +23,13 @@ define Package/rng-tools
   SECTION:=utils
   CATEGORY:=Utilities
   DEPENDS:=+USE_UCLIBC:argp-standalone
-  TITLE:=Daemon for adding entropy to kernel entropy pool
+  TITLE:=Daemon for adding entropy to kernel entropy pool.
   URL:=http://sourceforge.net/projects/gkernel/
+  MENU:=1
+endef
+
+define Package/rng-tools/config
+       source "$(SOURCE)/Config.in"
 endef
 
 ifdef CONFIG_USE_UCLIBC
@@ -32,6 +37,7 @@ CONFIGURE_VARS += \
     LIBS="-largp"
 endif
 
+ifdef CONFIG_RNGD_URANDOM
 define Package/rng-tools/install
        $(INSTALL_DIR) $(1)/etc/init.d
        $(INSTALL_BIN) ./files/rngd.init $(1)/etc/init.d/rngd
@@ -40,5 +46,17 @@ define Package/rng-tools/install
        $(INSTALL_DIR) $(1)/sbin
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/rngd $(1)/sbin/
 endef
+endif
+
+ifdef CONFIG_RNGD_HWRNG
+define Package/rng-tools/install
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/hwrngd.init $(1)/etc/init.d/rngd
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/rngtest $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/rngd $(1)/sbin/
+endef
+endif
 
 $(eval $(call BuildPackage,rng-tools))
diff --git a/utils/rng-tools/files/hwrngd.init
b/utils/rng-tools/files/hwrngd.init
new file mode 100644
index 0000000..40ed6fd
--- /dev/null
+++ b/utils/rng-tools/files/hwrngd.init
@@ -0,0 +1,16 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2011 OpenWrt.org
+
+START=98
+
+RNGD_INTERVAL=30
+RNGD_AMOUNT=4000
+RNGD_DEVICE="/dev/hwrng"
+
+start() {
+       service_start /sbin/rngd -r $RNGD_DEVICE -W $RNGD_AMOUNT -t
$RNGD_INTERVAL
+}
+
+stop() {
+       service_stop /sbin/rngd
+} 
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to