Skip to contentSkip to conversation

backports: random: add prandom_bytes macro for pre-3.8 kernels

PATCH In review Arend van Spriel 3 participants 4 messages Dec 22, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 backports: random: add prandom_bytes macro for pre-3.8 kernels

Map prandom_bytes() calls to get_random_bytes() for kernels before 3.8 kernel. This patch is needed by mac80211 rate control code since following:

commit f7d8ad81ca8c447124821e58f876d1aff996c85f

Author: Karl Beldan <[email protected]>
Date:   Wed Nov 13 10:54:19 2013 +0100

mac80211: minstrels: spare numerous useless calls to get_random_bytes

---
 backport/backport-include/linux/random.h |    2 ++
 1 file changed, 2 insertions(+)
backport/backport-include/linux/random.h +2 -0
index 812ce7f..3adde28 100644
@@ -8,6 +8,8 @@
 #define prandom_seed(_seed)		srandom32(_seed)
 #define prandom_u32()			random32()
 #define prandom_u32_state(_state)	prandom32(_state)
+/* use get_random_bytes() for lack of prandom_bytes() */
+#define prandom_bytes(a, b)		get_random_bytes(a, b)
 #endif
 
 #endif /* __BACKPORT_RANDOM_H */
Signature · 1 line
1.7.10.4
#1 lore raw

backport/backport-include/linux/random.h line 12

Quoted 6 lines · Arend van Spriel

Map prandom_bytes() calls to get_random_bytes() for kernels before 3.8 kernel. This patch is needed by mac80211 rate control code since following:

backport/backport-include/linux/random.h +2 -0
+/* use get_random_bytes() for lack of prandom_bytes() */
+#define prandom_bytes(a, b)		get_random_bytes(a, b)

I don't think this is a good idea, it's a completely different interface (get_random_bytes is much higher "quality".)

We had a different patch for this fairly recently and I thought Luis applied it?

johannes

#2 lore raw
Quoted 5 lines · Johannes Berg
Quoted 3 lines · Arend van Spriel

Map prandom_bytes() calls to get_random_bytes() for kernels before 3.8 kernel. This patch is needed by mac80211 rate control code since following:

Quoted 8 lines

backport/backport-include/linux/random.h line 12

Quoted 2 lines
backport/backport-include/linux/random.h +2 -0
+/* use get_random_bytes() for lack of prandom_bytes() */
+#define prandom_bytes(a, b)		get_random_bytes(a, b)

I don't think this is a good idea, it's a completely different interface (get_random_bytes is much higher "quality".)

We had a different patch for this fairly recently and I thought Luis applied it?

Yes a different patch is already in backports:
https://git.kernel.org/cgit/linux/kernel/git/backports/backports.git/commit/?id=40ab1bac8c3680d726ee31fbdb590584ae99756f

Hauke

#3 lore raw
Quoted 12 lines · Hauke Mehrtens
Quoted 11 lines · Johannes Berg

backport/backport-include/linux/random.h line 12

Quoted 6 lines · Arend van Spriel

Map prandom_bytes() calls to get_random_bytes() for kernels before 3.8 kernel. This patch is needed by mac80211 rate control code since following:

backport/backport-include/linux/random.h +2 -0
+/* use get_random_bytes() for lack of prandom_bytes() */
+#define prandom_bytes(a, b)		get_random_bytes(a, b)

I don't think this is a good idea, it's a completely different interface (get_random_bytes is much higher "quality".)

Quoted 5 lines
Quoted 2 lines

We had a different patch for this fairly recently and I thought Luis applied it?

Yes a different patch is already in backports:
https://git.kernel.org/cgit/linux/kernel/git/backports/backports.git/commit/?id=40ab1bac8c3680d726ee31fbdb590584ae99756f

I was looking at your github repo, because kernel.org did not work for 3.13 a while ago. Distributed version control can be a curse as well as a blessing.

Gr. AvS