Skip to content

Commit de492c8

Browse files
committed
prandom: remove unused functions
With no callers left of prandom_u32() and prandom_bytes(), as well as get_random_int(), remove these deprecated wrappers, in favor of get_random_u32() and get_random_bytes(). Reviewed-by: Greg Kroah-Hartman <[email protected]> Reviewed-by: Kees Cook <[email protected]> Reviewed-by: Yury Norov <[email protected]> Acked-by: Jakub Kicinski <[email protected]> Signed-off-by: Jason A. Donenfeld <[email protected]>
1 parent 197173d commit de492c8

File tree

3 files changed

+5
-23
lines changed

3 files changed

+5
-23
lines changed

drivers/char/random.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ MODULE_PARM_DESC(ratelimit_disable, "Disable random ratelimit suppression");
9797
* Returns whether or not the input pool has been seeded and thus guaranteed
9898
* to supply cryptographically secure random numbers. This applies to: the
9999
* /dev/urandom device, the get_random_bytes function, and the get_random_{u8,
100-
* u16,u32,u64,int,long} family of functions.
100+
* u16,u32,u64,long} family of functions.
101101
*
102102
* Returns: true if the input pool has been seeded.
103103
* false if the input pool has not been seeded.
@@ -161,15 +161,14 @@ EXPORT_SYMBOL(wait_for_random_bytes);
161161
* u16 get_random_u16()
162162
* u32 get_random_u32()
163163
* u64 get_random_u64()
164-
* unsigned int get_random_int()
165164
* unsigned long get_random_long()
166165
*
167166
* These interfaces will return the requested number of random bytes
168167
* into the given buffer or as a return value. This is equivalent to
169-
* a read from /dev/urandom. The u8, u16, u32, u64, int, and long
170-
* family of functions may be higher performance for one-off random
171-
* integers, because they do a bit of buffering and do not invoke
172-
* reseeding until the buffer is emptied.
168+
* a read from /dev/urandom. The u8, u16, u32, u64, long family of
169+
* functions may be higher performance for one-off random integers,
170+
* because they do a bit of buffering and do not invoke reseeding
171+
* until the buffer is emptied.
173172
*
174173
*********************************************************************/
175174

include/linux/prandom.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,6 @@
1212
#include <linux/percpu.h>
1313
#include <linux/random.h>
1414

15-
/* Deprecated: use get_random_u32 instead. */
16-
static inline u32 prandom_u32(void)
17-
{
18-
return get_random_u32();
19-
}
20-
21-
/* Deprecated: use get_random_bytes instead. */
22-
static inline void prandom_bytes(void *buf, size_t nbytes)
23-
{
24-
return get_random_bytes(buf, nbytes);
25-
}
26-
2715
struct rnd_state {
2816
__u32 s1, s2, s3, s4;
2917
};

include/linux/random.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@ u8 get_random_u8(void);
4242
u16 get_random_u16(void);
4343
u32 get_random_u32(void);
4444
u64 get_random_u64(void);
45-
static inline unsigned int get_random_int(void)
46-
{
47-
return get_random_u32();
48-
}
4945
static inline unsigned long get_random_long(void)
5046
{
5147
#if BITS_PER_LONG == 64
@@ -100,7 +96,6 @@ declare_get_random_var_wait(u8, u8)
10096
declare_get_random_var_wait(u16, u16)
10197
declare_get_random_var_wait(u32, u32)
10298
declare_get_random_var_wait(u64, u32)
103-
declare_get_random_var_wait(int, unsigned int)
10499
declare_get_random_var_wait(long, unsigned long)
105100
#undef declare_get_random_var
106101

0 commit comments

Comments
 (0)