tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

commit a798ba6e9bd5ef7fed89948ffa0e7334ceb1844e
parent 5822496d69f670766b97b59bf3b2963d9bd6f37f
Author: Nick Mathewson <nickm@torproject.org>
Date:   Tue,  5 Dec 2017 12:10:06 -0500

Merge branch 'maint-0.3.2'

Diffstat:
Achanges/ticket24500 | 3+++
Msrc/common/crypto.c | 13+++++++++++--
2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/changes/ticket24500 b/changes/ticket24500 @@ -0,0 +1,3 @@ + o Minor features (logging): + - Provide better warnings when the getrandom() syscall fails. + Closes ticket 24500. diff --git a/src/common/crypto.c b/src/common/crypto.c @@ -2875,8 +2875,17 @@ crypto_strongest_rand_syscall(uint8_t *out, size_t out_len) tor_assert(errno != EAGAIN); tor_assert(errno != EINTR); - /* Probably ENOSYS. */ - log_warn(LD_CRYPTO, "Can't get entropy from getrandom()."); + /* Useful log message for errno. */ + if (errno == ENOSYS) { + log_warn(LD_CRYPTO, "Can't get entropy from getrandom(). " + " You are running a version of Tor built to support" + " getrandom(), but the kernel doesn't implement this" + " implement this function--probably because it is too old?"); + } else { + log_warn(LD_CRYPTO, "Can't get entropy from getrandom(): %s.", + strerror(errno)); + } + getrandom_works = 0; /* Don't bother trying again. */ return -1; /* LCOV_EXCL_STOP */