aboutsummaryrefslogtreecommitdiff
path: root/src/test/hs_test_helpers.h
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2017-04-07 10:28:57 -0400
committerDavid Goulet <dgoulet@torproject.org>2017-05-09 10:30:37 -0400
commit0cc18ef64cc184d3af0b87378be10f2a8a163fc6 (patch)
tree0f113ac80466973184cefce9c00ddb1897c0c894 /src/test/hs_test_helpers.h
parent4273a39ac2bf981056031d127506ba8a8ce0efc7 (diff)
downloadtor-0cc18ef64cc184d3af0b87378be10f2a8a163fc6.tar.gz
tor-0cc18ef64cc184d3af0b87378be10f2a8a163fc6.zip
test: Move duplicate HS test code and unify it
Create the hs_test_helpers.{c|h} files that contains helper functions to create introduction point, descriptor and compare descriptor. Used by both the hs cache and hs descriptor tests. Unify them to avoid code duplication. Also, this commit fixes the usage of the signing key that was wrongly used when creating a cross signed certificate. Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/test/hs_test_helpers.h')
-rw-r--r--src/test/hs_test_helpers.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/hs_test_helpers.h b/src/test/hs_test_helpers.h
new file mode 100644
index 0000000000..a7fedab136
--- /dev/null
+++ b/src/test/hs_test_helpers.h
@@ -0,0 +1,22 @@
+/* Copyright (c) 2017, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#ifndef TOR_HS_TEST_HELPERS_H
+#define TOR_HS_TEST_HELPERS_H
+
+#include "ed25519_cert.h"
+#include "hs_descriptor.h"
+
+/* Set of functions to help build and test descriptors. */
+hs_desc_intro_point_t *hs_helper_build_intro_point(
+ const ed25519_keypair_t *signing_kp, time_t now,
+ const char *addr, int legacy);
+hs_descriptor_t *hs_helper_build_hs_desc_no_ip(
+ const ed25519_keypair_t *signing_kp);
+hs_descriptor_t *hs_helper_build_hs_desc_with_ip(
+ const ed25519_keypair_t *signing_kp);
+void hs_helper_desc_equal(const hs_descriptor_t *desc1,
+ const hs_descriptor_t *desc2);
+
+#endif /* TOR_HS_TEST_HELPERS_H */
+