summary refs log tree commit diff
path: root/gnu/services
diff options
context:
space:
mode:
authorLeo Famulari <leo@famulari.name>2017-12-21 13:58:35 -0500
committerLeo Famulari <leo@famulari.name>2017-12-21 13:58:35 -0500
commitf76fc968669721e3baa6a0662da8e9e9f5da66cf (patch)
treeae58b84d89f144fbec974b7e75b24574f99b2e33 /gnu/services
parent24ee3b28c6def91e4e41dd46441a029ab01b6d00 (diff)
parent5dc0e0b055ce2ab12c40066cee34511cd7a5cf03 (diff)
downloadguix-f76fc968669721e3baa6a0662da8e9e9f5da66cf.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'gnu/services')
-rw-r--r--gnu/services/base.scm18
1 files changed, 18 insertions, 0 deletions
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 5e08927af3..a3654fd4d3 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -516,6 +516,24 @@ stopped before 'kill' is called."
                           (call-with-output-file "/dev/urandom"
                             (lambda (urandom)
                               (dump-port seed urandom))))))
+
+                    ;; Try writing from /dev/hwrng into /dev/urandom.
+                    ;; It seems that the file /dev/hwrng always exists, even
+                    ;; when there is no hardware random number generator
+                    ;; available. So, we handle a failed read or any other error
+                    ;; reported by the operating system.
+                    (let ((buf (catch 'system-error
+                                 (lambda ()
+                                   (call-with-input-file "/dev/hwrng"
+                                     (lambda (hwrng)
+                                       (get-bytevector-n hwrng 512))))
+                                 ;; Silence is golden...
+                                 (const #f))))
+                      (when buf
+                        (call-with-output-file "/dev/urandom"
+                          (lambda (urandom)
+                            (put-bytevector urandom buf)))))
+
                     ;; Immediately refresh the seed in case the system doesn't
                     ;; shut down cleanly.
                     (call-with-input-file "/dev/urandom"