hw_random.rst 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. ==========================================================
  2. Linux support for random number generator in i8xx chipsets
  3. ==========================================================
  4. Introduction
  5. ============
  6. The hw_random framework is software that makes use of a
  7. special hardware feature on your CPU or motherboard,
  8. a Random Number Generator (RNG). The software has two parts:
  9. a core providing the /dev/hwrng character device and its
  10. sysfs support, plus a hardware-specific driver that plugs
  11. into that core.
  12. To make the most effective use of these mechanisms, you
  13. should download the support software as well. Download the
  14. latest version of the "rng-tools" package from the
  15. hw_random driver's official Web site:
  16. http://sourceforge.net/projects/gkernel/
  17. Those tools use /dev/hwrng to fill the kernel entropy pool,
  18. which is used internally and exported by the /dev/urandom and
  19. /dev/random special files.
  20. Theory of operation
  21. ===================
  22. CHARACTER DEVICE. Using the standard open()
  23. and read() system calls, you can read random data from
  24. the hardware RNG device. This data is NOT CHECKED by any
  25. fitness tests, and could potentially be bogus (if the
  26. hardware is faulty or has been tampered with). Data is only
  27. output if the hardware "has-data" flag is set, but nevertheless
  28. a security-conscious person would run fitness tests on the
  29. data before assuming it is truly random.
  30. The rng-tools package uses such tests in "rngd", and lets you
  31. run them by hand with a "rngtest" utility.
  32. /dev/hwrng is char device major 10, minor 183.
  33. CLASS DEVICE. There is a /sys/class/misc/hw_random node with
  34. two unique attributes, "rng_available" and "rng_current". The
  35. "rng_available" attribute lists the hardware-specific drivers
  36. available, while "rng_current" lists the one which is currently
  37. connected to /dev/hwrng. If your system has more than one
  38. RNG available, you may change the one used by writing a name from
  39. the list in "rng_available" into "rng_current".
  40. ==========================================================================
  41. Hardware driver for Intel/AMD/VIA Random Number Generators (RNG)
  42. - Copyright 2000,2001 Jeff Garzik <jgarzik@pobox.com>
  43. - Copyright 2000,2001 Philipp Rumpf <prumpf@mandrakesoft.com>
  44. About the Intel RNG hardware, from the firmware hub datasheet
  45. =============================================================
  46. The Firmware Hub integrates a Random Number Generator (RNG)
  47. using thermal noise generated from inherently random quantum
  48. mechanical properties of silicon. When not generating new random
  49. bits the RNG circuitry will enter a low power state. Intel will
  50. provide a binary software driver to give third party software
  51. access to our RNG for use as a security feature. At this time,
  52. the RNG is only to be used with a system in an OS-present state.
  53. Intel RNG Driver notes
  54. ======================
  55. FIXME: support poll(2)
  56. .. note::
  57. request_mem_region was removed, for three reasons:
  58. 1) Only one RNG is supported by this driver;
  59. 2) The location used by the RNG is a fixed location in
  60. MMIO-addressable memory;
  61. 3) users with properly working BIOS e820 handling will always
  62. have the region in which the RNG is located reserved, so
  63. request_mem_region calls always fail for proper setups.
  64. However, for people who use mem=XX, BIOS e820 information is
  65. **not** in /proc/iomem, and request_mem_region(RNG_ADDR) can
  66. succeed.
  67. Driver details
  68. ==============
  69. Based on:
  70. Intel 82802AB/82802AC Firmware Hub (FWH) Datasheet
  71. May 1999 Order Number: 290658-002 R
  72. Intel 82802 Firmware Hub:
  73. Random Number Generator
  74. Programmer's Reference Manual
  75. December 1999 Order Number: 298029-001 R
  76. Intel 82802 Firmware HUB Random Number Generator Driver
  77. Copyright (c) 2000 Matt Sottek <msottek@quiknet.com>
  78. Special thanks to Matt Sottek. I did the "guts", he
  79. did the "brains" and all the testing.