summaryrefslogtreecommitdiffstats
path: root/include/linux/random.h
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2022-10-23 22:06:00 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2022-11-18 02:18:10 +0100
commitb3883a9a1f09e7b41f4dcb1bbd7262216a62d253 (patch)
treea3fc9ed3fee27e63a7b93252484e87e7de7cc1bc /include/linux/random.h
parente8a533cbeb79809206f8724e89961e0079508c3c (diff)
downloadlinux-b3883a9a1f09e7b41f4dcb1bbd7262216a62d253.tar.bz2
stackprotector: move get_random_canary() into stackprotector.h
This has nothing to do with random.c and everything to do with stack protectors. Yes, it uses randomness. But many things use randomness. random.h and random.c are concerned with the generation of randomness, not with each and every use. So move this function into the more specific stackprotector.h file where it belongs. Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'include/linux/random.h')
-rw-r--r--include/linux/random.h19
1 files changed, 0 insertions, 19 deletions
diff --git a/include/linux/random.h b/include/linux/random.h
index bd954ecbef90..d1d680b9701d 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -116,25 +116,6 @@ static inline u32 get_random_u32_inclusive(u32 floor, u32 ceil)
return floor + get_random_u32_below(ceil - floor + 1);
}
-/*
- * On 64-bit architectures, protect against non-terminated C string overflows
- * by zeroing out the first byte of the canary; this leaves 56 bits of entropy.
- */
-#ifdef CONFIG_64BIT
-# ifdef __LITTLE_ENDIAN
-# define CANARY_MASK 0xffffffffffffff00UL
-# else /* big endian, 64 bits: */
-# define CANARY_MASK 0x00ffffffffffffffUL
-# endif
-#else /* 32 bits: */
-# define CANARY_MASK 0xffffffffUL
-#endif
-
-static inline unsigned long get_random_canary(void)
-{
- return get_random_long() & CANARY_MASK;
-}
-
void __init random_init_early(const char *command_line);
void __init random_init(void);
bool rng_is_initialized(void);