[PATCH] lib: random: make srand_xor a no-op in PBL

Ahmad Fatoum a.fatoum at pengutronix.de
Tue Apr 29 00:56:05 PDT 2025


We are going to add srand_xor calls at more places in future, so do not
trigger a BUG() for it on use in PBL. There is still a BUG() call in
random32 and friends, so use of unseeded PRNG won't get unnoticed.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
This replaces
https://lore.barebox.org/barebox/174555956247.545067.10905121643082274040.b4-ty@pengutronix.de/T/#t

But there is no breakage if both are applied at the same time.
---
 include/stdlib.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/include/stdlib.h b/include/stdlib.h
index f0f7cfd2ed28..18f58abad988 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -21,10 +21,7 @@ static inline void randbuf_r(u64 *x, void *buf, size_t len)
 {
 	BUG();
 }
-static inline void srand_xor(u64 entropy)
-{
-	BUG();
-}
+static inline void srand_xor(u64 entropy) { }
 static inline u32 random32(void)
 {
 	BUG();
-- 
2.39.5




More information about the barebox mailing list