aboutsummaryrefslogtreecommitdiff
path: root/src/test/bench.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-03-17 10:59:15 -0400
committerNick Mathewson <nickm@torproject.org>2018-03-17 10:59:15 -0400
commit5ecad6c95d5e8e9a0abe5c86b5f8f066cc7a8f1c (patch)
treef632c75c417674b2a307ffd8627286973cbe2b50 /src/test/bench.c
parent80955be6ecae7095d267981b39d10237aabc38a6 (diff)
downloadtor-5ecad6c95d5e8e9a0abe5c86b5f8f066cc7a8f1c.tar.gz
tor-5ecad6c95d5e8e9a0abe5c86b5f8f066cc7a8f1c.zip
Extract the cryptographic parts of crypt_path_t and or_circuit_t.
Additionally, this change extracts the functions that created and freed these elements. These structures had common "forward&reverse stream&digest" elements, but they were initialized and freed through cpath objects, and different parts of the code depended on them. Now all that code is extacted, and kept in relay_crypto.c
Diffstat (limited to 'src/test/bench.c')
-rw-r--r--src/test/bench.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/test/bench.c b/src/test/bench.c
index 67e127311a..c0d430e052 100644
--- a/src/test/bench.c
+++ b/src/test/bench.c
@@ -505,10 +505,10 @@ bench_cell_ops(void)
char key1[CIPHER_KEY_LEN], key2[CIPHER_KEY_LEN];
crypto_rand(key1, sizeof(key1));
crypto_rand(key2, sizeof(key2));
- or_circ->p_crypto = crypto_cipher_new(key1);
- or_circ->n_crypto = crypto_cipher_new(key2);
- or_circ->p_digest = crypto_digest_new();
- or_circ->n_digest = crypto_digest_new();
+ or_circ->crypto.f_crypto = crypto_cipher_new(key1);
+ or_circ->crypto.b_crypto = crypto_cipher_new(key2);
+ or_circ->crypto.f_digest = crypto_digest_new();
+ or_circ->crypto.b_digest = crypto_digest_new();
reset_perftime();
@@ -528,10 +528,7 @@ bench_cell_ops(void)
NANOCOUNT(start,end,iters*CELL_PAYLOAD_SIZE));
}
- crypto_digest_free(or_circ->p_digest);
- crypto_digest_free(or_circ->n_digest);
- crypto_cipher_free(or_circ->p_crypto);
- crypto_cipher_free(or_circ->n_crypto);
+ relay_crypto_clear(&or_circ->crypto);
tor_free(or_circ);
tor_free(cell);
}