diff options
author | Nick Mathewson <nickm@torproject.org> | 2020-02-13 09:12:48 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2020-02-13 09:12:48 -0500 |
commit | fd1686c7d8df8d8159fcaab1c59dfabe154afd88 (patch) | |
tree | 35aa41c8bdd56f228ee3b7c00bf9926935fba87a /src/core | |
parent | ff52205362f5d60c209f298a3e3679bc65bdf539 (diff) | |
parent | fff1054d17c8e869c38d4ca1c68ed74a7e82e393 (diff) | |
download | tor-fd1686c7d8df8d8159fcaab1c59dfabe154afd88.tar.gz tor-fd1686c7d8df8d8159fcaab1c59dfabe154afd88.zip |
Merge branch 'ticket33290_v2_041' into ticket33290_v2_042
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/or/circuitmux.c | 8 | ||||
-rw-r--r-- | src/core/or/circuitmux_ewma.c | 12 |
2 files changed, 15 insertions, 5 deletions
diff --git a/src/core/or/circuitmux.c b/src/core/or/circuitmux.c index b2628bec3f..72f6ba662b 100644 --- a/src/core/or/circuitmux.c +++ b/src/core/or/circuitmux.c @@ -79,6 +79,8 @@ #include "core/or/destroy_cell_queue_st.h" #include "core/or/or_circuit_st.h" +#include "lib/crypt_ops/crypto_util.h" + /* * Private typedefs for circuitmux.c */ @@ -973,7 +975,10 @@ circuitmux_detach_circuit,(circuitmux_t *cmux, circuit_t *circ)) /* Now remove it from the map */ HT_REMOVE(chanid_circid_muxinfo_map, cmux->chanid_circid_map, hashent); - /* Free the hash entry */ + /* Wipe and free the hash entry */ + // This isn't sensitive, but we want to be sure to know if we're accessing + // this accidentally. + memwipe(hashent, 0xef, sizeof(hashent)); tor_free(hashent); } } @@ -1334,4 +1339,3 @@ circuitmux_compare_muxes, (circuitmux_t *cmux_1, circuitmux_t *cmux_2)) return 0; } } - diff --git a/src/core/or/circuitmux_ewma.c b/src/core/or/circuitmux_ewma.c index 3f83c3fd5a..07f83af0f1 100644 --- a/src/core/or/circuitmux_ewma.c +++ b/src/core/or/circuitmux_ewma.c @@ -38,6 +38,7 @@ #include "core/or/circuitmux.h" #include "core/or/circuitmux_ewma.h" #include "lib/crypt_ops/crypto_rand.h" +#include "lib/crypt_ops/crypto_util.h" #include "feature/nodelist/networkstatus.h" #include "app/config/or_options_st.h" @@ -147,7 +148,9 @@ TO_EWMA_POL_DATA(circuitmux_policy_data_t *pol) { if (!pol) return NULL; else { - tor_assert(pol->magic == EWMA_POL_DATA_MAGIC); + tor_assertf(pol->magic == EWMA_POL_DATA_MAGIC, + "Mismatch: %"PRIu32" != %"PRIu32, + pol->magic, EWMA_POL_DATA_MAGIC); return DOWNCAST(ewma_policy_data_t, pol); } } @@ -162,7 +165,9 @@ TO_EWMA_POL_CIRC_DATA(circuitmux_policy_circ_data_t *pol) { if (!pol) return NULL; else { - tor_assert(pol->magic == EWMA_POL_CIRC_DATA_MAGIC); + tor_assertf(pol->magic == EWMA_POL_CIRC_DATA_MAGIC, + "Mismatch: %"PRIu32" != %"PRIu32, + pol->magic, EWMA_POL_CIRC_DATA_MAGIC); return DOWNCAST(ewma_policy_circ_data_t, pol); } } @@ -295,6 +300,7 @@ ewma_free_cmux_data(circuitmux_t *cmux, pol = TO_EWMA_POL_DATA(pol_data); smartlist_free(pol->active_circuit_pqueue); + memwipe(pol, 0xda, sizeof(ewma_policy_data_t)); tor_free(pol); } @@ -361,7 +367,7 @@ ewma_free_circ_data(circuitmux_t *cmux, if (!pol_circ_data) return; cdata = TO_EWMA_POL_CIRC_DATA(pol_circ_data); - + memwipe(cdata, 0xdc, sizeof(ewma_policy_circ_data_t)); tor_free(cdata); } |