summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-12-09 08:31:29 -0500
committerNick Mathewson <nickm@torproject.org>2015-12-09 08:31:29 -0500
commit3a69fcb01f131e8a241aa0d806d5ed7aef6b9314 (patch)
tree0faff1dd1de492bfbc1f71d8918dce41ad1944d1 /src/common
parent0df014edada01d6aac0ef9b7277c6cea7d72f45d (diff)
downloadtor-3a69fcb01f131e8a241aa0d806d5ed7aef6b9314.tar.gz
tor-3a69fcb01f131e8a241aa0d806d5ed7aef6b9314.zip
try a little harder with getrandom types to avoid warnings
Diffstat (limited to 'src/common')
-rw-r--r--src/common/crypto.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c
index 34e94b53a8..45549334e7 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -2397,13 +2397,14 @@ crypto_strongest_rand_syscall(uint8_t *out, size_t out_len)
* /dev/srandom followed by opening and reading from /dev/urandom.
*/
if (PREDICT_LIKELY(getrandom_works)) {
- int ret;
+ long ret;
+ /* A flag of '0' here means to read from '/dev/urandom', and to
+ * block if insufficient entropy is available to service the
+ * request.
+ */
+ const unsigned int flags = 0;
do {
- /* A flag of '0' here means to read from '/dev/urandom', and to
- * block if insufficient entropy is available to service the
- * request.
- */
- ret = syscall(SYS_getrandom, out, out_len, 0);
+ ret = syscall(SYS_getrandom, out, out_len, flags);
} while (ret == -1 && ((errno == EINTR) ||(errno == EAGAIN)));
if (PREDICT_UNLIKELY(ret == -1)) {
@@ -2416,7 +2417,7 @@ crypto_strongest_rand_syscall(uint8_t *out, size_t out_len)
return -1;
}
- tor_assert(ret == (int)out_len);
+ tor_assert(ret == (long)out_len);
return 0;
}