aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorimoseyon <imoseyon@gmail.com>2014-12-14 10:36:51 -0800
committerMoyster <oysterized@gmail.com>2016-09-10 12:06:52 +0200
commite9c9fff8d3d4e053157db364ae4840882ab30eac (patch)
tree43be6a1fd3e2e87290c8820c896c468a4b09e7b2
parentb245cbd5c6ae4cfa0fea4f61b84efc0d2397df78 (diff)
random: sprinkle e/f/prandom in places that deplete entropy often
-rw-r--r--include/linux/etherdevice.h2
-rw-r--r--lib/random32.c2
-rw-r--r--net/core/neighbour.c2
-rw-r--r--net/core/secure_seq.c2
-rw-r--r--net/ipv6/addrconf.c2
-rw-r--r--net/netlink/af_netlink.c2
6 files changed, 6 insertions, 6 deletions
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index c62386196..55780af07 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -154,7 +154,7 @@ static inline bool is_valid_ether_addr(const u8 *addr)
*/
static inline void eth_random_addr(u8 *addr)
{
- get_random_bytes(addr, ETH_ALEN);
+ prandom_bytes(addr, ETH_ALEN);
addr[0] &= 0xfe; /* clear multicast bit */
addr[0] |= 0x02; /* set local assignment bit (IEEE802) */
}
diff --git a/lib/random32.c b/lib/random32.c
index d7a628a61..ae95d5154 100644
--- a/lib/random32.c
+++ b/lib/random32.c
@@ -220,7 +220,7 @@ static void __prandom_timer(unsigned long dontcare)
u32 entropy;
unsigned long expires;
- get_random_bytes(&entropy, sizeof(entropy));
+ erandom_get_random_bytes((char *)&entropy, sizeof(entropy));
prandom_seed(entropy);
/* reseed every ~60 seconds, in [40 .. 80) interval with slack */
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index b49e8bafa..c0bdf4857 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -310,7 +310,7 @@ out_entries:
static void neigh_get_hash_rnd(u32 *x)
{
- get_random_bytes(x, sizeof(*x));
+ prandom_bytes(x, sizeof(*x));
*x |= 1;
}
diff --git a/net/core/secure_seq.c b/net/core/secure_seq.c
index d0afc322b..a5edfff83 100644
--- a/net/core/secure_seq.c
+++ b/net/core/secure_seq.c
@@ -25,7 +25,7 @@ static void net_secret_init(void)
for (i = NET_SECRET_SIZE; i > 0;) {
do {
- get_random_bytes(&tmp, sizeof(tmp));
+ prandom_bytes(&tmp, sizeof(tmp));
} while (!tmp);
cmpxchg(&net_secret[--i], 0, tmp);
}
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index ccddbe675..0be739664 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1925,7 +1925,7 @@ static int ipv6_inherit_eui64(u8 *eui, struct inet6_dev *idev)
static void __ipv6_regen_rndid(struct inet6_dev *idev)
{
regen:
- get_random_bytes(idev->rndid, sizeof(idev->rndid));
+ prandom_bytes(idev->rndid, sizeof(idev->rndid));
idev->rndid[0] &= ~0x02;
/*
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 9eba0240f..92998c696 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -913,7 +913,7 @@ static int nl_portid_hash_rehash(struct nl_portid_hash *hash, int grow)
hash->table = table;
hash->mask = mask;
hash->shift = shift;
- get_random_bytes(&hash->rnd, sizeof(hash->rnd));
+ prandom_bytes(&hash->rnd, sizeof(hash->rnd));
for (i = 0; i <= omask; i++) {
struct sock *sk;