summaryrefslogtreecommitdiff
path: root/src/lib/crypt_ops/crypto_init.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-08-12 17:18:41 -0400
committerNick Mathewson <nickm@torproject.org>2018-08-21 12:25:33 -0400
commit6a88d8f6b413efdac4b0176cfb78431be46ca9e0 (patch)
tree873962eaa3b6ac1f5ad4d5a2532dec8d108ec080 /src/lib/crypt_ops/crypto_init.c
parent1992c761308538cffea64abecc9e45cbd47b1bda (diff)
downloadtor-6a88d8f6b413efdac4b0176cfb78431be46ca9e0.tar.gz
tor-6a88d8f6b413efdac4b0176cfb78431be46ca9e0.zip
When enabling NSS, disable OpenSSL.
We used to link both libraries at once, but now that I'm working on TLS, there's nothing left to keep OpenSSL around for when NSS is enabled. Note that this patch causes a couple of places that still assumed OpenSSL to be disabled when NSS is enabled - tor-gencert - pbkdf2
Diffstat (limited to 'src/lib/crypt_ops/crypto_init.c')
-rw-r--r--src/lib/crypt_ops/crypto_init.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/lib/crypt_ops/crypto_init.c b/src/lib/crypt_ops/crypto_init.c
index 620fe8e1be..f9b077e9e7 100644
--- a/src/lib/crypt_ops/crypto_init.c
+++ b/src/lib/crypt_ops/crypto_init.c
@@ -88,6 +88,10 @@ crypto_global_init(int useAccel, const char *accelName, const char *accelDir)
#ifdef ENABLE_OPENSSL
if (crypto_openssl_late_init(useAccel, accelName, accelDir) < 0)
return -1;
+#else
+ (void)useAccel;
+ (void)accelName;
+ (void)accelDir;
#endif
#ifdef ENABLE_NSS
if (crypto_nss_late_init() < 0)
@@ -139,3 +143,41 @@ crypto_postfork(void)
crypto_nss_postfork();
#endif
}
+
+/** Return the name of the crypto library we're using. */
+const char *
+crypto_get_library_name(void)
+{
+#ifdef ENABLE_OPENSSL
+ return "OpenSSL";
+#endif
+#ifdef ENABLE_NSS
+ return "NSS";
+#endif
+}
+
+/** Return the version of the crypto library we are using, as given in the
+ * library. */
+const char *
+crypto_get_library_version_string(void)
+{
+#ifdef ENABLE_OPENSSL
+ return crypto_openssl_get_version_str();
+#endif
+#ifdef ENABLE_NSS
+ return crypto_nss_get_version_str();
+#endif
+}
+
+/** Return the version of the crypto library we're using, as given in the
+ * headers. */
+const char *
+crypto_get_header_version_string(void)
+{
+#ifdef ENABLE_OPENSSL
+ return crypto_openssl_get_header_version_str();
+#endif
+#ifdef ENABLE_NSS
+ return crypto_nss_get_header_version_str();
+#endif
+}