aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/random.h
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2022-09-28 18:47:30 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2022-09-29 21:37:27 +0200
commit585cd5fe9f7378601b1d4915ad6e9088333b5e5e (patch)
treedc9ebd5ca10e1341b6ec92bb75bdd0f9e9576485 /include/linux/random.h
parentutsname: contribute changes to RNG (diff)
downloadlinux-dev-585cd5fe9f7378601b1d4915ad6e9088333b5e5e.tar.xz
linux-dev-585cd5fe9f7378601b1d4915ad6e9088333b5e5e.zip
random: add 8-bit and 16-bit batches
There are numerous places in the kernel that would be sped up by having smaller batches. Currently those callsites do `get_random_u32() & 0xff` or similar. Since these are pretty spread out, and will require patches to multiple different trees, let's get ahead of the curve and lay the foundation for `get_random_u8()` and `get_random_u16()`, so that it's then possible to start submitting conversion patches leisurely. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'include/linux/random.h')
-rw-r--r--include/linux/random.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/random.h b/include/linux/random.h
index a9e6e16f9774..2c130f8f18e5 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -38,6 +38,8 @@ static inline int unregister_random_vmfork_notifier(struct notifier_block *nb) {
#endif
void get_random_bytes(void *buf, size_t len);
+u8 get_random_u8(void);
+u16 get_random_u16(void);
u32 get_random_u32(void);
u64 get_random_u64(void);
static inline unsigned int get_random_int(void)