aboutsummaryrefslogtreecommitdiff
path: root/src/common/crypto.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-09-04 12:32:38 -0400
committerNick Mathewson <nickm@torproject.org>2012-09-06 11:31:22 -0400
commite3a130a7eb6e56a150c1902641efa5a7e0f62ad4 (patch)
treea8cb04cef651b3845fbe243f1fd9fab0e7e2af43 /src/common/crypto.c
parent485b4b7eee3bebf3f783d5d0d5d3c9cd8133f7f7 (diff)
downloadtor-e3a130a7eb6e56a150c1902641efa5a7e0f62ad4.tar.gz
tor-e3a130a7eb6e56a150c1902641efa5a7e0f62ad4.zip
Don't log about Libevent/OpenSSL initialization when all's well
OTOH, log the Libevent and OpenSSL versions on the first line when we're starting Tor.
Diffstat (limited to 'src/common/crypto.c')
-rw-r--r--src/common/crypto.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c
index a69e6c5cb8..77f94ba807 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -221,6 +221,30 @@ try_load_engine(const char *path, const char *engine)
}
#endif
+static char *crypto_openssl_version_str = NULL;
+/* Return a human-readable version of the run-time openssl version number. */
+const char *
+crypto_openssl_get_version_str(void)
+{
+ if (crypto_openssl_version_str == NULL) {
+ const char *raw_version = SSLeay_version(SSLEAY_VERSION);
+ const char *end_of_version = NULL;
+ /* The output should be something like "OpenSSL 1.0.0b 10 May 2012. Let's
+ trim that down. */
+ if (!strcmpstart(raw_version, "OpenSSL ")) {
+ raw_version += strlen("OpenSSL ");
+ end_of_version = strchr(raw_version, ' ');
+ }
+
+ if (end_of_version)
+ crypto_openssl_version_str = tor_strndup(raw_version,
+ end_of_version-raw_version);
+ else
+ crypto_openssl_version_str = tor_strdup(raw_version);
+ }
+ return crypto_openssl_version_str;
+}
+
/** Initialize the crypto library. Return 0 on success, -1 on failure.
*/
int
@@ -3018,6 +3042,7 @@ crypto_global_cleanup(void)
tor_free(ms);
}
#endif
+ tor_free(crypto_openssl_version_str);
return 0;
}