]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - src/initscripts/init.d/rngd
rngd: Mix-in RDRAND and reload for HWRNGs added at runtime.
[people/teissler/ipfire-2.x.git] / src / initscripts / init.d / rngd
index cc1c10d7cce5b73fdaceb24e56468f4fa4312de0..22437fdc4e5c2b4a9603d18a3f4d1fb521496c2a 100644 (file)
 . /etc/sysconfig/rc
 . ${rc_functions}
 
+function has_rdrand() {
+       grep -q "rdrand" /proc/cpuinfo
+}
+
+function has_hwrng() {
+       [ -e "/dev/hwrng" ]
+}
+
 case "${1}" in
        start)
-               if [ ! -e "/dev/hwrng" ]; then
-                       boot_mesg "No Hardware Random Number Generator found..." ${WARNING}
+               if ! has_hwrng && ! has_rdrand; then
+                       boot_mesg "No Hardware Random Number Generator found..."
                        echo_warning
                        exit 0
                fi
 
                boot_mesg "Starting Random Number Generator Daemon..."
-               loadproc /usr/sbin/rngd
+               loadproc /usr/sbin/rngd --no-tpm=1
                ;;
 
        stop)
@@ -38,6 +46,10 @@ case "${1}" in
                statusproc /usr/sbin/rngd
                ;;
 
+       udev-event)
+               $0 restart &>/dev/null
+               ;;
+
        *)
                echo "Usage: ${0} {start|stop|restart|status}"
                exit 1