brintos

brintos / linux-shallow public Read only

0
0
Text · 3.6 KiB · bfc39f1 Raw
105 lines · plain
1=================================2Hardware random number generators3=================================4 5Introduction6============7 8The hw_random framework is software that makes use of a9special hardware feature on your CPU or motherboard,10a Random Number Generator (RNG).  The software has two parts:11a core providing the /dev/hwrng character device and its12sysfs support, plus a hardware-specific driver that plugs13into that core.14 15To make the most effective use of these mechanisms, you16should download the support software as well.  Download the17latest version of the "rng-tools" package from:18 19	https://github.com/nhorman/rng-tools20 21Those tools use /dev/hwrng to fill the kernel entropy pool,22which is used internally and exported by the /dev/urandom and23/dev/random special files.24 25Theory of operation26===================27 28CHARACTER DEVICE.  Using the standard open()29and read() system calls, you can read random data from30the hardware RNG device.  This data is NOT CHECKED by any31fitness tests, and could potentially be bogus (if the32hardware is faulty or has been tampered with).  Data is only33output if the hardware "has-data" flag is set, but nevertheless34a security-conscious person would run fitness tests on the35data before assuming it is truly random.36 37The rng-tools package uses such tests in "rngd", and lets you38run them by hand with a "rngtest" utility.39 40/dev/hwrng is char device major 10, minor 183.41 42CLASS DEVICE.  There is a /sys/class/misc/hw_random node with43two unique attributes, "rng_available" and "rng_current".  The44"rng_available" attribute lists the hardware-specific drivers45available, while "rng_current" lists the one which is currently46connected to /dev/hwrng.  If your system has more than one47RNG available, you may change the one used by writing a name from48the list in "rng_available" into "rng_current".49 50==========================================================================51 52 53Hardware driver for Intel/AMD/VIA Random Number Generators (RNG)54	- Copyright 2000,2001 Jeff Garzik <jgarzik@pobox.com>55	- Copyright 2000,2001 Philipp Rumpf <prumpf@mandrakesoft.com>56 57 58About the Intel RNG hardware, from the firmware hub datasheet59=============================================================60 61The Firmware Hub integrates a Random Number Generator (RNG)62using thermal noise generated from inherently random quantum63mechanical properties of silicon. When not generating new random64bits the RNG circuitry will enter a low power state. Intel will65provide a binary software driver to give third party software66access to our RNG for use as a security feature. At this time,67the RNG is only to be used with a system in an OS-present state.68 69Intel RNG Driver notes70======================71 72FIXME: support poll(2)73 74.. note::75 76	request_mem_region was removed, for three reasons:77 78	1) Only one RNG is supported by this driver;79	2) The location used by the RNG is a fixed location in80	   MMIO-addressable memory;81	3) users with properly working BIOS e820 handling will always82	   have the region in which the RNG is located reserved, so83	   request_mem_region calls always fail for proper setups.84	   However, for people who use mem=XX, BIOS e820 information is85	   **not** in /proc/iomem, and request_mem_region(RNG_ADDR) can86	   succeed.87 88Driver details89==============90 91Based on:92	Intel 82802AB/82802AC Firmware Hub (FWH) Datasheet93	May 1999 Order Number: 290658-002 R94 95Intel 82802 Firmware Hub:96	Random Number Generator97	Programmer's Reference Manual98	December 1999 Order Number: 298029-001 R99 100Intel 82802 Firmware HUB Random Number Generator Driver101	Copyright (c) 2000 Matt Sottek <msottek@quiknet.com>102 103Special thanks to Matt Sottek.  I did the "guts", he104did the "brains" and all the testing.105