File tor-0.2.3.x-CVE-2013-7295.patch of Package tor.openSUSE_13.1_Update
From: Nick Mathewson <nickm@torproject.org>
Date: Wed, 18 Dec 2013 16:49:44 +0000 (-0500)
Subject: Never allow OpenSSL engines to replace the RAND_SSLeay method
References: https://bugzilla.novell.com/show_bug.cgi?id=859421 https://gitweb.torproject.org/tor.git/commit/7b87003957530427eadce36ed03b4645b481a335
Upstream: committed
Never allow OpenSSL engines to replace the RAND_SSLeay method
This fixes bug 10402, where the rdrand engine would use the rdrand
instruction, not as an additional entropy source, but as a replacement
for the entire userspace PRNG. That's obviously stupid: even if you
don't think that RDRAND is a likely security risk, the right response
to an alleged new alleged entropy source is never to throw away all
previously used entropy sources.
Patch adjusted for 0.2.3.25: Difference between removed code in
log_engine(): log(LOG_NOTICE, [...]) vs log_notice([...]).
---
src/common/crypto.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
Index: tor-0.2.3.25/src/common/crypto.c
===================================================================
--- tor-0.2.3.25.orig/src/common/crypto.c 2014-01-20 21:04:58.000000000 +0000
+++ tor-0.2.3.25/src/common/crypto.c 2014-01-20 21:06:57.000000000 +0000
@@ -193,8 +193,8 @@ log_engine(const char *fn, ENGINE *e)
const char *name, *id;
name = ENGINE_get_name(e);
id = ENGINE_get_id(e);
- log(LOG_NOTICE, LD_CRYPTO, "Using OpenSSL engine %s [%s] for %s",
- name?name:"?", id?id:"?", fn);
+ log_notice(LD_CRYPTO, "Default OpenSSL engine for %s is %s [%s]",
+ fn, name?name:"?", id?id:"?");
} else {
log(LOG_INFO, LD_CRYPTO, "Using default implementation for %s", fn);
}
@@ -268,7 +268,7 @@ crypto_global_init(int useAccel, const c
}
log_engine("RSA", ENGINE_get_default_RSA());
log_engine("DH", ENGINE_get_default_DH());
- log_engine("RAND", ENGINE_get_default_RAND());
+ log_engine("RAND (which we will not use)", ENGINE_get_default_RAND());
log_engine("SHA1", ENGINE_get_digest_engine(NID_sha1));
log_engine("3DES", ENGINE_get_cipher_engine(NID_des_ede3_ecb));
log_engine("AES", ENGINE_get_cipher_engine(NID_aes_128_ecb));
@@ -277,6 +277,13 @@ crypto_global_init(int useAccel, const c
log_info(LD_CRYPTO, "NOT using OpenSSL engine support.");
}
+ if (RAND_get_rand_method() != RAND_SSLeay()) {
+ log_notice(LD_CRYPTO, "It appears that one of our engines has provided "
+ "a replacement the OpenSSL RNG. Resetting it to the default "
+ "implementation.");
+ RAND_set_rand_method(RAND_SSLeay());
+ }
+
evaluate_evp_for_aes(-1);
evaluate_ctr_for_aes();