summaryrefslogtreecommitdiff
path: root/src/or/shared_random_state.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2016-05-03 11:42:50 -0400
committerDavid Goulet <dgoulet@torproject.org>2016-07-01 14:01:41 -0400
commit39be8af7092a4ee004f4c53fa1e55678d9d67f1f (patch)
tree70cc2057b42c253fe4c93f71b7db2f1e52d8d0d0 /src/or/shared_random_state.c
parent727d419a9d0845e7820364e8a8f0928043c67111 (diff)
downloadtor-39be8af7092a4ee004f4c53fa1e55678d9d67f1f.tar.gz
tor-39be8af7092a4ee004f4c53fa1e55678d9d67f1f.zip
prop250: Add unit tests
Signed-off-by: David Goulet <dgoulet@torproject.org> Signed-off-by: George Kadianakis <desnacked@riseup.net>
Diffstat (limited to 'src/or/shared_random_state.c')
-rw-r--r--src/or/shared_random_state.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/or/shared_random_state.c b/src/or/shared_random_state.c
index 6dd10d612e..7c75431040 100644
--- a/src/or/shared_random_state.c
+++ b/src/or/shared_random_state.c
@@ -1291,3 +1291,22 @@ sr_state_init(int save_to_disk, int read_from_disk)
error:
return -1;
}
+
+#ifdef TOR_UNIT_TESTS
+
+/* Set the current phase of the protocol. Used only by unit tests. */
+void
+set_sr_phase(sr_phase_t phase)
+{
+ tor_assert(sr_state);
+ sr_state->phase = phase;
+}
+
+/* Get the SR state. Used only by unit tests */
+sr_state_t *
+get_sr_state(void)
+{
+ return sr_state;
+}
+
+#endif /* TOR_UNIT_TESTS */