From 3b2942c570950e2549bd810b59128553eefb5fb2 Mon Sep 17 00:00:00 2001 From: "Luis R. Rodriguez" Date: Wed, 13 Mar 2013 02:51:15 -0700 Subject: [PATCH] compat: backport rename of random32 to prandom mcgrof@frijol ~/linux-next (git::master)$ git describe \ --contains 496f2f93b1cc286f5a4f4f9acdc1e5314978683f v3.8-rc1~74^2~22 commit 496f2f93b1cc286f5a4f4f9acdc1e5314978683f Author: Akinobu Mita Date: Mon Dec 17 16:04:23 2012 -0800 random32: rename random32 to prandom This renames all random32 functions to have 'prandom_' prefix as follows: void prandom_seed(u32 seed); /* rename from srandom32() */ u32 prandom_u32(void); /* rename from random32() */ void prandom_seed_state(struct rnd_state *state, u64 seed); /* rename from prandom32_seed() */ u32 prandom_u32_state(struct rnd_state *state); /* rename from prandom32() */ The purpose of this renaming is to prevent some kernel developers from assuming that prandom32() and random32() might imply that only prandom32() was the one using a pseudo-random number generator by prandom32's "p", and the result may be a very embarassing security exposure. This concern was expressed by Theodore Ts'o. And furthermore, I'm going to introduce new functions for getting the requested number of pseudo-random bytes. If I continue to use both prandom32 and random32 prefixes for these functions, the confusion is getting worse. As a result of this renaming, "prandom_" is the common prefix for pseudo-random number library. Currently, srandom32() and random32() are preserved because it is difficult to rename too many users at once. Signed-off-by: Akinobu Mita Cc: "Theodore Ts'o" Cc: Robert Love Cc: Michel Lespinasse Cc: Valdis Kletnieks Cc: David Laight Cc: Adrian Hunter Cc: Artem Bityutskiy Cc: David Woodhouse Cc: Eilon Greenstein Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Luis R. Rodriguez --- include/linux/compat-3.8.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/linux/compat-3.8.h b/include/linux/compat-3.8.h index 4aeffdba6408..184d1d09b68c 100644 --- a/include/linux/compat-3.8.h +++ b/include/linux/compat-3.8.h @@ -8,6 +8,12 @@ #include #include #include +#include + +/* backports 496f2f9 */ +#define prandom_seed(_seed) srandom32(_seed) +#define prandom_u32() random32() +#define prandom_u32_state(_state) prandom32(_state) #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,8)) extern void netdev_set_default_ethtool_ops(struct net_device *dev, -- 2.30.2