]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Hiding crypt_path_t: Move the free func in crypt_path.c.
authorGeorge Kadianakis <desnacked@riseup.net>
Mon, 8 Apr 2019 12:37:02 +0000 (15:37 +0300)
committerGeorge Kadianakis <desnacked@riseup.net>
Fri, 3 May 2019 15:15:11 +0000 (18:15 +0300)
Again everything is moved, apart from a free line using ->private.

src/core/or/circuitlist.c
src/core/or/crypt_path.c
src/core/or/crypt_path.h

index ee9e89f380f15d8437999dde85db3a8b30c2d0a5..83c651ff172eafe55b75c4cc3c94ab586efad45f 100644 (file)
@@ -133,7 +133,6 @@ static smartlist_t *circuits_pending_other_guards = NULL;
  * circuit_mark_for_close and which are waiting for circuit_about_to_free. */
 static smartlist_t *circuits_pending_close = NULL;
 
-static void circuit_free_cpath_node(crypt_path_t *victim);
 static void cpath_ref_decref(crypt_path_reference_t *cpath_ref);
 static void circuit_about_to_free_atexit(circuit_t *circ);
 static void circuit_about_to_free(circuit_t *circ);
@@ -1333,22 +1332,6 @@ circuit_free_all(void)
   HT_CLEAR(chan_circid_map, &chan_circid_map);
 }
 
-/** Deallocate space associated with the cpath node <b>victim</b>. */
-static void
-circuit_free_cpath_node(crypt_path_t *victim)
-{
-  if (!victim)
-    return;
-
-  relay_crypto_clear(&victim->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);
-}
-
 /** Release a crypt_path_reference_t*, which may be NULL. */
 static void
 cpath_ref_decref(crypt_path_reference_t *cpath_ref)
index 77f129eff32e5f63a710819c1af2dea543939b84..54f5623d328f3af1cdf1b060c0e7ea143c87f2ec 100644 (file)
 #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 *******************************/
 
index a7ebe604f5fed5a1b998817752d953120535accc..e8455c63269d3cd7ad5ff61b6ce98dc6b7678f05 100644 (file)
@@ -16,6 +16,9 @@ int circuit_init_cpath_crypto(crypt_path_t *cpath,
                               const char *key_data, size_t key_data_len,
                               int reverse, int is_hs_v3);
 
+void
+circuit_free_cpath_node(crypt_path_t *victim);
+
 /* rename */
 void onion_append_to_cpath(crypt_path_t **head_ptr, crypt_path_t *new_hop);