summaryrefslogtreecommitdiff
path: root/src/feature/rend
diff options
context:
space:
mode:
Diffstat (limited to 'src/feature/rend')
-rw-r--r--src/feature/rend/rendcommon.c11
-rw-r--r--src/feature/rend/rendcommon.h2
2 files changed, 13 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);
+}
diff --git a/src/feature/rend/rendcommon.h b/src/feature/rend/rendcommon.h
index f136863c7a..c9a04846d7 100644
--- a/src/feature/rend/rendcommon.h
+++ b/src/feature/rend/rendcommon.h
@@ -71,6 +71,8 @@ int rend_non_anonymous_mode_enabled(const or_options_t *options);
void assert_circ_anonymity_ok(const origin_circuit_t *circ,
const or_options_t *options);
+void rend_circ_cleanup(origin_circuit_t *circ);
+
#ifdef RENDCOMMON_PRIVATE
STATIC int