Hi all,
I have been looking at the Neug random number generator. This is a
$40 minimalist STM32F103 board from Japan that can be flashed with open source
firmware to operate as a openPGP token (called Gnuk) or a RNG (Neug).
http://www.seeedstudio.com/wiki/FST-01
http://www.seeedstudio.com/depot/FST01-with-White-Enclosure-p-1279.html?cPath
=6_12
The following script in linux will set the mode then inject the
conditioned entropy from this device into the random pool. I need a similar
script for OpenBSD.
The NeuG device is seen as standard USB-CDC device. On
GNU/Linux, it is something like /dev/ttyACM0. Configured by stty,
$ stty -F
/dev/ttyACM0 -echo raw
/dev/ttyACM0 becomes random binary stream.
>
install.sh
#! /bin/sh
apt-get update
apt-get install rng-tools
cp
90-neug.rules /etc/udev/rules.d/
cp ctrl_rng.sh /etc/udev
> ctrl_rng.sh
#!
/bin/sh
PIDFILE=/var/run/rngd.pid
case "$ACTION" in
add)
stty -F $DEVNAME
raw -echo -parenb
/usr/sbin/rngd --fill-watermark=90% --feed-interval=1
--rng-device=$DEVNAME
;;
remove)
# This will be called twice, since there
are two interfaces for the device.
# Called once for 10/0/0, another for
2/2/1.
if [ x$INTERFACE = x"2/2/1" -a -f $PIDFILE ]; then
kill
-SIGTERM `cat $PIDFILE`
rm -f $PIDFILE
else
exit 0
fi
;;
esac
exit 0
> 90-neug.rules
KERNEL=="ttyACM[0-9]*", SUBSYSTEMS=="usb",
ACTION=="add", \
ATTRS{idVendor}=="234b", ATTRS{idProduct}=="0001", \
RUN+="/etc/udev/ctrl_rng.sh"
KERNEL=="ttyACM[0-9]*", SUBSYSTEMS=="usb",
ACTION=="remove", \
ATTRS{idVendor}=="234b", ATTRS{idProduct}=="0001", \
RUN+="/etc/udev/ctrl_rng.sh"
After that I can run 'watch cat
/proc/sys/kernel/random/entropy_avail' and see the entropy is being added to
the pool. I need a similar command for OBSD to verify operation.