diff options
author | George Kadianakis <desnacked@riseup.net> | 2019-04-26 14:26:22 +0300 |
---|---|---|
committer | George Kadianakis <desnacked@riseup.net> | 2019-05-03 18:15:26 +0300 |
commit | 4060b7623d3845a4d4ecdbf8f9c219e0148e1380 (patch) | |
tree | e7debcebc3f604ecdd7d010bcaa7d59bca218c6e /src/test/test_circuitpadding.c | |
parent | 2e9e3e7d4198ff75e6bd12bc7a38c0f288fbe381 (diff) | |
download | tor-4060b7623d3845a4d4ecdbf8f9c219e0148e1380.tar.gz tor-4060b7623d3845a4d4ecdbf8f9c219e0148e1380.zip |
Revert "Hiding crypt_path_t: Create a constructor for crypt_path_t."
This reverts commit ab8b80944967ee5a6a0c45dbf61839cf257bfe44.
Diffstat (limited to 'src/test/test_circuitpadding.c')
-rw-r--r-- | src/test/test_circuitpadding.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/test/test_circuitpadding.c b/src/test/test_circuitpadding.c index e33e56af3f..5550488d0f 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,15 +144,13 @@ 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); - tmp_cpath = crypt_path_new(); - if (cpath_init_circuit_crypto(tmp_cpath, whatevs_key, + memset(&tmp_cpath, 0, sizeof(tmp_cpath)); + if (cpath_init_circuit_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; - tor_free(tmp_cpath->private); - tor_free(tmp_cpath); + orcirc->crypto = tmp_cpath.private->crypto; return orcirc; } @@ -1620,9 +1618,10 @@ 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 = crypt_path_new(); + crypt_path_t *hop = tor_malloc_zero(sizeof(crypt_path_t)); cpath_extend_linked_list(&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. |