Back to home page

LXR

 
 

    


0001 Introduction:
0002 
0003         The hw_random framework is software that makes use of a
0004         special hardware feature on your CPU or motherboard,
0005         a Random Number Generator (RNG).  The software has two parts:
0006         a core providing the /dev/hwrng character device and its
0007         sysfs support, plus a hardware-specific driver that plugs
0008         into that core.
0009 
0010         To make the most effective use of these mechanisms, you
0011         should download the support software as well.  Download the
0012         latest version of the "rng-tools" package from the
0013         hw_random driver's official Web site:
0014 
0015                 http://sourceforge.net/projects/gkernel/
0016 
0017         Those tools use /dev/hwrng to fill the kernel entropy pool,
0018         which is used internally and exported by the /dev/urandom and
0019         /dev/random special files.
0020 
0021 Theory of operation:
0022 
0023         CHARACTER DEVICE.  Using the standard open()
0024         and read() system calls, you can read random data from
0025         the hardware RNG device.  This data is NOT CHECKED by any
0026         fitness tests, and could potentially be bogus (if the
0027         hardware is faulty or has been tampered with).  Data is only
0028         output if the hardware "has-data" flag is set, but nevertheless
0029         a security-conscious person would run fitness tests on the
0030         data before assuming it is truly random.
0031 
0032         The rng-tools package uses such tests in "rngd", and lets you
0033         run them by hand with a "rngtest" utility.
0034 
0035         /dev/hwrng is char device major 10, minor 183.
0036 
0037         CLASS DEVICE.  There is a /sys/class/misc/hw_random node with
0038         two unique attributes, "rng_available" and "rng_current".  The
0039         "rng_available" attribute lists the hardware-specific drivers
0040         available, while "rng_current" lists the one which is currently
0041         connected to /dev/hwrng.  If your system has more than one
0042         RNG available, you may change the one used by writing a name from
0043         the list in "rng_available" into "rng_current".
0044 
0045 ==========================================================================
0046 
0047         Hardware driver for Intel/AMD/VIA Random Number Generators (RNG)
0048         Copyright 2000,2001 Jeff Garzik <jgarzik@pobox.com>
0049         Copyright 2000,2001 Philipp Rumpf <prumpf@mandrakesoft.com>
0050 
0051 
0052 About the Intel RNG hardware, from the firmware hub datasheet:
0053 
0054         The Firmware Hub integrates a Random Number Generator (RNG)
0055         using thermal noise generated from inherently random quantum
0056         mechanical properties of silicon. When not generating new random
0057         bits the RNG circuitry will enter a low power state. Intel will
0058         provide a binary software driver to give third party software
0059         access to our RNG for use as a security feature. At this time,
0060         the RNG is only to be used with a system in an OS-present state.
0061 
0062 Intel RNG Driver notes:
0063 
0064         * FIXME: support poll(2)
0065 
0066         NOTE: request_mem_region was removed, for three reasons:
0067         1) Only one RNG is supported by this driver, 2) The location
0068         used by the RNG is a fixed location in MMIO-addressable memory,
0069         3) users with properly working BIOS e820 handling will always
0070         have the region in which the RNG is located reserved, so
0071         request_mem_region calls always fail for proper setups.
0072         However, for people who use mem=XX, BIOS e820 information is
0073         -not- in /proc/iomem, and request_mem_region(RNG_ADDR) can
0074         succeed.
0075 
0076 Driver details:
0077 
0078         Based on:
0079         Intel 82802AB/82802AC Firmware Hub (FWH) Datasheet
0080                 May 1999 Order Number: 290658-002 R
0081 
0082         Intel 82802 Firmware Hub: Random Number Generator
0083         Programmer's Reference Manual
0084                 December 1999 Order Number: 298029-001 R
0085 
0086         Intel 82802 Firmware HUB Random Number Generator Driver
0087         Copyright (c) 2000 Matt Sottek <msottek@quiknet.com>
0088 
0089         Special thanks to Matt Sottek.  I did the "guts", he
0090         did the "brains" and all the testing.