summaryrefslogtreecommitdiff
path: root/src/feature/rend/rendcommon.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2019-05-28 09:44:06 -0400
committerDavid Goulet <dgoulet@torproject.org>2019-05-29 09:40:13 -0400
commit3789f22bcbfbc6de415a838e4c4bfb2555c7d6c3 (patch)
tree823e4db5b38cec12156f5d3a4dfb9df725eeba64 /src/feature/rend/rendcommon.c
parente5deb2bbc73d8830ae6c479a4532e72112f5484a (diff)
downloadtor-3789f22bcbfbc6de415a838e4c4bfb2555c7d6c3.tar.gz
tor-3789f22bcbfbc6de415a838e4c4bfb2555c7d6c3.zip
hs: Implement a helper to repurpose a circuit
When we repurpose a hidden service circuit, we need to clean up from the HS circuit map and any HS related data structured contained in the circuit. This commit adds an helper function that does it when repurposing a hidden service circuit. Fixes #29034 Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/feature/rend/rendcommon.c')
-rw-r--r--src/feature/rend/rendcommon.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/feature/rend/rendcommon.c b/src/feature/rend/rendcommon.c
index de48af795f..b10a5863b4 100644
--- a/src/feature/rend/rendcommon.c
+++ b/src/feature/rend/rendcommon.c
@@ -1045,3 +1045,14 @@ rend_circuit_pk_digest_eq(const origin_circuit_t *ocirc,
match:
return 1;
}
+
+/* Cleanup the given circuit of all HS v2 data structure. */
+void
+rend_circ_cleanup(origin_circuit_t *circ)
+{
+ tor_assert(circ);
+
+ /* Both fields are set to NULL with these. */
+ crypto_pk_free(circ->intro_key);
+ rend_data_free(circ->rend_data);
+}