diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-10-10 15:31:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-10-10 15:31:43 -0400 |
commit | f715729ee4cb666f51749f6cd86d06fff1e6e17b (patch) | |
tree | cf8f2c6c2d90441d6a978915b5d7eb0b19981f44 /include | |
parent | 8273548c5455e3ae27e905a77bad277535837329 (diff) | |
parent | 61875f30daf60305712e25b209ef41ced2635bad (diff) |
Merge tag 'random_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/random
Pull /dev/random changes from Ted Ts'o:
"These patches are designed to enable improvements to /dev/random for
non-x86 platforms, in particular MIPS and ARM"
* tag 'random_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/random:
random: allow architectures to optionally define random_get_entropy()
random: run random_int_secret_init() run after all late_initcalls
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/random.h | 1 | ||||
-rw-r--r-- | include/linux/timex.h | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/random.h b/include/linux/random.h index 3b9377d6b7a5..6312dd9ba449 100644 --- a/include/linux/random.h +++ b/include/linux/random.h | |||
@@ -17,6 +17,7 @@ extern void add_interrupt_randomness(int irq, int irq_flags); | |||
17 | extern void get_random_bytes(void *buf, int nbytes); | 17 | extern void get_random_bytes(void *buf, int nbytes); |
18 | extern void get_random_bytes_arch(void *buf, int nbytes); | 18 | extern void get_random_bytes_arch(void *buf, int nbytes); |
19 | void generate_random_uuid(unsigned char uuid_out[16]); | 19 | void generate_random_uuid(unsigned char uuid_out[16]); |
20 | extern int random_int_secret_init(void); | ||
20 | 21 | ||
21 | #ifndef MODULE | 22 | #ifndef MODULE |
22 | extern const struct file_operations random_fops, urandom_fops; | 23 | extern const struct file_operations random_fops, urandom_fops; |
diff --git a/include/linux/timex.h b/include/linux/timex.h index dd3edd7dfc94..9d3f1a5b6178 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. |