aboutsummaryrefslogtreecommitdiff
path: root/src/test
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/test
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/test')
-rw-r--r--src/test/bench.c8
-rw-r--r--src/test/include.am2
-rw-r--r--src/test/test.c2
-rw-r--r--src/test/test_crypto.c4
-rw-r--r--src/test/test_crypto_slow.c2
5 files changed, 17 insertions, 1 deletions
diff --git a/src/test/bench.c b/src/test/bench.c
index 2b90ccf734..3594059057 100644
--- a/src/test/bench.c
+++ b/src/test/bench.c
@@ -13,11 +13,14 @@
#include "core/or/or.h"
#include "core/crypto/onion_tap.h"
#include "core/crypto/relay_crypto.h"
+
+#ifdef ENABLE_OPENSSL
#include <openssl/opensslv.h>
#include <openssl/evp.h>
#include <openssl/ec.h>
#include <openssl/ecdh.h>
#include <openssl/obj_mac.h>
+#endif
#include "core/or/circuitlist.h"
#include "app/config/config.h"
@@ -580,6 +583,7 @@ bench_dh(void)
" %f millisec each.\n", NANOCOUNT(start, end, iters)/1e6);
}
+#ifdef ENABLE_OPENSSL
static void
bench_ecdh_impl(int nid, const char *name)
{
@@ -629,6 +633,7 @@ bench_ecdh_p224(void)
{
bench_ecdh_impl(NID_secp224r1, "P-224");
}
+#endif
typedef void (*bench_fn)(void);
@@ -652,8 +657,11 @@ static struct benchmark_t benchmarks[] = {
ENT(cell_aes),
ENT(cell_ops),
ENT(dh),
+
+#ifdef ENABLE_OPENSSL
ENT(ecdh_p256),
ENT(ecdh_p224),
+#endif
{NULL,NULL,0}
};
diff --git a/src/test/include.am b/src/test/include.am
index c2e08aa3df..05149b8654 100644
--- a/src/test/include.am
+++ b/src/test/include.am
@@ -118,7 +118,6 @@ src_test_test_SOURCES += \
src/test/test_controller_events.c \
src/test/test_crypto.c \
src/test/test_crypto_ope.c \
- src/test/test_crypto_openssl.c \
src/test/test_data.c \
src/test/test_dir.c \
src/test/test_dir_common.c \
@@ -189,6 +188,7 @@ if USE_NSS
# ...
else
src_test_test_SOURCES += \
+ src/test/test_crypto_openssl.c \
src/test/test_tortls_openssl.c
endif
diff --git a/src/test/test.c b/src/test/test.c
index 3b63f1c07e..9623443057 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -866,7 +866,9 @@ struct testgroup_t testgroups[] = {
{ "control/event/", controller_event_tests },
{ "crypto/", crypto_tests },
{ "crypto/ope/", crypto_ope_tests },
+#ifdef ENABLE_OPENSSL
{ "crypto/openssl/", crypto_openssl_tests },
+#endif
{ "crypto/pem/", pem_tests },
{ "dir/", dir_tests },
{ "dir_handle_get/", dir_handle_get_tests },
diff --git a/src/test/test_crypto.c b/src/test/test_crypto.c
index 90fb8d468b..04077b42fb 100644
--- a/src/test/test_crypto.c
+++ b/src/test/test_crypto.c
@@ -224,6 +224,9 @@ static void
test_crypto_openssl_version(void *arg)
{
(void)arg;
+#ifdef ENABLE_NSS
+ tt_skip();
+#else
const char *version = crypto_openssl_get_version_str();
const char *h_version = crypto_openssl_get_header_version_str();
tt_assert(version);
@@ -243,6 +246,7 @@ test_crypto_openssl_version(void *arg)
tt_int_op(a, OP_GE, 0);
tt_int_op(b, OP_GE, 0);
tt_int_op(c, OP_GE, 0);
+#endif
done:
;
diff --git a/src/test/test_crypto_slow.c b/src/test/test_crypto_slow.c
index 88b31ad9af..ca6b7b8d4d 100644
--- a/src/test/test_crypto_slow.c
+++ b/src/test/test_crypto_slow.c
@@ -18,7 +18,9 @@
#include <libscrypt.h>
#endif
+#ifdef ENABLE_OPENSSL
#include <openssl/evp.h>
+#endif
/** Run unit tests for our secret-to-key passphrase hashing functionality. */
static void