aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaylor Yu <catalyst@torproject.org>2018-05-07 12:43:39 -0500
committerTaylor Yu <catalyst@torproject.org>2018-05-07 12:56:12 -0500
commit9326abe16ac720346885e0ac555d6625233e198c (patch)
treed69a13e475618d46407fb8b72c99ad828a9f118a
parenta1a32b483412deda5b7573c3120c85fe41e3dfd2 (diff)
downloadtor-9326abe16ac720346885e0ac555d6625233e198c.tar.gz
tor-9326abe16ac720346885e0ac555d6625233e198c.zip
Restore sys/random.h inclusion for getentropy()
Code movement for the refactoring for ticket 24658 didn't copy the inclusion of sys/random.h, which is needed to get a prototype for getentropy() on macOS 10.12 Sierra. It also didn't copy the inclusion of sys/syscall.h, which might prevent the getrandom() syscall from being properly detected. Move these inclusions. Bug not in any released Tor.
-rw-r--r--src/common/crypto.c6
-rw-r--r--src/common/crypto_rand.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c
index e148878be0..052f31723b 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -60,12 +60,6 @@ ENABLE_GCC_WARNING(redundant-decls)
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
-#ifdef HAVE_SYS_SYSCALL_H
-#include <sys/syscall.h>
-#endif
-#ifdef HAVE_SYS_RANDOM_H
-#include <sys/random.h>
-#endif
#include "torlog.h"
#include "torint.h"
diff --git a/src/common/crypto_rand.c b/src/common/crypto_rand.c
index 5abf0b0968..df2e2f65d3 100644
--- a/src/common/crypto_rand.c
+++ b/src/common/crypto_rand.c
@@ -55,6 +55,12 @@ ENABLE_GCC_WARNING(redundant-decls)
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
+#ifdef HAVE_SYS_SYSCALL_H
+#include <sys/syscall.h>
+#endif
+#ifdef HAVE_SYS_RANDOM_H
+#include <sys/random.h>
+#endif
/**
* How many bytes of entropy we add at once.