From 10096cb60619984eefc628471f219d4723867bb1 Mon Sep 17 00:00:00 2001 From: "Bjoern A. Zeeb" Date: Mon, 24 May 2021 18:38:58 +0000 Subject: [PATCH] LinuxKPI: add prandom_u32() as used by wireless drivers. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30435 --- sys/compat/linuxkpi/common/include/linux/random.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/random.h b/sys/compat/linuxkpi/common/include/linux/random.h index 31d8b996aa0b..12de0e12bc5a 100644 --- a/sys/compat/linuxkpi/common/include/linux/random.h +++ b/sys/compat/linuxkpi/common/include/linux/random.h @@ -63,6 +63,15 @@ get_random_long(void) return (val); } +static __inline uint32_t +prandom_u32(void) +{ + uint32_t val; + + get_random_bytes(&val, sizeof(val)); + return (val); +} + static inline u32 prandom_u32_max(u32 max) {