mirror of
https://github.com/libevent/libevent.git
synced 2025-01-09 00:56:20 +08:00
Use arc4random_stir over deprecated arc4random_addrandom (#1631)
Co-authored-by: Azat Khuzhin <azat@libevent.org>
This commit is contained in:
parent
e30b215f34
commit
b456e4bd82
@ -540,8 +540,8 @@ else()
|
||||
list(APPEND SYMBOLS_TO_CHECK
|
||||
accept4
|
||||
arc4random
|
||||
arc4random_addrandom
|
||||
arc4random_buf
|
||||
arc4random_stir
|
||||
epoll_create
|
||||
epoll_create1
|
||||
epoll_ctl
|
||||
|
@ -249,7 +249,7 @@ dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_INLINE
|
||||
|
||||
dnl Checks for library functions.
|
||||
AC_CHECK_FUNCS([accept4 arc4random arc4random_addrandom arc4random_buf epoll_create1 epoll_pwait2 eventfd fcntl getegid geteuid getifaddrs getrandom gettimeofday issetugid mach_absolute_time mmap mmap64 nanosleep pipe pipe2 pread putenv sendfile setenv setrlimit sigaction signal socketpair strlcpy strsep strsignal strtok_r strtoll sysctl timerfd_create umask unsetenv usleep])
|
||||
AC_CHECK_FUNCS([accept4 arc4random arc4random_buf arc4random_stir epoll_create1 epoll_pwait2 eventfd fcntl getegid geteuid getifaddrs getrandom gettimeofday issetugid mach_absolute_time mmap mmap64 nanosleep pipe pipe2 pread putenv sendfile setenv setrlimit sigaction signal socketpair strlcpy strsep strsignal strtok_r strtoll sysctl timerfd_create umask unsetenv usleep])
|
||||
|
||||
AS_IF([test "$bwin32" = "true"],
|
||||
AC_CHECK_FUNCS(_gmtime64_s, , [AC_CHECK_FUNCS(_gmtime64)])
|
||||
|
@ -53,8 +53,8 @@
|
||||
/* Define to 1 if you have the `arc4random_buf' function. */
|
||||
#cmakedefine EVENT__HAVE_ARC4RANDOM_BUF 1
|
||||
|
||||
/* Define to 1 if you have the `arc4random_addrandom' function. */
|
||||
#cmakedefine EVENT__HAVE_ARC4RANDOM_ADDRANDOM 1
|
||||
/* Define to 1 if you have the `arc4random_stir' function. */
|
||||
#cmakedefine EVENT__HAVE_ARC4RANDOM_STIR 1
|
||||
|
||||
/* Define to 1 if you have the <arpa/inet.h> header file. */
|
||||
#cmakedefine EVENT__HAVE_ARPA_INET_H 1
|
||||
|
@ -193,9 +193,11 @@ evutil_secure_rng_get_bytes(void *buf, size_t n)
|
||||
void
|
||||
evutil_secure_rng_add_bytes(const char *buf, size_t n)
|
||||
{
|
||||
#if !defined(EVENT__HAVE_ARC4RANDOM) || defined(EVENT__HAVE_ARC4RANDOM_ADDRANDOM)
|
||||
#if !defined(EVENT__HAVE_ARC4RANDOM)
|
||||
arc4random_addrandom((unsigned char*)buf,
|
||||
n>(size_t)INT_MAX ? INT_MAX : (int)n);
|
||||
#elif defined(EVENT__HAVE_ARC4RANDOM_STIR)
|
||||
arc4random_stir();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user