aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/random.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-10-15 13:03:15 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-10-15 13:03:15 -0400
commit9ffc66941df278c9f4df979b6bcf6c6ddafedd16 (patch)
treea2cff20aafb7ecb352a0c2dd41a5430f64a248e0 /include/linux/random.h
parent133d970e0dadf7b413db19893acc5b26664bf4a1 (diff)
parent0766f788eb727e2e330d55d30545db65bcf2623f (diff)
Merge tag 'gcc-plugins-v4.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull gcc plugins update from Kees Cook: "This adds a new gcc plugin named "latent_entropy". It is designed to extract as much possible uncertainty from a running system at boot time as possible, hoping to capitalize on any possible variation in CPU operation (due to runtime data differences, hardware differences, SMP ordering, thermal timing variation, cache behavior, etc). At the very least, this plugin is a much more comprehensive example for how to manipulate kernel code using the gcc plugin internals" * tag 'gcc-plugins-v4.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: latent_entropy: Mark functions with __latent_entropy gcc-plugins: Add latent_entropy plugin
Diffstat (limited to 'include/linux/random.h')
-rw-r--r--include/linux/random.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/include/linux/random.h b/include/linux/random.h
index f7bb7a355cf7..7bd2403e4fef 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -18,9 +18,20 @@ struct random_ready_callback {
18}; 18};
19 19
20extern void add_device_randomness(const void *, unsigned int); 20extern void add_device_randomness(const void *, unsigned int);
21
22#if defined(CONFIG_GCC_PLUGIN_LATENT_ENTROPY) && !defined(__CHECKER__)
23static inline void add_latent_entropy(void)
24{
25 add_device_randomness((const void *)&latent_entropy,
26 sizeof(latent_entropy));
27}
28#else
29static inline void add_latent_entropy(void) {}
30#endif
31
21extern void add_input_randomness(unsigned int type, unsigned int code, 32extern void add_input_randomness(unsigned int type, unsigned int code,
22 unsigned int value); 33 unsigned int value) __latent_entropy;
23extern void add_interrupt_randomness(int irq, int irq_flags); 34extern void add_interrupt_randomness(int irq, int irq_flags) __latent_entropy;
24 35
25extern void get_random_bytes(void *buf, int nbytes); 36extern void get_random_bytes(void *buf, int nbytes);
26extern int add_random_ready_callback(struct random_ready_callback *rdy); 37extern int add_random_ready_callback(struct random_ready_callback *rdy);