git: 0244e0a177a6 - main - openssl: Add <sys/random.h> include for getrandom()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 29 Jul 2024 20:39:28 UTC
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=0244e0a177a68fc8ff7e8a58fa7a9553956232ec
commit 0244e0a177a68fc8ff7e8a58fa7a9553956232ec
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-07-29 20:38:49 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-07-29 20:38:49 +0000
openssl: Add <sys/random.h> include for getrandom()
GCC 14 (but not earlier versions) warns about a missing prototype
for getrandom(). Include <sys/random.h> explicitly to bring in the
prototype rather than depending on a nested include. While here,
stop defining sysctl_random() since it is no longer used.
Reviewed by: brooks
Fixes: 838b6caababb openssl: use getrandom(2) instead of probing for getentropy(2)
Differential Revision: https://reviews.freebsd.org/D45995
---
crypto/openssl/providers/implementations/rands/seeding/rand_unix.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/crypto/openssl/providers/implementations/rands/seeding/rand_unix.c b/crypto/openssl/providers/implementations/rands/seeding/rand_unix.c
index eadacedbe40c..f8e73a02daf4 100644
--- a/crypto/openssl/providers/implementations/rands/seeding/rand_unix.c
+++ b/crypto/openssl/providers/implementations/rands/seeding/rand_unix.c
@@ -28,7 +28,7 @@
# include <sys/utsname.h>
# endif
#endif
-#if (defined(__FreeBSD__) || defined(__NetBSD__)) && !defined(OPENSSL_SYS_UEFI)
+#if defined(__NetBSD__)
# include <sys/types.h>
# include <sys/sysctl.h>
# include <sys/param.h>
@@ -36,7 +36,8 @@
#if defined(__OpenBSD__)
# include <sys/param.h>
#endif
-#if defined(__DragonFly__)
+#if (defined(__DragonFly__) || defined(__FreeBSD__)) \
+ && !defined(OPENSSL_SYS_UEFI)
# include <sys/param.h>
# include <sys/random.h>
#endif
@@ -212,7 +213,7 @@ void ossl_rand_pool_keep_random_devices_open(int keep)
# error "librandom not (yet) supported"
# endif
-# if (defined(__FreeBSD__) || defined(__NetBSD__)) && defined(KERN_ARND)
+# if defined(__NetBSD__) && defined(KERN_ARND)
/*
* sysctl_random(): Use sysctl() to read a random number from the kernel
* Returns the number of bytes returned in buf on success, -1 on failure.