[or-cvs] Only do openssl accel stuff if version is at least 0.9.7

Nick Mathewson nickm at seul.org
Fri Sep 9 22:07:17 UTC 2005


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

Modified Files:
	crypto.c 
Log Message:
Only do openssl accel stuff if version is at least 0.9.7

Index: crypto.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/crypto.c,v
retrieving revision 1.154
retrieving revision 1.155
diff -u -d -r1.154 -r1.155
--- crypto.c	26 Aug 2005 18:40:44 -0000	1.154
+++ crypto.c	9 Sep 2005 22:07:15 -0000	1.155
@@ -22,7 +22,6 @@
 
 #include <string.h>
 
-#include <openssl/engine.h>
 #include <openssl/err.h>
 #include <openssl/rsa.h>
 #include <openssl/pem.h>
@@ -65,6 +64,12 @@
 #define OPENSSL_095
 #endif
 
+#if OPENSSL_VERSION_NUMBER < 0x00907000l
+#define NO_ENGINES
+#else
+#include <openssl/engine.h>
+#endif
+
 /* Certain functions that return a success code in OpenSSL 0.9.6 return void
  * (and don't indicate errors) in OpenSSL version 0.9.5.
  *
@@ -161,6 +166,7 @@
   }
 }
 
+#ifndef NO_ENGINES
 static void
 log_engine(const char *fn, ENGINE *e)
 {
@@ -174,6 +180,7 @@
     log(LOG_INFO, "Using default implementation for %s", fn);
   }
 }
+#endif
 
 /** Initialize the crypto library.  Return 0 on success, -1 on failure.
  */
@@ -185,6 +192,7 @@
     OpenSSL_add_all_algorithms();
     _crypto_global_initialized = 1;
     setup_openssl_threading();
+#ifndef NO_ENGINES
     if (useAccel) {
       if (useAccel < 0)
         log_fn(LOG_WARN, "Initializing OpenSSL via tor_tls_init().");
@@ -201,6 +209,7 @@
       log_engine("3DES", ENGINE_get_cipher_engine(NID_des_ede3_ecb));
       log_engine("AES", ENGINE_get_cipher_engine(NID_aes_128_ecb));
     }
+#endif
   }
   return 0;
 }
@@ -210,7 +219,9 @@
 int crypto_global_cleanup()
 {
   ERR_free_strings();
+#ifndef NO_ENGINES
   ENGINE_cleanup();
+#endif
 #ifdef TOR_IS_MULTITHREADED
   if (_n_openssl_mutexes) {
     int n = _n_openssl_mutexes;



More information about the tor-commits mailing list