Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

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