diff --git a/README.md b/README.md index 236ccdc..cc85b09 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # Raspberry Pi Pico Random Number Generator -A basic random number generator that generates numbers from enviromental noise with the onboard DAC of the Raspberry Pi Pico. The project uses the Raspberry Pi Pico USB dev_lowlevel as a starting point. The RNG is not meant to be FIPS 140-2 compliant by any means. This is not meant to by used in a production system as a TRNG. Maybe one day the next gen Pico's will include an onboard crypto module. - +A basic random number generator that generates numbers from enviromental noise with the onboard DAC of the Raspberry Pi Pico. The project uses the Raspberry Pi Pico USB dev_lowlevel as a starting point. The Pico RNG is not meant to be FIPS 140-2 compliant as a stand-alone device by any means. However it does supply the Linux Kernel with random bits which can be used with the appropriate entropy to supply FIPS 140-2 compliant random numbers. Maybe one day the next gen Pico's will include an onboard crypto module. ## Project Goals * Raspberry Pi Pico firmware generates random numbers as a USB Endpoint. @@ -61,6 +60,9 @@ You can test Pico RNG firmware with the [pico_rng_test.py](firmware/pico_rng_tes sudo firmware/pico_rng_test.py [--performance] ``` +You can also test the Kernel's random number pool that contains random numbers from the Pico +![Pico Random Numbers](pico-rng.gif) + # Remove ```bash diff --git a/driver/pico_rng.c b/driver/pico_rng.c index ebd3483..a6fefab 100644 --- a/driver/pico_rng.c +++ b/driver/pico_rng.c @@ -133,14 +133,14 @@ static int pico_rng_usb_probe(struct usb_interface *interface, const struct usb_ module_data.dev = interface_to_usbdev(interface); if(!module_data.dev) { - LOGGER_ERR("Unable to locate usb device"); + LOGGER_ERR("Unable to locate usb device\n"); return retval; } module_data.interface = interface; if(!module_data.interface) { - LOGGER_ERR("Invalid interface"); + LOGGER_ERR("Invalid interface\n"); return retval; } @@ -153,7 +153,7 @@ static int pico_rng_usb_probe(struct usb_interface *interface, const struct usb_ module_data.pipe = usb_rcvbulkpipe(module_data.dev, module_data.endpoint->bEndpointAddress); - LOGGER_DEBUG("endpoint found %p with pipe %d", module_data.endpoint, module_data.pipe); + LOGGER_DEBUG("endpoint found %p with pipe %d\n", module_data.endpoint, module_data.pipe); retval = usb_register_dev(module_data.interface, &pico_rng_usb_class); if(retval) @@ -206,14 +206,14 @@ static ssize_t pico_rng_read(struct file *file, char __user *user_buffer, size_t buffer = kmalloc(module_data.endpoint->wMaxPacketSize, GFP_USER); if(!buffer) { - LOGGER_ERR("Failed to allocate buffer"); + LOGGER_ERR("Failed to allocate buffer\n"); return -EFAULT; } bytes_read = pico_rng_read_data(buffer, module_data.endpoint->wMaxPacketSize); if(!bytes_read) { - LOGGER_ERR("Failed to read data"); + LOGGER_ERR("Failed to read data\n"); return -EFAULT; } @@ -239,7 +239,7 @@ static int pico_rng_kthread(void *data) buffer = kmalloc(module_data.endpoint->wMaxPacketSize, GFP_NOWAIT); if(!buffer) { - LOGGER_ERR("RNG kthread failed to allocate buffer"); + LOGGER_ERR("RNG kthread failed to allocate buffer\n"); return -EFAULT; } diff --git a/pico-rng.gif b/pico-rng.gif new file mode 100755 index 0000000..131ae50 Binary files /dev/null and b/pico-rng.gif differ