linux/drivers/usb/misc/chaoskey.c

// SPDX-License-Identifier: GPL-2.0
/*
 * chaoskey - driver for ChaosKey device from Altus Metrum.
 *
 * This device provides true random numbers using a noise source based
 * on a reverse-biased p-n junction in avalanche breakdown. More
 * details can be found at http://chaoskey.org
 *
 * The driver connects to the kernel hardware RNG interface to provide
 * entropy for /dev/random and other kernel activities. It also offers
 * a separate /dev/ entry to allow for direct access to the random
 * bit stream.
 *
 * Copyright © 2015 Keith Packard <[email protected]>
 */

#include <linux/module.h>
#include <linux/slab.h>
#include <linux/usb.h>
#include <linux/wait.h>
#include <linux/hw_random.h>
#include <linux/mutex.h>
#include <linux/uaccess.h>

static struct usb_driver chaoskey_driver;
static struct usb_class_driver chaoskey_class;
static int chaoskey_rng_read(struct hwrng *rng, void *data,
			     size_t max, bool wait);

#define usb_dbg(usb_if, format, arg...)

#define usb_err(usb_if, format, arg...)

/* Version Information */
#define DRIVER_AUTHOR
#define DRIVER_DESC
#define DRIVER_SHORT

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();

#define CHAOSKEY_VENDOR_ID
#define CHAOSKEY_PRODUCT_ID

#define ALEA_VENDOR_ID
#define ALEA_PRODUCT_ID

#define CHAOSKEY_BUF_LEN

#define NAK_TIMEOUT
#define ALEA_FIRST_TIMEOUT

#ifdef CONFIG_USB_DYNAMIC_MINORS
#define USB_CHAOSKEY_MINOR_BASE
#else

/* IOWARRIOR_MINOR_BASE + 16, not official yet */
#define USB_CHAOSKEY_MINOR_BASE
#endif

static const struct usb_device_id chaoskey_table[] =;
MODULE_DEVICE_TABLE(usb, chaoskey_table);

static void chaos_read_callback(struct urb *urb);

/* Driver-local specific stuff */
struct chaoskey {};

static void chaoskey_free(struct chaoskey *dev)
{}

static int chaoskey_probe(struct usb_interface *interface,
			  const struct usb_device_id *id)
{}

static void chaoskey_disconnect(struct usb_interface *interface)
{}

static int chaoskey_open(struct inode *inode, struct file *file)
{}

static int chaoskey_release(struct inode *inode, struct file *file)
{}

static void chaos_read_callback(struct urb *urb)
{}

/* Fill the buffer. Called with dev->lock held
 */
static int _chaoskey_fill(struct chaoskey *dev)
{}

static ssize_t chaoskey_read(struct file *file,
			     char __user *buffer,
			     size_t count,
			     loff_t *ppos)
{}

static int chaoskey_rng_read(struct hwrng *rng, void *data,
			     size_t max, bool wait)
{}

#ifdef CONFIG_PM
static int chaoskey_suspend(struct usb_interface *interface,
			    pm_message_t message)
{}

static int chaoskey_resume(struct usb_interface *interface)
{}
#else
#define chaoskey_suspend
#define chaoskey_resume
#endif

/* file operation pointers */
static const struct file_operations chaoskey_fops =;

/* class driver information */
static struct usb_class_driver chaoskey_class =;

/* usb specific object needed to register this driver with the usb subsystem */
static struct usb_driver chaoskey_driver =;

module_usb_driver();