diff options
author | Bjoern A. Zeeb <bz@FreeBSD.org> | 2021-05-24 18:38:58 +0000 |
---|---|---|
committer | Bjoern A. Zeeb <bz@FreeBSD.org> | 2021-07-18 00:35:00 +0000 |
commit | 17b99aa321babea211652f7799f0fcf7d1e55361 (patch) | |
tree | dcf6a9c2f227994c6e7d87a8efa3fe907035b1f3 | |
parent | 89f8a8c30632c09e15d11456469a32cdc9e06d19 (diff) | |
download | src-17b99aa321babea211652f7799f0fcf7d1e55361.tar.gz src-17b99aa321babea211652f7799f0fcf7d1e55361.zip |
LinuxKPI: add prandom_u32() as used by wireless drivers.
Sponsored by: The FreeBSD Foundation
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30435
(cherry picked from commit 10096cb60619984eefc628471f219d4723867bb1)
-rw-r--r-- | sys/compat/linuxkpi/common/include/linux/random.h | 9 |
1 files changed, 9 insertions, 0 deletions
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) { |