mirror of
https://github.com/polhenarejos/pico-rng.git
synced 2026-04-09 17:25:51 +02:00
Update logging statements and added gif with FIPS 140-2 results using random bits from the Pico.
This commit is contained in:
@@ -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
|
||||

|
||||
|
||||
|
||||
# Remove
|
||||
```bash
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
BIN
pico-rng.gif
Executable file
BIN
pico-rng.gif
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
Reference in New Issue
Block a user