aboutsummaryrefslogtreecommitdiff
path: root/src/core/or/crypt_path.c
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2019-04-08 15:37:02 +0300
committerGeorge Kadianakis <desnacked@riseup.net>2019-05-03 18:15:11 +0300
commit4bd0c4852aad724fd9639f5250c5893341cd5935 (patch)
tree2b3b990fb1717999dcd382aa8d8d5b5b47c70b69 /src/core/or/crypt_path.c
parent5f96b7abccc8e393c7f5e370ab3bf838dc3f8d4f (diff)
downloadtor-4bd0c4852aad724fd9639f5250c5893341cd5935.tar.gz
tor-4bd0c4852aad724fd9639f5250c5893341cd5935.zip
Hiding crypt_path_t: Move the free func in crypt_path.c.
Again everything is moved, apart from a free line using ->private.
Diffstat (limited to 'src/core/or/crypt_path.c')
-rw-r--r--src/core/or/crypt_path.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/core/or/crypt_path.c b/src/core/or/crypt_path.c
index 77f129eff3..54f5623d32 100644
--- a/src/core/or/crypt_path.c
+++ b/src/core/or/crypt_path.c
@@ -16,9 +16,13 @@
#include "core/or/crypt_path.h"
#include "core/crypto/relay_crypto.h"
+#include "core/crypto/onion_crypto.h"
#include "core/or/circuitbuild.h"
#include "core/or/circuitlist.h"
+#include "lib/crypt_ops/crypto_dh.h"
+#include "lib/crypt_ops/crypto_util.h"
+
#include "core/or/crypt_path_st.h"
#include "core/or/cell_st.h"
@@ -143,6 +147,21 @@ circuit_init_cpath_crypto(crypt_path_t *cpath,
}
+/** Deallocate space associated with the cpath node <b>victim</b>. */
+void
+circuit_free_cpath_node(crypt_path_t *victim)
+{
+ if (!victim)
+ return;
+
+ relay_crypto_clear(&victim->private->crypto);
+ onion_handshake_state_release(&victim->handshake_state);
+ crypto_dh_free(victim->rend_dh_handshake_state);
+ extend_info_free(victim->extend_info);
+
+ memwipe(victim, 0xBB, sizeof(crypt_path_t)); /* poison memory */
+ tor_free(victim);
+}
/********************** cpath crypto API *******************************/