mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-24 21:54:34 -04:00
random: allow architectures to optionally define random_get_entropy()
Allow architectures which have a disabled get_cycles() function to provide a random_get_entropy() function which provides a fine-grained, rapidly changing counter that can be used by the /dev/random driver. For example, an architecture might have a rapidly changing register used to control random TLB cache eviction, or DRAM refresh that doesn't meet the requirements of get_cycles(), but which is good enough for the needs of the random driver. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Cc: stable@vger.kernel.org
This commit is contained in:
parent
47d06e532e
commit
61875f30da
2 changed files with 18 additions and 4 deletions
|
|
@ -64,6 +64,20 @@
|
|||
|
||||
#include <asm/timex.h>
|
||||
|
||||
#ifndef random_get_entropy
|
||||
/*
|
||||
* The random_get_entropy() function is used by the /dev/random driver
|
||||
* in order to extract entropy via the relative unpredictability of
|
||||
* when an interrupt takes places versus a high speed, fine-grained
|
||||
* timing source or cycle counter. Since it will be occurred on every
|
||||
* single interrupt, it must have a very low cost/overhead.
|
||||
*
|
||||
* By default we use get_cycles() for this purpose, but individual
|
||||
* architectures may override this in their asm/timex.h header file.
|
||||
*/
|
||||
#define random_get_entropy() get_cycles()
|
||||
#endif
|
||||
|
||||
/*
|
||||
* SHIFT_PLL is used as a dampening factor to define how much we
|
||||
* adjust the frequency correction for a given offset in PLL mode.
|
||||
|
|
|
|||
Loading…
Reference in a new issue