[or-cvs] Add a (diabled by default) option in crypto.h to disable mo...

Nick Mathewson nickm at seul.org
Tue Jan 10 21:12:08 UTC 2006


Update of /home/or/cvsroot/tor/src/common
In directory moria:/tmp/cvs-serv27101/src/common

Modified Files:
	crypto.c crypto.h tortls.c 
Log Message:
Add a (diabled by default) option in crypto.h to disable most of the interesting crypto-related changes made on 0.1.1.9. This will help hunt bug 234.

Index: crypto.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/crypto.c,v
retrieving revision 1.182
retrieving revision 1.183
diff -u -p -d -r1.182 -r1.183
--- crypto.c	14 Dec 2005 20:40:39 -0000	1.182
+++ crypto.c	10 Jan 2006 21:12:06 -0000	1.183
@@ -228,7 +228,9 @@ crypto_global_init(int useAccel)
 void
 crypto_thread_cleanup(void)
 {
+#ifndef ENABLE_0119_PARANOIA
   ERR_remove_state(0);
+#endif
 }
 
 /** Uninitialize the crypto library. Return 0 on success, -1 on failure.
@@ -237,13 +239,17 @@ int
 crypto_global_cleanup(void)
 {
   EVP_cleanup();
+#ifndef ENABLE_0119_PARANOIA
   ERR_remove_state(0);
+#endif
   ERR_free_strings();
 #ifndef NO_ENGINES
   ENGINE_cleanup();
+#ifndef ENABLE_0119_PARANOIA
   CONF_modules_unload(1);
   CRYPTO_cleanup_all_ex_data();
 #endif
+#endif
 #ifdef TOR_IS_MULTITHREADED
   if (_n_openssl_mutexes) {
     int n = _n_openssl_mutexes;
@@ -1375,7 +1381,9 @@ crypto_dh_new(void)
   if (!(res->dh->g = BN_dup(dh_param_g)))
     goto err;
 
+#ifndef ENABLE_0119_PARANOIA
   res->dh->length = DH_PRIVATE_KEY_BITS;
+#endif
 
   return res;
  err:
@@ -1602,7 +1610,11 @@ crypto_dh_free(crypto_dh_env_t *dh)
 
 /* Use RAND_poll if openssl is 0.9.6 release or later.  (The "f" means
    "release".)  */
+#ifndef ENABLE_0119_PARANOIA
 #define USE_RAND_POLL (OPENSSL_VERSION_NUMBER >= 0x0090600fl)
+#else
+#define USE_RAND_POLL 0
+#endif
 
 /** Seed OpenSSL's random number generator with bytes from the
  * operating system.  Return 0 on success, -1 on failure.

Index: crypto.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/crypto.h,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -p -d -r1.73 -r1.74
--- crypto.h	14 Dec 2005 20:40:39 -0000	1.73
+++ crypto.h	10 Jan 2006 21:12:06 -0000	1.74
@@ -15,6 +15,8 @@
 
 #include <stdio.h>
 
+#undef ENABLE_0119_PARANOIA
+
 /** Length of the output of our message digest. */
 #define DIGEST_LEN 20
 /** Length of our symmetric cipher's keys. */

Index: tortls.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/tortls.c,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -p -d -r1.113 -r1.114
--- tortls.c	14 Dec 2005 20:40:39 -0000	1.113
+++ tortls.c	10 Jan 2006 21:12:06 -0000	1.114
@@ -363,7 +363,9 @@ tor_tls_context_new(crypto_pk_env_t *ide
       goto error;
     SSL_CTX_set_options(*ctx, SSL_OP_NO_SSLv2);
 #endif
+#ifndef ENABLE_0119_PARANOIA
     SSL_CTX_set_options(*ctx, SSL_OP_SINGLE_DH_USE);
+#endif
     if (!SSL_CTX_set_cipher_list(*ctx, CIPHER_LIST))
       goto error;
     if (!client_only) {



More information about the tor-commits mailing list