summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2011-07-31 13:54:50 -0700
committerPaul Gortmaker <paul.gortmaker@windriver.com>2012-08-17 15:36:01 -0400
commitaae8201cb804c0c7582841fa9edc6ef6a43e5fd2 (patch)
tree77ab3a5fd3437888d4b0266b132b8b8f6c0c23ea /include
parent6c35e17eda15aca777df7e5d57214628987fa5f6 (diff)
random: Add support for architectural random hooks
commit 63d77173266c1791f1553e9e8ccea65dc87c4485 upstream. Add support for architecture-specific hooks into the kernel-directed random number generator interfaces. This patchset does not use the architecture random number generator interfaces for the userspace-directed interfaces (/dev/random and /dev/urandom), thus eliminating the need to distinguish between them based on a pool pointer. Changes in version 3: - Moved the hooks from extract_entropy() to get_random_bytes(). - Changes the hooks to inlines. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Matt Mackall <mpm@selenic.com> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: "Theodore Ts'o" <tytso@mit.edu> [PG: .34 already had "unsigned int ret" in get_random_int, so the diffstat here is slightly smaller than that of 63d7717. ] Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/random.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/random.h b/include/linux/random.h
index 29480462bdfb..0bf293697f09 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -63,6 +63,19 @@ unsigned long randomize_range(unsigned long start, unsigned long end, unsigned l
u32 random32(void);
void srandom32(u32 seed);
+#ifdef CONFIG_ARCH_RANDOM
+# include <asm/archrandom.h>
+#else
+static inline int arch_get_random_long(unsigned long *v)
+{
+ return 0;
+}
+static inline int arch_get_random_int(unsigned int *v)
+{
+ return 0;
+}
+#endif
+
#endif /* __KERNEL___ */
#endif /* _LINUX_RANDOM_H */