git: c535e8ae7f61 - stable/14 - LinuxKPI: Add get_random_u64() function
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 17 Feb 2024 21:33:10 UTC
The branch stable/14 has been updated by wulf:
URL: https://cgit.FreeBSD.org/src/commit/?id=c535e8ae7f6137f8ecda2ec503eee253bab8a67e
commit c535e8ae7f6137f8ecda2ec503eee253bab8a67e
Author: Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2023-12-24 08:20:00 +0000
Commit: Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2024-02-17 20:58:38 +0000
LinuxKPI: Add get_random_u64() function
Sponsored by: Serenity Cyber Security, LLC
Reviewed by: manu, bz
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D42816
(cherry picked from commit 7f88d742e578c4cef4e26ce10b9a936e58237964)
---
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 5335cca8251c..e87d4412ea4e 100644
--- a/sys/compat/linuxkpi/common/include/linux/random.h
+++ b/sys/compat/linuxkpi/common/include/linux/random.h
@@ -87,6 +87,15 @@ get_random_long(void)
return (val);
}
+static inline uint64_t
+get_random_u64(void)
+{
+ uint64_t val;
+
+ get_random_bytes(&val, sizeof(val));
+ return (val);
+}
+
static __inline uint32_t
prandom_u32(void)
{