diff options
author | Theodore Ts'o <tytso@mit.edu> | 2013-09-21 13:58:22 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2013-10-10 14:30:53 -0400 |
commit | 61875f30daf60305712e25b209ef41ced2635bad (patch) | |
tree | 176cda3ae729c520bff1b0f6a19806c18c0a7523 /include | |
parent | 47d06e532e95b71c0db3839ebdef3fe8812fca2c (diff) |
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
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/timex.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/timex.h b/include/linux/timex.h index b3726e61368e..da4c32dbb2aa 100644 --- a/include/linux/timex.h +++ b/include/linux/timex.h | |||
@@ -64,6 +64,20 @@ | |||
64 | 64 | ||
65 | #include <asm/timex.h> | 65 | #include <asm/timex.h> |
66 | 66 | ||
67 | #ifndef random_get_entropy | ||
68 | /* | ||
69 | * The random_get_entropy() function is used by the /dev/random driver | ||
70 | * in order to extract entropy via the relative unpredictability of | ||
71 | * when an interrupt takes places versus a high speed, fine-grained | ||
72 | * timing source or cycle counter. Since it will be occurred on every | ||
73 | * single interrupt, it must have a very low cost/overhead. | ||
74 | * | ||
75 | * By default we use get_cycles() for this purpose, but individual | ||
76 | * architectures may override this in their asm/timex.h header file. | ||
77 | */ | ||
78 | #define random_get_entropy() get_cycles() | ||
79 | #endif | ||
80 | |||
67 | /* | 81 | /* |
68 | * SHIFT_PLL is used as a dampening factor to define how much we | 82 | * SHIFT_PLL is used as a dampening factor to define how much we |
69 | * adjust the frequency correction for a given offset in PLL mode. | 83 | * adjust the frequency correction for a given offset in PLL mode. |