2

I've got a NeuG hardware true random number generator (http://www.gniibe.org/memo/development/gnuk/rng/neug.html) and its page says that it runs on GNU/Linux systems as /dev/ttyACM0

Can I configure /dev/random to use NeuG for its randomness? If so, how? And how do I check that /dev/random is indeed using NeuG?

1

Answer adapted from SuperUser: https://superuser.com/questions/309840/how-can-i-point-dev-random-to-dev-urandom

All you need to do is to create something like /etc/udev/rules.d/70-harware-randomizer-enable.rules with the following contents:

# /etc/udev/rules.d/70-disable-random-entropy-estimation.rules
# Disables /dev/random entropy estimation (it's mostly snake oil anyway).
#
# udevd will warn that the kernel-provided name 'random' and NAME= 'ttyACM0'
# disagree.  You can ignore this warning.

# Use /dev/ttyACM0 instead of /dev/random for the entropy-estimating RNG.
KERNEL=="random", NAME="ttyACM0"

# Remove any existing /dev/random, then create symlink /dev/random pointing to
# /dev/urandom
KERNEL=="urandom", PROGRAM+="/bin/rm -f /dev/random", SYMLINK+="random"
  • Aha, this makes a lot of sense!!! Thank you very much. Out of curiosity, why is /dev/random entropy estimation "mostly snake oil anyway"????? – hpy Mar 27 '17 at 19:11
  • 1
    There has been quite a bit of discussion about this. It is a very complex and contradictory subject, maybe this link can shed some light kingbloom.com/cp/1999-04/0112.html . It is a very old post about BSD, but the (supposed) issue is pretty much the same – Bruno9779 Mar 27 '17 at 19:18
  • 1
    Uh, why would you do that? As opposed to using the HRNG to inject entropy into the kernel pool and leaving the /dev/random and /dev/urandom device nodes well alone? – Gilles Mar 27 '17 at 23:49
  • @Gilles thanks for your comment, how do I do this (I.e. use the HRNG to inject entropy into the kernel pool)? And how does this method compare to the udev method? Pros/cons?? – hpy Mar 28 '17 at 9:45
1

I can't remember if I did anything else, but it seems that I created /etc/systemd/system/rngd@.service with the following:

[Unit]
Description=rngd service on %I

[Service]
Type=simple
ExecStartPre=/bin/stty -F /dev/%I raw -echo -parenb
ExecStart=/usr/sbin/rngd -f --fill-watermark=4000 --rng-device=/dev/%I

Then, sudo systemctl enable rngd@ttyACM0.service and sudo systemctl start rngd@ttyACM0.service

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.