Home Forums TrueRNG Hardware random number generator Ubuntu/Linux starting pointers

Tagged: , ,

This topic contains 0 replies, has 1 voice, and was last updated by  Pluus 4 years, 3 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #1078

    Pluus
    Member

    Some hints to get started with an arbitrary number of TrueRNG USB devices:

    udev : /etc/udev/rules.d/99-TrueRNG.rules :

    # ubld.it TrueRNG
    #
    # This rule creates a symlink to newly attached CDC-ACM device
    # Also includes fix for wrong termios settings on some linux kernels
    # New! includes ignore for modemmanger
    # (Thanks neoaeon)
    SUBSYSTEM==”tty”, ATTRS{product}==”TrueRNG”, SYMLINK+=”TrueRNG%n”, RUN+=”/bin/stty raw -echo -ixoff -F /dev/%k speed 3000000″
    ATTRS{idVendor}==”04d8″, ATTRS{idProduct}==”f5fe”, ENV{ID_MM_DEVICE_IGNORE}=”1″

    init: /etc/init/rng-tools.conf :

    description “rng-tools daemon”

    start on runlevel [2345]
    stop on runlevel [016]

    env DEVLIST=”$(find /dev/TrueRNG* -follow -type c)”

    pre-start script
    for device in $DEVLIST; do
    start rngd-instance DEVICE=$device || failed=”${failed}$device ”
    done
    test -n “$failed” || { echo “Failed to start instances: $failed”; exit 1; }
    end script

    init: /etc/init/rngd-instance.conf :

    stop on stopping rng-tools or runlevel [016]

    description “rngd instance”
    usage “DEVICE=full path to rng device”

    instance $DEVICE

    pre-start script
    test -c “$DEVICE” || { echo “Not a device: $DEVICE”; exit 1; }
    mkdir -p /var/run/rngd || { echo “Nope”; exit 1; }
    end script

    exec rngd –foreground –pidfile=/var/run/rngd/$(basename “$DEVICE”) -r $DEVICE

    user@host:/etc/init.d$ sudo ln -sf /lib/init/upstart-job rng-tools

    Done!

    Example output with 4 USB keys:

    $ sudo stop rng-tools
    $ sudo start rng-tools
    $ ps -ef|grep rngd
    root 19164 1 0 22:47 ttyACM0 00:00:14 rngd –foreground –pidfile=/var/run/rngd/TrueRNG0 -r /dev/TrueRNG0
    root 19172 1 0 22:47 ttyACM1 00:00:14 rngd –foreground –pidfile=/var/run/rngd/TrueRNG1 -r /dev/TrueRNG1
    root 19180 1 0 22:47 ttyACM2 00:00:15 rngd –foreground –pidfile=/var/run/rngd/TrueRNG2 -r /dev/TrueRNG2
    root 19185 1 0 22:47 ttyACM3 00:00:14 rngd –foreground –pidfile=/var/run/rngd/TrueRNG3 -r /dev/TrueRNG3


    $ pv < /dev/random > /dev/null
    254MB 0:00:15 [ 213kB/s]
    ^C

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.