aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/bench.c13
-rw-r--r--src/test/fuzz/fuzz_consensus.c3
-rw-r--r--src/test/fuzz/fuzz_hsdescv2.c2
-rw-r--r--src/test/fuzz/fuzz_iptsv2.c2
-rw-r--r--src/test/fuzz/fuzz_microdesc.c3
-rw-r--r--src/test/fuzz/fuzz_vrs.c2
-rw-r--r--src/test/fuzz/fuzzing_common.c2
-rw-r--r--src/test/test.c6
-rw-r--r--src/test/test_accounting.c3
-rw-r--r--src/test/test_addr.c5
-rw-r--r--src/test/test_bt_cl.c5
-rw-r--r--src/test/test_buffers.c3
-rw-r--r--src/test/test_cell_formats.c1
-rw-r--r--src/test/test_channelpadding.c4
-rw-r--r--src/test/test_channeltls.c2
-rw-r--r--src/test/test_checkdir.c5
-rw-r--r--src/test/test_circuitbuild.c2
-rw-r--r--src/test/test_config.c8
-rw-r--r--src/test/test_conscache.c2
-rw-r--r--src/test/test_consdiffmgr.c3
-rw-r--r--src/test/test_controller.c2
-rw-r--r--src/test/test_controller_events.c2
-rw-r--r--src/test/test_crypto.c92
-rw-r--r--src/test/test_crypto_slow.c3
-rw-r--r--src/test/test_dir.c8
-rw-r--r--src/test/test_dns.c2
-rw-r--r--src/test/test_entryconn.c3
-rw-r--r--src/test/test_entrynodes.c2
-rw-r--r--src/test/test_extorport.c5
-rw-r--r--src/test/test_helpers.c2
-rw-r--r--src/test/test_hs.c6
-rw-r--r--src/test/test_hs_cache.c2
-rw-r--r--src/test/test_hs_client.c10
-rw-r--r--src/test/test_hs_common.c3
-rw-r--r--src/test/test_hs_control.c2
-rw-r--r--src/test/test_hs_descriptor.c2
-rw-r--r--src/test/test_hs_ntor.c3
-rw-r--r--src/test/test_hs_ntor_cl.c3
-rw-r--r--src/test/test_hs_service.c3
-rw-r--r--src/test/test_link_handshake.c2
-rw-r--r--src/test/test_logging.c4
-rw-r--r--src/test/test_microdesc.c5
-rw-r--r--src/test/test_oos.c2
-rw-r--r--src/test/test_options.c1
-rw-r--r--src/test/test_policy.c3
-rw-r--r--src/test/test_pt.c3
-rw-r--r--src/test/test_relay.c2
-rw-r--r--src/test/test_routerkeys.c9
-rw-r--r--src/test/test_routerlist.c5
-rw-r--r--src/test/test_routerset.c2
-rw-r--r--src/test/test_shared_random.c6
-rw-r--r--src/test/test_socks.c1
-rw-r--r--src/test/test_status.c3
-rw-r--r--src/test/test_storagedir.c2
-rw-r--r--src/test/test_switch_id.c3
-rw-r--r--src/test/test_tortls.c1
-rw-r--r--src/test/test_util.c13
-rw-r--r--src/test/testing_common.c10
58 files changed, 220 insertions, 88 deletions
diff --git a/src/test/bench.c b/src/test/bench.c
index 6653f4942f..ced04fffd7 100644
--- a/src/test/bench.c
+++ b/src/test/bench.c
@@ -19,12 +19,15 @@
#include <openssl/ecdh.h>
#include <openssl/obj_mac.h>
+#include "or/circuitlist.h"
#include "or/config.h"
#include "lib/crypt_ops/crypto_curve25519.h"
+#include "lib/crypt_ops/crypto_dh.h"
#include "or/onion_ntor.h"
#include "lib/crypt_ops/crypto_ed25519.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "or/consdiff.h"
+#include "lib/compress/compress.h"
#include "or/cell_st.h"
#include "or/or_circuit_st.h"
@@ -551,8 +554,8 @@ bench_dh(void)
reset_perftime();
start = perftime();
for (i = 0; i < iters; ++i) {
- char dh_pubkey_a[DH_BYTES], dh_pubkey_b[DH_BYTES];
- char secret_a[DH_BYTES], secret_b[DH_BYTES];
+ char dh_pubkey_a[DH1024_KEY_LEN], dh_pubkey_b[DH1024_KEY_LEN];
+ char secret_a[DH1024_KEY_LEN], secret_b[DH1024_KEY_LEN];
ssize_t slen_a, slen_b;
crypto_dh_t *dh_a = crypto_dh_new(DH_TYPE_TLS);
crypto_dh_t *dh_b = crypto_dh_new(DH_TYPE_TLS);
@@ -586,7 +589,7 @@ bench_ecdh_impl(int nid, const char *name)
reset_perftime();
start = perftime();
for (i = 0; i < iters; ++i) {
- char secret_a[DH_BYTES], secret_b[DH_BYTES];
+ char secret_a[DH1024_KEY_LEN], secret_b[DH1024_KEY_LEN];
ssize_t slen_a, slen_b;
EC_KEY *dh_a = EC_KEY_new_by_curve_name(nid);
EC_KEY *dh_b = EC_KEY_new_by_curve_name(nid);
@@ -597,10 +600,10 @@ bench_ecdh_impl(int nid, const char *name)
EC_KEY_generate_key(dh_a);
EC_KEY_generate_key(dh_b);
- slen_a = ECDH_compute_key(secret_a, DH_BYTES,
+ slen_a = ECDH_compute_key(secret_a, DH1024_KEY_LEN,
EC_KEY_get0_public_key(dh_b), dh_a,
NULL);
- slen_b = ECDH_compute_key(secret_b, DH_BYTES,
+ slen_b = ECDH_compute_key(secret_b, DH1024_KEY_LEN,
EC_KEY_get0_public_key(dh_a), dh_b,
NULL);
diff --git a/src/test/fuzz/fuzz_consensus.c b/src/test/fuzz/fuzz_consensus.c
index de54da61b8..81a3101545 100644
--- a/src/test/fuzz/fuzz_consensus.c
+++ b/src/test/fuzz/fuzz_consensus.c
@@ -4,6 +4,8 @@
#include "or/or.h"
#include "or/routerparse.h"
#include "or/networkstatus.h"
+#include "lib/crypt_ops/crypto_ed25519.h"
+#include "or/networkstatus_st.h"
#include "test/fuzz/fuzzing.h"
static void
@@ -75,4 +77,3 @@ fuzz_main(const uint8_t *data, size_t sz)
tor_free(str);
return 0;
}
-
diff --git a/src/test/fuzz/fuzz_hsdescv2.c b/src/test/fuzz/fuzz_hsdescv2.c
index 5cf2cffb88..7fd86f40b1 100644
--- a/src/test/fuzz/fuzz_hsdescv2.c
+++ b/src/test/fuzz/fuzz_hsdescv2.c
@@ -4,6 +4,7 @@
#include "or/or.h"
#include "or/routerparse.h"
#include "or/rendcommon.h"
+#include "lib/crypt_ops/crypto_ed25519.h"
#include "test/fuzz/fuzzing.h"
static void
@@ -49,4 +50,3 @@ fuzz_main(const uint8_t *data, size_t sz)
tor_free(str);
return 0;
}
-
diff --git a/src/test/fuzz/fuzz_iptsv2.c b/src/test/fuzz/fuzz_iptsv2.c
index 7bf4d1282e..e4ec7fffce 100644
--- a/src/test/fuzz/fuzz_iptsv2.c
+++ b/src/test/fuzz/fuzz_iptsv2.c
@@ -4,6 +4,7 @@
#include "or/or.h"
#include "or/routerparse.h"
#include "or/rendcommon.h"
+#include "lib/crypt_ops/crypto_ed25519.h"
#include "or/rend_service_descriptor_st.h"
@@ -46,4 +47,3 @@ fuzz_main(const uint8_t *data, size_t sz)
rend_service_descriptor_free(desc);
return 0;
}
-
diff --git a/src/test/fuzz/fuzz_microdesc.c b/src/test/fuzz/fuzz_microdesc.c
index 74e0ef4f46..a7fe1bb66d 100644
--- a/src/test/fuzz/fuzz_microdesc.c
+++ b/src/test/fuzz/fuzz_microdesc.c
@@ -4,6 +4,8 @@
#include "or/or.h"
#include "or/routerparse.h"
#include "or/microdesc.h"
+#include "lib/crypt_ops/crypto_ed25519.h"
+
#include "test/fuzz/fuzzing.h"
static void
@@ -44,4 +46,3 @@ fuzz_main(const uint8_t *data, size_t sz)
}
return 0;
}
-
diff --git a/src/test/fuzz/fuzz_vrs.c b/src/test/fuzz/fuzz_vrs.c
index 0713f99c35..7d28ef1c7a 100644
--- a/src/test/fuzz/fuzz_vrs.c
+++ b/src/test/fuzz/fuzz_vrs.c
@@ -10,6 +10,7 @@
#include "or/networkstatus_st.h"
#include "or/vote_routerstatus_st.h"
+#include "lib/crypt_ops/crypto_ed25519.h"
#include "test/fuzz/fuzzing.h"
@@ -83,4 +84,3 @@ fuzz_main(const uint8_t *data, size_t sz)
tor_free(str);
return 0;
}
-
diff --git a/src/test/fuzz/fuzzing_common.c b/src/test/fuzz/fuzzing_common.c
index 9e736ea69d..c947ebfceb 100644
--- a/src/test/fuzz/fuzzing_common.c
+++ b/src/test/fuzz/fuzzing_common.c
@@ -6,6 +6,7 @@
#include "lib/err/backtrace.h"
#include "or/config.h"
#include "test/fuzz/fuzzing.h"
+#include "lib/compress/compress.h"
#include "lib/crypt_ops/crypto.h"
#include "lib/crypt_ops/crypto_ed25519.h"
@@ -189,4 +190,3 @@ main(int argc, char **argv)
}
#endif
-
diff --git a/src/test/test.c b/src/test/test.c
index e3121293c3..d6be5ea2e7 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -9,8 +9,11 @@
**/
#include "orconfig.h"
+#include "lib/crypt_ops/crypto_dh.h"
#include "lib/crypt_ops/crypto_rand.h"
+#include "or/or_state_st.h"
+
#include <stdio.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
@@ -148,7 +151,8 @@ test_bad_onion_handshake(void *arg)
memset(junk_buf, 0, sizeof(junk_buf));
crypto_pk_obsolete_public_hybrid_encrypt(pk,
junk_buf2, TAP_ONIONSKIN_CHALLENGE_LEN,
- junk_buf, DH_KEY_LEN, PK_PKCS1_OAEP_PADDING, 1);
+ junk_buf, DH1024_KEY_LEN,
+ PK_PKCS1_OAEP_PADDING, 1);
tt_int_op(-1, OP_EQ,
onion_skin_TAP_server_handshake(junk_buf2, pk, NULL,
s_buf, s_keys, 40));
diff --git a/src/test/test_accounting.c b/src/test/test_accounting.c
index ce8e08f7c9..7b9511dc20 100644
--- a/src/test/test_accounting.c
+++ b/src/test/test_accounting.c
@@ -9,6 +9,8 @@
#define STATEFILE_PRIVATE
#include "or/statefile.h"
+#include "or/or_state_st.h"
+
#define NS_MODULE accounting
#define NS_SUBMODULE limits
@@ -102,4 +104,3 @@ struct testcase_t accounting_tests[] = {
{ "bwlimits", test_accounting_limits, TT_FORK, NULL, NULL },
END_OF_TESTCASES
};
-
diff --git a/src/test/test_addr.c b/src/test/test_addr.c
index 0a3212adbc..1069e25b43 100644
--- a/src/test/test_addr.c
+++ b/src/test/test_addr.c
@@ -11,6 +11,10 @@
#include "or/addressmap.h"
#include "test/log_test_helpers.h"
+#ifdef HAVE_SYS_UN_H
+#include <sys/un.h>
+#endif
+
/** Mocking replacement: only handles localhost. */
static int
mock_tor_addr_lookup(const char *name, uint16_t family, tor_addr_t *addr_out)
@@ -1257,4 +1261,3 @@ struct testcase_t addr_tests[] = {
{ "make_null", test_addr_make_null, 0, NULL, NULL },
END_OF_TESTCASES
};
-
diff --git a/src/test/test_bt_cl.c b/src/test/test_bt_cl.c
index c64ca8e2b3..8a8221f190 100644
--- a/src/test/test_bt_cl.c
+++ b/src/test/test_bt_cl.c
@@ -12,6 +12,10 @@
#include "lib/err/backtrace.h"
#include "lib/log/torlog.h"
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
/* -1: no crash.
* 0: crash with a segmentation fault.
* 1x: crash with an assertion failure. */
@@ -118,4 +122,3 @@ main(int argc, char **argv)
return 0;
}
-
diff --git a/src/test/test_buffers.c b/src/test/test_buffers.c
index 66ee997225..604f1422c1 100644
--- a/src/test/test_buffers.c
+++ b/src/test/test_buffers.c
@@ -8,6 +8,8 @@
#include "or/or.h"
#include "lib/container/buffers.h"
#include "lib/tls/buffers_tls.h"
+#include "lib/tls/tortls.h"
+#include "lib/compress/compress.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "or/proto_http.h"
#include "or/proto_socks.h"
@@ -819,4 +821,3 @@ struct testcase_t buffer_tests[] = {
END_OF_TESTCASES
};
-
diff --git a/src/test/test_cell_formats.c b/src/test/test_cell_formats.c
index 844fa4a16c..da5e5defd1 100644
--- a/src/test/test_cell_formats.c
+++ b/src/test/test_cell_formats.c
@@ -1302,4 +1302,3 @@ struct testcase_t cell_format_tests[] = {
TEST(is_destroy, 0),
END_OF_TESTCASES
};
-
diff --git a/src/test/test_channelpadding.c b/src/test/test_channelpadding.c
index 4ae7e16361..7e0c33f63b 100644
--- a/src/test/test_channelpadding.c
+++ b/src/test/test_channelpadding.c
@@ -19,6 +19,9 @@
#include "or/main.h"
#include "or/networkstatus.h"
#include "test/log_test_helpers.h"
+#include "lib/tls/tortls.h"
+#include "common/timers.h"
+#include "lib/container/buffers.h"
#include "or/cell_st.h"
#include "or/networkstatus_st.h"
@@ -1168,4 +1171,3 @@ struct testcase_t channelpadding_tests[] = {
TEST_CHANNELPADDING(channelpadding_timers, TT_FORK),
END_OF_TESTCASES
};
-
diff --git a/src/test/test_channeltls.c b/src/test/test_channeltls.c
index aed766fc00..ad2b443cf2 100644
--- a/src/test/test_channeltls.c
+++ b/src/test/test_channeltls.c
@@ -11,6 +11,7 @@
#include "lib/container/buffers.h"
#include "or/channel.h"
#include "or/channeltls.h"
+#include "or/connection.h"
#include "or/connection_or.h"
#include "or/config.h"
/* For init/free stuff */
@@ -336,4 +337,3 @@ struct testcase_t channeltls_tests[] = {
TT_FORK, NULL, NULL },
END_OF_TESTCASES
};
-
diff --git a/src/test/test_checkdir.c b/src/test/test_checkdir.c
index d0c899a07e..09688cf0a9 100644
--- a/src/test/test_checkdir.c
+++ b/src/test/test_checkdir.c
@@ -14,6 +14,10 @@
#include "test/test.h"
#include "common/util.h"
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
#ifdef _WIN32
#define mkdir(a,b) mkdir(a)
#define tt_int_op_nowin(a,op,b) do { (void)(a); (void)(b); } while (0)
@@ -146,4 +150,3 @@ struct testcase_t checkdir_tests[] = {
CHECKDIR(perms, TT_FORK),
END_OF_TESTCASES
};
-
diff --git a/src/test/test_circuitbuild.c b/src/test/test_circuitbuild.c
index d17a04614c..c09133c549 100644
--- a/src/test/test_circuitbuild.c
+++ b/src/test/test_circuitbuild.c
@@ -11,6 +11,7 @@
#include "test/log_test_helpers.h"
#include "or/config.h"
#include "or/circuitbuild.h"
+#include "or/circuitlist.h"
#include "or/extend_info_st.h"
@@ -132,4 +133,3 @@ struct testcase_t circuitbuild_tests[] = {
{ "unhandled_exit", test_new_route_len_unhandled_exit, 0, NULL, NULL },
END_OF_TESTCASES
};
-
diff --git a/src/test/test_config.c b/src/test/test_config.c
index f33e547b89..fb05645930 100644
--- a/src/test/test_config.c
+++ b/src/test/test_config.c
@@ -51,6 +51,14 @@
#include "lib/fs/conffile.h"
#include "lib/meminfo/meminfo.h"
#include "lib/net/gethostname.h"
+#include "lib/encoding/confline.h"
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
static void
test_config_addressmap(void *arg)
diff --git a/src/test/test_conscache.c b/src/test/test_conscache.c
index e3a617fe3e..3d3a50297b 100644
--- a/src/test/test_conscache.c
+++ b/src/test/test_conscache.c
@@ -4,6 +4,7 @@
#include "or/or.h"
#include "or/config.h"
#include "or/conscache.h"
+#include "lib/encoding/confline.h"
#include "test/test.h"
#ifdef HAVE_UTIME_H
@@ -337,4 +338,3 @@ struct testcase_t conscache_tests[] = {
ENT(filter),
END_OF_TESTCASES
};
-
diff --git a/src/test/test_consdiffmgr.c b/src/test/test_consdiffmgr.c
index c09586afcc..a0dfe95d35 100644
--- a/src/test/test_consdiffmgr.c
+++ b/src/test/test_consdiffmgr.c
@@ -13,6 +13,8 @@
#include "or/networkstatus.h"
#include "or/routerparse.h"
#include "common/workqueue.h"
+#include "lib/compress/compress.h"
+#include "lib/encoding/confline.h"
#include "or/networkstatus_st.h"
@@ -896,4 +898,3 @@ struct testcase_t consdiffmgr_tests[] = {
END_OF_TESTCASES
};
-
diff --git a/src/test/test_controller.c b/src/test/test_controller.c
index de8e4630cd..54c2e0a2ec 100644
--- a/src/test/test_controller.c
+++ b/src/test/test_controller.c
@@ -3,6 +3,7 @@
#define CONTROL_PRIVATE
#include "or/or.h"
+#include "lib/crypt_ops/crypto_ed25519.h"
#include "or/bridges.h"
#include "or/control.h"
#include "or/entrynodes.h"
@@ -1625,4 +1626,3 @@ struct testcase_t controller_tests[] = {
{ "getinfo_md_all", test_getinfo_md_all, 0, NULL, NULL },
END_OF_TESTCASES
};
-
diff --git a/src/test/test_controller_events.c b/src/test/test_controller_events.c
index b642a37d22..33a45a99cc 100644
--- a/src/test/test_controller_events.c
+++ b/src/test/test_controller_events.c
@@ -7,6 +7,7 @@
#include "or/or.h"
#include "or/channel.h"
#include "or/channeltls.h"
+#include "or/circuitlist.h"
#include "or/connection.h"
#include "or/control.h"
#include "test/test.h"
@@ -331,4 +332,3 @@ struct testcase_t controller_event_tests[] = {
TEST(event_mask, TT_FORK),
END_OF_TESTCASES
};
-
diff --git a/src/test/test_crypto.c b/src/test/test_crypto.c
index c72c07dd14..341dbc9a4f 100644
--- a/src/test/test_crypto.c
+++ b/src/test/test_crypto.c
@@ -12,10 +12,20 @@
#include "common/util.h"
#include "siphash.h"
#include "lib/crypt_ops/crypto_curve25519.h"
+#include "lib/crypt_ops/crypto_dh.h"
#include "lib/crypt_ops/crypto_ed25519.h"
+#include "lib/crypt_ops/crypto_format.h"
+#include "lib/crypt_ops/crypto_hkdf.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "ed25519_vectors.inc"
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
/** Run unit tests for Diffie-Hellman functionality. */
static void
test_crypto_dh(void *arg)
@@ -23,38 +33,39 @@ test_crypto_dh(void *arg)
crypto_dh_t *dh1 = crypto_dh_new(DH_TYPE_CIRCUIT);
crypto_dh_t *dh1_dup = NULL;
crypto_dh_t *dh2 = crypto_dh_new(DH_TYPE_CIRCUIT);
- char p1[DH_BYTES];
- char p2[DH_BYTES];
- char s1[DH_BYTES];
- char s2[DH_BYTES];
+ char p1[DH1024_KEY_LEN];
+ char p2[DH1024_KEY_LEN];
+ char s1[DH1024_KEY_LEN];
+ char s2[DH1024_KEY_LEN];
ssize_t s1len, s2len;
(void)arg;
- tt_int_op(crypto_dh_get_bytes(dh1),OP_EQ, DH_BYTES);
- tt_int_op(crypto_dh_get_bytes(dh2),OP_EQ, DH_BYTES);
+ tt_int_op(crypto_dh_get_bytes(dh1),OP_EQ, DH1024_KEY_LEN);
+ tt_int_op(crypto_dh_get_bytes(dh2),OP_EQ, DH1024_KEY_LEN);
- memset(p1, 0, DH_BYTES);
- memset(p2, 0, DH_BYTES);
- tt_mem_op(p1,OP_EQ, p2, DH_BYTES);
+ memset(p1, 0, DH1024_KEY_LEN);
+ memset(p2, 0, DH1024_KEY_LEN);
+ tt_mem_op(p1,OP_EQ, p2, DH1024_KEY_LEN);
tt_int_op(-1, OP_EQ, crypto_dh_get_public(dh1, p1, 6)); /* too short */
- tt_assert(! crypto_dh_get_public(dh1, p1, DH_BYTES));
- tt_mem_op(p1,OP_NE, p2, DH_BYTES);
- tt_assert(! crypto_dh_get_public(dh2, p2, DH_BYTES));
- tt_mem_op(p1,OP_NE, p2, DH_BYTES);
+ tt_assert(! crypto_dh_get_public(dh1, p1, DH1024_KEY_LEN));
+ tt_mem_op(p1,OP_NE, p2, DH1024_KEY_LEN);
+ tt_assert(! crypto_dh_get_public(dh2, p2, DH1024_KEY_LEN));
+ tt_mem_op(p1,OP_NE, p2, DH1024_KEY_LEN);
- memset(s1, 0, DH_BYTES);
- memset(s2, 0xFF, DH_BYTES);
- s1len = crypto_dh_compute_secret(LOG_WARN, dh1, p2, DH_BYTES, s1, 50);
- s2len = crypto_dh_compute_secret(LOG_WARN, dh2, p1, DH_BYTES, s2, 50);
+ memset(s1, 0, DH1024_KEY_LEN);
+ memset(s2, 0xFF, DH1024_KEY_LEN);
+ s1len = crypto_dh_compute_secret(LOG_WARN, dh1, p2, DH1024_KEY_LEN, s1, 50);
+ s2len = crypto_dh_compute_secret(LOG_WARN, dh2, p1, DH1024_KEY_LEN, s2, 50);
tt_assert(s1len > 0);
tt_int_op(s1len,OP_EQ, s2len);
tt_mem_op(s1,OP_EQ, s2, s1len);
/* test dh_dup; make sure it works the same. */
dh1_dup = crypto_dh_dup(dh1);
- s1len = crypto_dh_compute_secret(LOG_WARN, dh1_dup, p2, DH_BYTES, s1, 50);
+ s1len = crypto_dh_compute_secret(LOG_WARN, dh1_dup, p2, DH1024_KEY_LEN,
+ s1, 50);
tt_mem_op(s1,OP_EQ, s2, s1len);
{
@@ -67,12 +78,14 @@ test_crypto_dh(void *arg)
s1len = crypto_dh_compute_secret(LOG_WARN, dh1, "\x00", 1, s1, 50);
tt_int_op(-1, OP_EQ, s1len);
- memset(p1, 0, DH_BYTES); /* 0 with padding. */
- s1len = crypto_dh_compute_secret(LOG_WARN, dh1, p1, DH_BYTES, s1, 50);
+ memset(p1, 0, DH1024_KEY_LEN); /* 0 with padding. */
+ s1len = crypto_dh_compute_secret(LOG_WARN, dh1, p1, DH1024_KEY_LEN,
+ s1, 50);
tt_int_op(-1, OP_EQ, s1len);
- p1[DH_BYTES-1] = 1; /* 1 with padding*/
- s1len = crypto_dh_compute_secret(LOG_WARN, dh1, p1, DH_BYTES, s1, 50);
+ p1[DH1024_KEY_LEN-1] = 1; /* 1 with padding*/
+ s1len = crypto_dh_compute_secret(LOG_WARN, dh1, p1, DH1024_KEY_LEN,
+ s1, 50);
tt_int_op(-1, OP_EQ, s1len);
/* 2 is okay, though weird. */
@@ -89,15 +102,18 @@ test_crypto_dh(void *arg)
/* p-1, p, and so on are not okay. */
base16_decode(p1, sizeof(p1), P, strlen(P));
- s1len = crypto_dh_compute_secret(LOG_WARN, dh1, p1, DH_BYTES, s1, 50);
+ s1len = crypto_dh_compute_secret(LOG_WARN, dh1, p1, DH1024_KEY_LEN,
+ s1, 50);
tt_int_op(-1, OP_EQ, s1len);
- p1[DH_BYTES-1] = 0xFE; /* p-1 */
- s1len = crypto_dh_compute_secret(LOG_WARN, dh1, p1, DH_BYTES, s1, 50);
+ p1[DH1024_KEY_LEN-1] = 0xFE; /* p-1 */
+ s1len = crypto_dh_compute_secret(LOG_WARN, dh1, p1, DH1024_KEY_LEN,
+ s1, 50);
tt_int_op(-1, OP_EQ, s1len);
- p1[DH_BYTES-1] = 0xFD; /* p-2 works fine */
- s1len = crypto_dh_compute_secret(LOG_WARN, dh1, p1, DH_BYTES, s1, 50);
+ p1[DH1024_KEY_LEN-1] = 0xFD; /* p-2 works fine */
+ s1len = crypto_dh_compute_secret(LOG_WARN, dh1, p1, DH1024_KEY_LEN,
+ s1, 50);
tt_int_op(50, OP_EQ, s1len);
const char P_plus_one[] =
@@ -109,31 +125,35 @@ test_crypto_dh(void *arg)
base16_decode(p1, sizeof(p1), P_plus_one, strlen(P_plus_one));
- s1len = crypto_dh_compute_secret(LOG_WARN, dh1, p1, DH_BYTES, s1, 50);
+ s1len = crypto_dh_compute_secret(LOG_WARN, dh1, p1, DH1024_KEY_LEN,
+ s1, 50);
tt_int_op(-1, OP_EQ, s1len);
- p1[DH_BYTES-1] = 0x01; /* p+2 */
- s1len = crypto_dh_compute_secret(LOG_WARN, dh1, p1, DH_BYTES, s1, 50);
+ p1[DH1024_KEY_LEN-1] = 0x01; /* p+2 */
+ s1len = crypto_dh_compute_secret(LOG_WARN, dh1, p1, DH1024_KEY_LEN,
+ s1, 50);
tt_int_op(-1, OP_EQ, s1len);
- p1[DH_BYTES-1] = 0xff; /* p+256 */
- s1len = crypto_dh_compute_secret(LOG_WARN, dh1, p1, DH_BYTES, s1, 50);
+ p1[DH1024_KEY_LEN-1] = 0xff; /* p+256 */
+ s1len = crypto_dh_compute_secret(LOG_WARN, dh1, p1, DH1024_KEY_LEN,
+ s1, 50);
tt_int_op(-1, OP_EQ, s1len);
- memset(p1, 0xff, DH_BYTES), /* 2^1024-1 */
- s1len = crypto_dh_compute_secret(LOG_WARN, dh1, p1, DH_BYTES, s1, 50);
+ memset(p1, 0xff, DH1024_KEY_LEN), /* 2^1024-1 */
+ s1len = crypto_dh_compute_secret(LOG_WARN, dh1, p1, DH1024_KEY_LEN,
+ s1, 50);
tt_int_op(-1, OP_EQ, s1len);
}
{
/* provoke an error in the openssl DH_compute_key function; make sure we
* survive. */
- tt_assert(! crypto_dh_get_public(dh1, p1, DH_BYTES));
+ tt_assert(! crypto_dh_get_public(dh1, p1, DH1024_KEY_LEN));
crypto_dh_free(dh2);
dh2= crypto_dh_new(DH_TYPE_CIRCUIT); /* no private key set */
s1len = crypto_dh_compute_secret(LOG_WARN, dh2,
- p1, DH_BYTES,
+ p1, DH1024_KEY_LEN,
s1, 50);
tt_int_op(s1len, OP_EQ, -1);
}
diff --git a/src/test/test_crypto_slow.c b/src/test/test_crypto_slow.c
index 9878a0d026..7c1dfa0a93 100644
--- a/src/test/test_crypto_slow.c
+++ b/src/test/test_crypto_slow.c
@@ -7,6 +7,8 @@
#define CRYPTO_S2K_PRIVATE
#include "or/or.h"
#include "test/test.h"
+#include "lib/crypt_ops/crypto_curve25519.h"
+#include "lib/crypt_ops/crypto_ed25519.h"
#include "lib/crypt_ops/crypto_s2k.h"
#include "lib/crypt_ops/crypto_pwbox.h"
#include "lib/crypt_ops/crypto_rand.h"
@@ -615,4 +617,3 @@ struct testcase_t slow_crypto_tests[] = {
ED25519_TEST(fuzz_donna, TT_FORK),
END_OF_TESTCASES
};
-
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index 70a8bc50ef..a86b2a9f67 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -19,10 +19,12 @@
#include "or/or.h"
#include "or/bridges.h"
+#include "or/connection.h"
#include "or/confparse.h"
#include "or/config.h"
#include "or/control.h"
#include "lib/crypt_ops/crypto_ed25519.h"
+#include "lib/crypt_ops/crypto_format.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "or/directory.h"
#include "or/dirserv.h"
@@ -45,7 +47,9 @@
#include "or/relay.h"
#include "test/log_test_helpers.h"
#include "or/voting_schedule.h"
+#include "lib/compress/compress.h"
+#include "or/addr_policy_st.h"
#include "or/authority_cert_st.h"
#include "or/document_signature_st.h"
#include "or/extrainfo_st.h"
@@ -59,6 +63,10 @@
#include "or/vote_microdesc_hash_st.h"
#include "or/vote_routerstatus_st.h"
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
#define NS_MODULE dir
static void
diff --git a/src/test/test_dns.c b/src/test/test_dns.c
index 3bcef0aa7c..1407a5c47e 100644
--- a/src/test/test_dns.c
+++ b/src/test/test_dns.c
@@ -8,6 +8,7 @@
#include "or/dns.h"
#include "or/connection.h"
+#include "or/connection_edge.h"
#include "or/router.h"
#include "or/edge_connection_st.h"
@@ -748,4 +749,3 @@ struct testcase_t dns_tests[] = {
};
#undef NS_MODULE
-
diff --git a/src/test/test_entryconn.c b/src/test/test_entryconn.c
index d6ac5e1d38..b23f12087e 100644
--- a/src/test/test_entryconn.c
+++ b/src/test/test_entryconn.c
@@ -22,6 +22,8 @@
#include "or/entry_connection_st.h"
#include "or/socks_request_st.h"
+#include "lib/encoding/confline.h"
+
static void *
entryconn_rewrite_setup(const struct testcase_t *tc)
{
@@ -833,4 +835,3 @@ struct testcase_t entryconn_tests[] = {
END_OF_TESTCASES
};
-
diff --git a/src/test/test_entrynodes.c b/src/test/test_entrynodes.c
index 4d37d0fe88..262e2fa680 100644
--- a/src/test/test_entrynodes.c
+++ b/src/test/test_entrynodes.c
@@ -37,6 +37,7 @@
#include "or/networkstatus_st.h"
#include "or/node_st.h"
#include "or/origin_circuit_st.h"
+#include "or/or_state_st.h"
#include "or/routerinfo_st.h"
#include "or/routerstatus_st.h"
@@ -44,6 +45,7 @@
#include "test/log_test_helpers.h"
#include "lib/container/bloomfilt.h"
+#include "lib/encoding/confline.h"
/* TODO:
* choose_random_entry() test with state set.
diff --git a/src/test/test_extorport.c b/src/test/test_extorport.c
index 0032ef5b78..4ddef4e43b 100644
--- a/src/test/test_extorport.c
+++ b/src/test/test_extorport.c
@@ -18,6 +18,10 @@
#include "test/test.h"
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
/* Test connection_or_remove_from_ext_or_id_map and
* connection_or_set_ext_or_identifier */
static void
@@ -610,4 +614,3 @@ struct testcase_t extorport_tests[] = {
{ "handshake", test_ext_or_handshake, TT_FORK, NULL, NULL },
END_OF_TESTCASES
};
-
diff --git a/src/test/test_helpers.c b/src/test/test_helpers.c
index ba279c790b..6d410af526 100644
--- a/src/test/test_helpers.c
+++ b/src/test/test_helpers.c
@@ -23,6 +23,7 @@
#include "or/nodelist.h"
#include "or/relay.h"
#include "or/routerlist.h"
+#include "lib/encoding/confline.h"
#include "or/cell_st.h"
#include "or/connection_st.h"
@@ -282,4 +283,3 @@ helper_parse_options(const char *conf)
}
return opt;
}
-
diff --git a/src/test/test_hs.c b/src/test/test_hs.c
index 84598d9cc4..b17e8cf21f 100644
--- a/src/test/test_hs.c
+++ b/src/test/test_hs.c
@@ -19,6 +19,7 @@
#include "or/hs_common.h"
#include "or/rendcommon.h"
#include "or/rendservice.h"
+#include "or/routerlist.h"
#include "or/routerset.h"
#include "or/circuitbuild.h"
@@ -29,6 +30,10 @@
#include "test/test_helpers.h"
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
/* mock ID digest and longname for node that's in nodelist */
#define HSDIR_EXIST_ID "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA" \
"\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
@@ -1061,4 +1066,3 @@ struct testcase_t hs_tests[] = {
END_OF_TESTCASES
};
-
diff --git a/src/test/test_hs_cache.c b/src/test/test_hs_cache.c
index ccad3062b7..c22cc46386 100644
--- a/src/test/test_hs_cache.c
+++ b/src/test/test_hs_cache.c
@@ -17,6 +17,7 @@
#include "or/networkstatus.h"
#include "or/connection.h"
#include "or/proto_http.h"
+#include "lib/crypt_ops/crypto_format.h"
#include "or/dir_connection_st.h"
#include "or/networkstatus_st.h"
@@ -561,4 +562,3 @@ struct testcase_t hs_cache[] = {
END_OF_TESTCASES
};
-
diff --git a/src/test/test_hs_client.c b/src/test/test_hs_client.c
index 58002d6292..1458c358d2 100644
--- a/src/test/test_hs_client.c
+++ b/src/test/test_hs_client.c
@@ -22,12 +22,15 @@
#include "or/config.h"
#include "lib/crypt_ops/crypto.h"
+#include "lib/crypt_ops/crypto_dh.h"
#include "or/channeltls.h"
+#include "or/directory.h"
#include "or/main.h"
#include "or/nodelist.h"
#include "or/routerset.h"
#include "or/hs_circuit.h"
+#include "or/hs_circuitmap.h"
#include "or/hs_client.h"
#include "or/hs_ident.h"
#include "or/hs_cache.h"
@@ -197,17 +200,17 @@ test_e2e_rend_circuit_setup_legacy(void *arg)
/* Make a good RENDEZVOUS1 cell body because it needs to pass key exchange
* digest verification... */
- uint8_t rend_cell_body[DH_KEY_LEN+DIGEST_LEN] = {2};
+ uint8_t rend_cell_body[DH1024_KEY_LEN+DIGEST_LEN] = {2};
{
char keys[DIGEST_LEN+CPATH_KEY_MATERIAL_LEN];
crypto_dh_t *dh_state =
or_circ->build_state->pending_final_cpath->rend_dh_handshake_state;
/* compute and overwrite digest of cell body with the right value */
retval = crypto_dh_compute_secret(LOG_PROTOCOL_WARN, dh_state,
- (char*)rend_cell_body, DH_KEY_LEN,
+ (char*)rend_cell_body, DH1024_KEY_LEN,
keys, DIGEST_LEN+CPATH_KEY_MATERIAL_LEN);
tt_int_op(retval, OP_GT, 0);
- memcpy(rend_cell_body+DH_KEY_LEN, keys, DIGEST_LEN);
+ memcpy(rend_cell_body+DH1024_KEY_LEN, keys, DIGEST_LEN);
}
/* Setup the circuit */
@@ -609,4 +612,3 @@ struct testcase_t hs_client_tests[] = {
TT_FORK, NULL, NULL },
END_OF_TESTCASES
};
-
diff --git a/src/test/test_hs_common.c b/src/test/test_hs_common.c
index 934b26450d..28c6316bd0 100644
--- a/src/test/test_hs_common.c
+++ b/src/test/test_hs_common.c
@@ -17,6 +17,7 @@
#include "test/hs_test_helpers.h"
#include "or/connection_edge.h"
+#include "lib/crypt_ops/crypto_format.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "or/hs_common.h"
#include "or/hs_client.h"
@@ -36,6 +37,7 @@
#include "or/microdesc_st.h"
#include "or/networkstatus_st.h"
#include "or/node_st.h"
+#include "or/or_state_st.h"
#include "or/routerinfo_st.h"
#include "or/routerstatus_st.h"
@@ -1832,4 +1834,3 @@ struct testcase_t hs_common_tests[] = {
END_OF_TESTCASES
};
-
diff --git a/src/test/test_hs_control.c b/src/test/test_hs_control.c
index f5beced45f..6e5e783372 100644
--- a/src/test/test_hs_control.c
+++ b/src/test/test_hs_control.c
@@ -18,6 +18,7 @@
#include "or/node_st.h"
#include "or/routerstatus_st.h"
+#include "lib/crypt_ops/crypto_format.h"
#include "test/test_helpers.h"
@@ -191,4 +192,3 @@ struct testcase_t hs_control_tests[] = {
END_OF_TESTCASES
};
-
diff --git a/src/test/test_hs_descriptor.c b/src/test/test_hs_descriptor.c
index 43d4955905..a017facd2c 100644
--- a/src/test/test_hs_descriptor.c
+++ b/src/test/test_hs_descriptor.c
@@ -9,6 +9,7 @@
#define HS_DESCRIPTOR_PRIVATE
#include "lib/crypt_ops/crypto_ed25519.h"
+#include "lib/crypt_ops/crypto_format.h"
#include "lib/crypt_ops/crypto_digest.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "trunnel/ed25519_cert.h"
@@ -896,4 +897,3 @@ struct testcase_t hs_descriptor[] = {
END_OF_TESTCASES
};
-
diff --git a/src/test/test_hs_ntor.c b/src/test/test_hs_ntor.c
index 51373af645..c524409003 100644
--- a/src/test/test_hs_ntor.c
+++ b/src/test/test_hs_ntor.c
@@ -9,6 +9,8 @@
#include "test/test.h"
#include "test/test_helpers.h"
#include "test/log_test_helpers.h"
+#include "lib/crypt_ops/crypto_curve25519.h"
+#include "lib/crypt_ops/crypto_ed25519.h"
#include "or/hs_ntor.h"
@@ -111,4 +113,3 @@ struct testcase_t hs_ntor_tests[] = {
END_OF_TESTCASES
};
-
diff --git a/src/test/test_hs_ntor_cl.c b/src/test/test_hs_ntor_cl.c
index 5475f3b38c..6bf11560b4 100644
--- a/src/test/test_hs_ntor_cl.c
+++ b/src/test/test_hs_ntor_cl.c
@@ -17,6 +17,8 @@
#include "common/util.h"
#include "lib/crypt_ops/crypto.h"
#include "lib/crypt_ops/crypto_curve25519.h"
+#include "lib/crypt_ops/crypto_ed25519.h"
+#include "lib/crypt_ops/crypto_format.h"
#include "or/hs_ntor.h"
#include "or/onion_ntor.h"
@@ -251,4 +253,3 @@ main(int argc, char **argv)
return 1;
}
}
-
diff --git a/src/test/test_hs_service.c b/src/test/test_hs_service.c
index 684ac98f42..e81a5eff4f 100644
--- a/src/test/test_hs_service.c
+++ b/src/test/test_hs_service.c
@@ -45,6 +45,7 @@
#include "or/hs_intropoint.h"
#include "or/hs_ntor.h"
#include "or/hs_circuit.h"
+#include "or/hs_circuitmap.h"
#include "or/hs_service.h"
#include "or/hs_client.h"
#include "or/main.h"
@@ -58,6 +59,7 @@
#include "or/networkstatus_st.h"
#include "or/node_st.h"
#include "or/origin_circuit_st.h"
+#include "or/or_state_st.h"
#include "or/routerinfo_st.h"
/* Trunnel */
@@ -1634,4 +1636,3 @@ struct testcase_t hs_service_tests[] = {
END_OF_TESTCASES
};
-
diff --git a/src/test/test_link_handshake.c b/src/test/test_link_handshake.c
index ffb6c47b1e..515fdc50a7 100644
--- a/src/test/test_link_handshake.c
+++ b/src/test/test_link_handshake.c
@@ -24,6 +24,8 @@
#include "or/or_handshake_state_st.h"
#include "or/var_cell_st.h"
+#include "lib/tls/tortls.h"
+
#include "test/test.h"
#include "test/log_test_helpers.h"
diff --git a/src/test/test_logging.c b/src/test/test_logging.c
index d979411469..48cdf2e6bc 100644
--- a/src/test/test_logging.c
+++ b/src/test/test_logging.c
@@ -11,6 +11,10 @@
#include "test/test.h"
#include "lib/process/subprocess.h"
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
static void
dummy_cb_fn(int severity, uint32_t domain, const char *msg)
{
diff --git a/src/test/test_microdesc.c b/src/test/test_microdesc.c
index 1b680c02c5..2038f54984 100644
--- a/src/test/test_microdesc.c
+++ b/src/test/test_microdesc.c
@@ -20,6 +20,10 @@
#include "test/test.h"
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
#ifdef _WIN32
/* For mkdir() */
#include <direct.h>
@@ -815,4 +819,3 @@ struct testcase_t microdesc_tests[] = {
{ "corrupt_desc", test_md_corrupt_desc, TT_FORK, NULL, NULL },
END_OF_TESTCASES
};
-
diff --git a/src/test/test_oos.c b/src/test/test_oos.c
index 6ecb1a0786..f101390d67 100644
--- a/src/test/test_oos.c
+++ b/src/test/test_oos.c
@@ -9,6 +9,7 @@
#include "or/config.h"
#include "or/connection.h"
#include "or/connection_or.h"
+#include "or/directory.h"
#include "or/main.h"
#include "test/test.h"
@@ -456,4 +457,3 @@ struct testcase_t oos_tests[] = {
{ "pick_oos_victims", test_oos_pick_oos_victims, TT_FORK, NULL, NULL },
END_OF_TESTCASES
};
-
diff --git a/src/test/test_options.c b/src/test/test_options.c
index ec574c548e..f2aaf30c23 100644
--- a/src/test/test_options.c
+++ b/src/test/test_options.c
@@ -18,6 +18,7 @@
#include "lib/sandbox/sandbox.h"
#include "lib/memarea/memarea.h"
#include "lib/osinfo/uname.h"
+#include "lib/encoding/confline.h"
#include "or/policies.h"
#include "test/test_helpers.h"
diff --git a/src/test/test_policy.c b/src/test/test_policy.c
index 2c29bbb16a..a6906af41f 100644
--- a/src/test/test_policy.c
+++ b/src/test/test_policy.c
@@ -8,8 +8,10 @@
#include "or/routerparse.h"
#define POLICIES_PRIVATE
#include "or/policies.h"
+#include "lib/encoding/confline.h"
#include "test/test.h"
+#include "or/addr_policy_st.h"
#include "or/node_st.h"
#include "or/port_cfg_st.h"
#include "or/routerinfo_st.h"
@@ -2450,4 +2452,3 @@ struct testcase_t policy_tests[] = {
test_policies_fascist_firewall_choose_address, 0, NULL, NULL },
END_OF_TESTCASES
};
-
diff --git a/src/test/test_pt.c b/src/test/test_pt.c
index c2c4e19897..e685ab50de 100644
--- a/src/test/test_pt.c
+++ b/src/test/test_pt.c
@@ -19,6 +19,9 @@
#include "or/statefile.h"
#include "test/test.h"
#include "lib/process/subprocess.h"
+#include "lib/encoding/confline.h"
+
+#include "or/or_state_st.h"
static void
reset_mp(managed_proxy_t *mp)
diff --git a/src/test/test_relay.c b/src/test/test_relay.c
index 777153d11b..fe5795d11d 100644
--- a/src/test/test_relay.c
+++ b/src/test/test_relay.c
@@ -4,6 +4,7 @@
#include "or/or.h"
#define CIRCUITBUILD_PRIVATE
#include "or/circuitbuild.h"
+#include "or/circuitlist.h"
#define RELAY_PRIVATE
#include "or/relay.h"
/* For init/free stuff */
@@ -130,4 +131,3 @@ struct testcase_t relay_tests[] = {
TT_FORK, NULL, NULL },
END_OF_TESTCASES
};
-
diff --git a/src/test/test_routerkeys.c b/src/test/test_routerkeys.c
index 948cf0d60c..8c2be30a8f 100644
--- a/src/test/test_routerkeys.c
+++ b/src/test/test_routerkeys.c
@@ -11,6 +11,7 @@
#include "or/routerkeys.h"
#include "common/util.h"
#include "lib/crypt_ops/crypto.h"
+#include "lib/crypt_ops/crypto_format.h"
#include "or/torcert.h"
#include "test/test.h"
@@ -19,6 +20,13 @@
#include <direct.h>
#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
static void
test_routerkeys_write_fingerprint(void *arg)
{
@@ -695,4 +703,3 @@ struct testcase_t routerkeys_tests[] = {
TEST(rsa_ed_crosscert, 0),
END_OF_TESTCASES
};
-
diff --git a/src/test/test_routerlist.c b/src/test/test_routerlist.c
index 5da42c1339..b25a0be9a4 100644
--- a/src/test/test_routerlist.c
+++ b/src/test/test_routerlist.c
@@ -37,8 +37,12 @@
#include "or/dir_connection_st.h"
#include "or/networkstatus_st.h"
#include "or/node_st.h"
+#include "or/or_state_st.h"
#include "or/routerstatus_st.h"
+#include "lib/encoding/confline.h"
+#include "lib/container/buffers.h"
+
#include "test/test.h"
#include "test/test_dir_common.h"
#include "test/log_test_helpers.h"
@@ -782,4 +786,3 @@ struct testcase_t routerlist_tests[] = {
{ "warn_early_consensus", test_warn_early_consensus, 0, NULL, NULL },
END_OF_TESTCASES
};
-
diff --git a/src/test/test_routerset.c b/src/test/test_routerset.c
index e64c24e89e..ea8b43498e 100644
--- a/src/test/test_routerset.c
+++ b/src/test/test_routerset.c
@@ -10,6 +10,7 @@
#include "or/policies.h"
#include "or/nodelist.h"
+#include "or/addr_policy_st.h"
#include "or/extend_info_st.h"
#include "or/node_st.h"
#include "or/routerinfo_st.h"
@@ -2227,4 +2228,3 @@ struct testcase_t routerset_tests[] = {
TEST_CASE(routerset_free),
END_OF_TESTCASES
};
-
diff --git a/src/test/test_shared_random.c b/src/test/test_shared_random.c
index 91ae20bff8..1b4fdc8992 100644
--- a/src/test/test_shared_random.c
+++ b/src/test/test_shared_random.c
@@ -24,6 +24,11 @@
#include "or/dir_server_st.h"
#include "or/networkstatus_st.h"
+#include "or/or_state_st.h"
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
static authority_cert_t *mock_cert;
@@ -1393,4 +1398,3 @@ struct testcase_t sr_tests[] = {
NULL, NULL },
END_OF_TESTCASES
};
-
diff --git a/src/test/test_socks.c b/src/test/test_socks.c
index 3e4528af27..046ed35978 100644
--- a/src/test/test_socks.c
+++ b/src/test/test_socks.c
@@ -6,6 +6,7 @@
#include "or/or.h"
#include "lib/container/buffers.h"
#include "or/config.h"
+#include "or/connection.h"
#include "or/proto_socks.h"
#include "test/test.h"
#include "test/log_test_helpers.h"
diff --git a/src/test/test_status.c b/src/test/test_status.c
index 25577cdafa..c92ba48e2f 100644
--- a/src/test/test_status.c
+++ b/src/test/test_status.c
@@ -24,8 +24,10 @@
#include "or/main.h"
#include "or/nodelist.h"
#include "or/statefile.h"
+#include "lib/tls/tortls.h"
#include "or/origin_circuit_st.h"
+#include "or/or_state_st.h"
#include "or/routerinfo_st.h"
#include "test/test.h"
@@ -1097,4 +1099,3 @@ struct testcase_t status_tests[] = {
TEST_CASE_ASPECT(log_heartbeat, tls_write_overhead),
END_OF_TESTCASES
};
-
diff --git a/src/test/test_storagedir.c b/src/test/test_storagedir.c
index d07d35e096..efb6a0027a 100644
--- a/src/test/test_storagedir.c
+++ b/src/test/test_storagedir.c
@@ -4,6 +4,7 @@
#include "or/or.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "lib/fs/storagedir.h"
+#include "lib/encoding/confline.h"
#include "test/test.h"
#ifdef HAVE_UTIME_H
@@ -373,4 +374,3 @@ struct testcase_t storagedir_tests[] = {
ENT(read_labeled),
END_OF_TESTCASES
};
-
diff --git a/src/test/test_switch_id.c b/src/test/test_switch_id.c
index 11fe53b7c5..95801822f9 100644
--- a/src/test/test_switch_id.c
+++ b/src/test/test_switch_id.c
@@ -7,6 +7,9 @@
#ifdef HAVE_SYS_CAPABILITY_H
#include <sys/capability.h>
#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
#define TEST_BUILT_WITH_CAPS 0
#define TEST_HAVE_CAPS 1
diff --git a/src/test/test_tortls.c b/src/test/test_tortls.c
index b456734684..9ae9d4dfbd 100644
--- a/src/test/test_tortls.c
+++ b/src/test/test_tortls.c
@@ -34,6 +34,7 @@ ENABLE_GCC_WARNING(redundant-decls)
#include "lib/log/torlog.h"
#include "or/config.h"
#include "lib/tls/tortls.h"
+#include "or/or_state_st.h"
#include "test/test.h"
#include "test/log_test_helpers.h"
diff --git a/src/test/test_util.c b/src/test/test_util.c
index c2c33afea4..60cd7ad66a 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -17,11 +17,13 @@
#include "or/config.h"
#include "or/control.h"
#include "or/transports.h"
+#include "lib/crypt_ops/crypto_format.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "test/test.h"
#include "lib/memarea/memarea.h"
#include "lib/process/waitpid.h"
#include "test/log_test_helpers.h"
+#include "lib/compress/compress.h"
#include "lib/compress/compress_zstd.h"
#include "lib/encoding/keyval.h"
#include "lib/fdio/fdio.h"
@@ -35,6 +37,7 @@
#include "lib/math/laplace.h"
#include "lib/meminfo/meminfo.h"
#include "lib/time/tvdiff.h"
+#include "lib/encoding/confline.h"
#ifdef HAVE_PWD_H
#include <pwd.h>
@@ -45,6 +48,16 @@
#ifdef HAVE_UTIME_H
#include <utime.h>
#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
#ifdef _WIN32
#include <tchar.h>
#endif
diff --git a/src/test/testing_common.c b/src/test/testing_common.c
index 3baeb98031..ace564d0fe 100644
--- a/src/test/testing_common.c
+++ b/src/test/testing_common.c
@@ -13,17 +13,27 @@
#include "or/or.h"
#include "or/control.h"
#include "or/config.h"
+#include "lib/crypt_ops/crypto_dh.h"
+#include "lib/crypt_ops/crypto_ed25519.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "or/rephist.h"
#include "lib/err/backtrace.h"
#include "test/test.h"
#include "or/channelpadding.h"
#include "or/main.h"
+#include "lib/compress/compress.h"
+#include "common/compat_libevent.h"
#include <stdio.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
#ifdef _WIN32
/* For mkdir() */