[tor-commits] [tor/master] Move crypto_global_cleanup() to the bottom of crypto.c.

nickm at torproject.org nickm at torproject.org
Wed Nov 30 18:18:22 UTC 2011


commit a708e85236d17abaf16da4c455af8a776ad2f7b9
Author: George Kadianakis <desnacked at gmail.com>
Date:   Tue Nov 22 15:11:40 2011 +0100

    Move crypto_global_cleanup() to the bottom of crypto.c.
---
 src/common/crypto.c |   63 ++++++++++++++++++++++++++-------------------------
 1 files changed, 32 insertions(+), 31 deletions(-)

diff --git a/src/common/crypto.c b/src/common/crypto.c
index ebaa012..a9d8b04 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -291,37 +291,6 @@ crypto_thread_cleanup(void)
   ERR_remove_state(0);
 }
 
-/** Uninitialize the crypto library. Return 0 on success, -1 on failure.
- */
-int
-crypto_global_cleanup(void)
-{
-  EVP_cleanup();
-  ERR_remove_state(0);
-  ERR_free_strings();
-
-#ifndef DISABLE_ENGINES
-  ENGINE_cleanup();
-#endif
-
-  CONF_modules_unload(1);
-  CRYPTO_cleanup_all_ex_data();
-#ifdef TOR_IS_MULTITHREADED
-  if (_n_openssl_mutexes) {
-    int n = _n_openssl_mutexes;
-    tor_mutex_t **ms = _openssl_mutexes;
-    int i;
-    _openssl_mutexes = NULL;
-    _n_openssl_mutexes = 0;
-    for (i=0;i<n;++i) {
-      tor_mutex_free(ms[i]);
-    }
-    tor_free(ms);
-  }
-#endif
-  return 0;
-}
-
 /** used by tortls.c: wrap an RSA* in a crypto_pk_env_t. */
 crypto_pk_env_t *
 _crypto_new_pk_env_rsa(RSA *rsa)
@@ -3090,5 +3059,37 @@ setup_openssl_threading(void)
   return 0;
 }
 #endif
+
+/** Uninitialize the crypto library. Return 0 on success, -1 on failure.
+ */
+int
+crypto_global_cleanup(void)
+{
+  EVP_cleanup();
+  ERR_remove_state(0);
+  ERR_free_strings();
+
+#ifndef DISABLE_ENGINES
+  ENGINE_cleanup();
+#endif
+
+  CONF_modules_unload(1);
+  CRYPTO_cleanup_all_ex_data();
+#ifdef TOR_IS_MULTITHREADED
+  if (_n_openssl_mutexes) {
+    int n = _n_openssl_mutexes;
+    tor_mutex_t **ms = _openssl_mutexes;
+    int i;
+    _openssl_mutexes = NULL;
+    _n_openssl_mutexes = 0;
+    for (i=0;i<n;++i) {
+      tor_mutex_free(ms[i]);
+    }
+    tor_free(ms);
+  }
+#endif
+  return 0;
+}
+
 /** @} */
 





More information about the tor-commits mailing list