diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test_circuitpadding.c | 13 | ||||
-rw-r--r-- | src/test/test_hs_client.c | 5 | ||||
-rw-r--r-- | src/test/test_hs_service.c | 4 | ||||
-rw-r--r-- | src/test/test_relaycell.c | 4 | ||||
-rw-r--r-- | src/test/test_relaycrypt.c | 2 |
5 files changed, 14 insertions, 14 deletions
diff --git a/src/test/test_circuitpadding.c b/src/test/test_circuitpadding.c index 8a2667e802..6fa790c40d 100644 --- a/src/test/test_circuitpadding.c +++ b/src/test/test_circuitpadding.c @@ -115,7 +115,7 @@ new_fake_orcirc(channel_t *nchan, channel_t *pchan) { or_circuit_t *orcirc = NULL; circuit_t *circ = NULL; - crypt_path_t tmp_cpath; + crypt_path_t *tmp_cpath; char whatevs_key[CPATH_KEY_MATERIAL_LEN]; orcirc = tor_malloc_zero(sizeof(*orcirc)); @@ -144,13 +144,15 @@ new_fake_orcirc(channel_t *nchan, channel_t *pchan) circuit_set_p_circid_chan(orcirc, orcirc->p_circ_id, pchan); circuit_set_n_circid_chan(circ, circ->n_circ_id, nchan); - memset(&tmp_cpath, 0, sizeof(tmp_cpath)); - if (circuit_init_cpath_crypto(&tmp_cpath, whatevs_key, + tmp_cpath = crypt_path_new(); + if (circuit_init_cpath_crypto(tmp_cpath, whatevs_key, sizeof(whatevs_key), 0, 0)<0) { log_warn(LD_BUG,"Circuit initialization failed"); return NULL; } - orcirc->crypto = tmp_cpath.private->crypto; + orcirc->crypto = tmp_cpath->private->crypto; + tor_free(tmp_cpath->private); + tor_free(tmp_cpath); return orcirc; } @@ -1618,10 +1620,9 @@ simulate_single_hop_extend(circuit_t *client, circuit_t *mid_relay, circpad_cell_event_nonpadding_received((circuit_t*)client); // Add a hop to cpath - crypt_path_t *hop = tor_malloc_zero(sizeof(crypt_path_t)); + crypt_path_t *hop = crypt_path_new(); onion_append_to_cpath(&TO_ORIGIN_CIRCUIT(client)->cpath, hop); - hop->magic = CRYPT_PATH_MAGIC; hop->state = CPATH_STATE_OPEN; // add an extend info to indicate if this node supports padding or not. diff --git a/src/test/test_hs_client.c b/src/test/test_hs_client.c index 607be339a9..9e1d73a855 100644 --- a/src/test/test_hs_client.c +++ b/src/test/test_hs_client.c @@ -39,6 +39,7 @@ #include "feature/hs/hs_cache.h" #include "core/or/circuitlist.h" #include "core/or/circuitbuild.h" +#include "core/or/crypt_path.h" #include "core/mainloop/connection.h" #include "core/or/connection_edge.h" #include "feature/nodelist/networkstatus.h" @@ -145,9 +146,7 @@ helper_get_circ_and_stream_for_test(origin_circuit_t **circ_out, if (is_legacy) { /* Legacy: Setup rend data and final cpath */ - or_circ->build_state->pending_final_cpath = - tor_malloc_zero(sizeof(crypt_path_t)); - or_circ->build_state->pending_final_cpath->magic = CRYPT_PATH_MAGIC; + or_circ->build_state->pending_final_cpath = crypt_path_new(); or_circ->build_state->pending_final_cpath->rend_dh_handshake_state = crypto_dh_new(DH_TYPE_REND); tt_assert( diff --git a/src/test/test_hs_service.c b/src/test/test_hs_service.c index bfa66f551a..357db89040 100644 --- a/src/test/test_hs_service.c +++ b/src/test/test_hs_service.c @@ -38,6 +38,7 @@ #include "core/or/circuitbuild.h" #include "core/or/circuitlist.h" #include "core/or/circuituse.h" +#include "core/or/crypt_path.h" #include "core/or/connection_edge.h" #include "core/or/edge_connection_st.h" #include "core/or/relay.h" @@ -218,8 +219,7 @@ helper_create_origin_circuit(int purpose, int flags) circ = origin_circuit_init(purpose, flags); tor_assert(circ); - circ->cpath = tor_malloc_zero(sizeof(crypt_path_t)); - circ->cpath->magic = CRYPT_PATH_MAGIC; + circ->cpath = crypt_path_new(); circ->cpath->state = CPATH_STATE_OPEN; circ->cpath->package_window = circuit_initial_package_window(); circ->cpath->deliver_window = CIRCWINDOW_START; diff --git a/src/test/test_relaycell.c b/src/test/test_relaycell.c index 0623583511..b48c7ca8ac 100644 --- a/src/test/test_relaycell.c +++ b/src/test/test_relaycell.c @@ -16,6 +16,7 @@ #include "lib/crypt_ops/crypto_rand.h" #include "core/or/circuitbuild.h" #include "core/or/circuitlist.h" +#include "core/or/crypt_path.h" #include "core/or/connection_edge.h" #include "core/or/relay.h" #include "test/test.h" @@ -90,8 +91,7 @@ helper_create_origin_circuit(int purpose, int flags) circ = origin_circuit_init(purpose, flags); tor_assert(circ); - circ->cpath = tor_malloc_zero(sizeof(crypt_path_t)); - circ->cpath->magic = CRYPT_PATH_MAGIC; + circ->cpath = crypt_path_new(); circ->cpath->state = CPATH_STATE_OPEN; circ->cpath->package_window = circuit_initial_package_window(); circ->cpath->deliver_window = CIRCWINDOW_START; diff --git a/src/test/test_relaycrypt.c b/src/test/test_relaycrypt.c index b94ee07abc..1fe5df96ed 100644 --- a/src/test/test_relaycrypt.c +++ b/src/test/test_relaycrypt.c @@ -50,7 +50,7 @@ testing_circuitset_setup(const struct testcase_t *testcase) cs->origin_circ = origin_circuit_new(); cs->origin_circ->base_.purpose = CIRCUIT_PURPOSE_C_GENERAL; for (i=0; i<3; ++i) { - crypt_path_t *hop = tor_malloc_zero(sizeof(*hop)); + crypt_path_t *hop = crypt_path_new(); relay_crypto_init(&hop->private->crypto, KEY_MATERIAL[i], sizeof(KEY_MATERIAL[i]), 0, 0); hop->state = CPATH_STATE_OPEN; |