Devin Reade wrote: > A while ago a posted a dmesg for a TRNG USB device (the MoonBase Otago > OneRNG) per > <http://openbsd-archive.7691.n7.nabble.com/dmesg-OneRNG-hardware-RNG-plugged-into-Soekris-5501-td276480.html>. > > I'm looking at adding support for this device but haven't splunked too > much into the OpenBSD kernel before, and I'm looking for advice. > > The OneRNG was manufactured to present itself as a modem and in the Linux > sample source code the (user space) process to first initialize the device > by echoing some commands to the device and then cat its output to rngd. > > For the OpenBSD side, I found /usr/src/sys/dev/usb/ualea.c which is > another USB-based TRNG. The model there would be to usbd_transfer(9) > from the device and then forward it via add_true_randomness(9). > > However, because the OneRNG was manufactured to look like a modem, > the other possibility is to have it recognised in > /usr/src/sys/dev/usb/umodem.c. If that's the case, though, it's > unclear to me what the mechanism should be to pull the data from the > OneRNG and give it to the kernel; presumably we don't want any > userspace code here. > > Am I correct in assuming that the ualea mechanism is probabably the > right way to go?
There is some line discipline code in kern/tty_nmea.c which may also provide some hints about interfacing with a serial device in the kernel. That said, there's nothing particularly wrong with doing this in userland.