termux-packages/packages/libevent/evutil_secure_rng_add_bytes.patch
Vishal Biswas 15f034041a allow symbol evutil_secure_rng_add_bytes (#578)
use arc4random_random where available or export empty symbol
2016-12-09 16:51:43 -05:00

27 lines
1.2 KiB
Diff

Patch taken from https://gitweb.torproject.org/orbot.git/tree/external/libevent-patch-1
For some reason arc4random_addrandom isn't present in 64-bit android archs. !
--- ./configure.ac 2015-01-05 20:00:02.000000000 +0530
+++ ../configure.ac 2016-12-06 10:15:44.617028345 +0530
@@ -290,7 +290,7 @@
dnl Checks for library functions.
AC_CHECK_FUNCS([gettimeofday vasprintf fcntl clock_gettime strtok_r strsep])
-AC_CHECK_FUNCS([getnameinfo strlcpy inet_ntop inet_pton signal sigaction strtoll inet_aton pipe eventfd sendfile mmap splice arc4random arc4random_buf issetugid geteuid getegid getprotobynumber setenv unsetenv putenv sysctl])
+AC_CHECK_FUNCS([getnameinfo strlcpy inet_ntop inet_pton signal sigaction strtoll inet_aton pipe eventfd sendfile mmap splice arc4random arc4random_buf arc4random_addrandom issetugid geteuid getegid getprotobynumber setenv unsetenv putenv sysctl])
AC_CHECK_FUNCS([umask])
AC_CACHE_CHECK(
--- ./evutil_rand.c 2013-11-01 23:48:57.000000000 +0530
+++ ../evutil_rand.c 2016-12-06 10:38:19.748912002 +0530
@@ -174,7 +176,9 @@
void
evutil_secure_rng_add_bytes(const char *buf, size_t n)
{
+#ifdef _EVENT_HAVE_ARC4RANDOM_ADDRANDOM
arc4random_addrandom((unsigned char*)buf,
n>(size_t)INT_MAX ? INT_MAX : (int)n);
+#endif
}