Skip to content

Instantly share code, notes, and snippets.

@ahf
Created February 1, 2018 19:44
Show Gist options
  • Save ahf/ef172d26d755bf14cadba3e2466e74b1 to your computer and use it in GitHub Desktop.
Save ahf/ef172d26d755bf14cadba3e2466e74b1 to your computer and use it in GitHub Desktop.
diff --git a/src/common/crypto.c b/src/common/crypto.c
index 107b53a..f6d2efe 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -2755,7 +2755,8 @@ crypto_strongest_rand_syscall(uint8_t *out, size_t out_len)
if (!provider_set) {
if (!CryptAcquireContext(&provider, NULL, NULL, PROV_RSA_FULL,
CRYPT_VERIFYCONTEXT)) {
- log_warn(LD_CRYPTO, "Can't get CryptoAPI provider [1]");
+ log_notice(LD_CRYPTO, "Can't get CryptoAPI provider [1]."
+ " Trying fallback method.");
return -1;
}
provider_set = 1;
@@ -2803,12 +2804,14 @@ crypto_strongest_rand_syscall(uint8_t *out, size_t out_len)
/* 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"
- " function--probably because it is too old?");
+ log_notice(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"
+ " function--probably because it is too old?"
+ " Trying fallback method instead.");
} else {
- log_warn(LD_CRYPTO, "Can't get entropy from getrandom(): %s.",
+ log_notice(LD_CRYPTO, "Can't get entropy from getrandom(): %s.",
+ " Trying fallback method instead."
strerror(errno));
}
@@ -2871,7 +2874,8 @@ crypto_strongest_rand_fallback(uint8_t *out, size_t out_len)
/* LCOV_EXCL_START
* We can't make /dev/foorandom actually fail. */
log_warn(LD_CRYPTO,
- "Error reading from entropy source (read only %lu bytes).",
+ "Error reading from entropy source %s (read only %lu bytes).",
+ filenames[i],
(unsigned long)n);
return -1;
/* LCOV_EXCL_STOP */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment