krb5 commit: Check for sys/random.h

ghudson at mit.edu ghudson at mit.edu
Mon Dec 2 13:39:06 EST 2024


https://github.com/krb5/krb5/commit/b43f4229758ff8e78897e03c386025cf4de3a200
commit b43f4229758ff8e78897e03c386025cf4de3a200
Author: Ken Hornstein <kenh at cmf.nrl.navy.mil>
Date:   Fri Nov 29 16:32:06 2024 -0500

    Check for sys/random.h
    
    The function getentropy() is supported on newer versions of MacOS X,
    but requires the include file sys/random.h.  Check for that and include
    it where getentropy() is used.
    
    ticket: 9149

 src/configure.ac          | 2 +-
 src/lib/crypto/krb/prng.c | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/configure.ac b/src/configure.ac
index 10a5d1a74..9d4e08a70 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -490,7 +490,7 @@ AC_SUBST(GETTIMEOFDAY_ST_OBJ)
 AC_SUBST(EXTRA_SUPPORT_SYMS)
 
 DECLARE_SYS_ERRLIST
-AC_CHECK_HEADERS(unistd.h paths.h regex.h regexpr.h fcntl.h memory.h ifaddrs.h sys/filio.h byteswap.h machine/endian.h machine/byte_order.h sys/bswap.h endian.h pwd.h arpa/inet.h alloca.h dlfcn.h limits.h)
+AC_CHECK_HEADERS(unistd.h paths.h regex.h regexpr.h fcntl.h memory.h ifaddrs.h sys/filio.h byteswap.h machine/endian.h machine/byte_order.h sys/bswap.h endian.h pwd.h arpa/inet.h alloca.h dlfcn.h limits.h sys/random.h)
 AC_CHECK_HEADER(regexp.h, [], [],
 [#define INIT char *sp = instring;
 #define GETC() (*sp++)
diff --git a/src/lib/crypto/krb/prng.c b/src/lib/crypto/krb/prng.c
index a9c166815..4a6464558 100644
--- a/src/lib/crypto/krb/prng.c
+++ b/src/lib/crypto/krb/prng.c
@@ -56,6 +56,9 @@ get_os_entropy(unsigned char *buf, size_t len)
 #ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>
 #endif
+#ifdef HAVE_SYS_RANDOM_H
+#include <sys/random.h>
+#endif
 #ifdef __linux__
 #include <sys/syscall.h>
 #endif /* __linux__ */


More information about the cvs-krb5 mailing list