aboutsummaryrefslogtreecommitdiff
path: root/src/test/bench.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-03-20 15:35:43 -0400
committerNick Mathewson <nickm@torproject.org>2012-03-27 22:37:56 -0400
commitde0dca0de76d9d50aeb5955fe3f435c6c190f8d7 (patch)
tree8d7005e768bc04ac1695b72cf3970d552570016f /src/test/bench.c
parent00b4784575c88d5de15886b440096c1e2b9fb080 (diff)
downloadtor-de0dca0de76d9d50aeb5955fe3f435c6c190f8d7.tar
tor-de0dca0de76d9d50aeb5955fe3f435c6c190f8d7.tar.gz
Refactor the API for setting up a block cipher.
It allows us more flexibility on the backend if the user needs to specify the key and IV at setup time.
Diffstat (limited to 'src/test/bench.c')
-rw-r--r--src/test/bench.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/test/bench.c b/src/test/bench.c
index a662bd23e..308181480 100644
--- a/src/test/bench.c
+++ b/src/test/bench.c
@@ -77,9 +77,8 @@ bench_aes(void)
uint64_t start, end;
const int bytes_per_iter = (1<<24);
reset_perftime();
- c = crypto_cipher_new();
- crypto_cipher_generate_key(c);
- crypto_cipher_encrypt_init_cipher(c);
+ c = crypto_cipher_new(NULL);
+
for (len = 1; len <= 8192; len *= 2) {
int iters = bytes_per_iter / len;
b1 = tor_malloc_zero(len);
@@ -108,9 +107,7 @@ bench_cell_aes(void)
crypto_cipher_t *c;
int i, misalign;
- c = crypto_cipher_new();
- crypto_cipher_generate_key(c);
- crypto_cipher_encrypt_init_cipher(c);
+ c = crypto_cipher_new(NULL);
reset_perftime();
for (misalign = 0; misalign <= max_misalign; ++misalign) {
@@ -221,12 +218,8 @@ bench_cell_ops(void)
or_circ->_base.purpose = CIRCUIT_PURPOSE_OR;
/* Initialize crypto */
- or_circ->p_crypto = crypto_cipher_new();
- crypto_cipher_generate_key(or_circ->p_crypto);
- crypto_cipher_encrypt_init_cipher(or_circ->p_crypto);
- or_circ->n_crypto = crypto_cipher_new();
- crypto_cipher_generate_key(or_circ->n_crypto);
- crypto_cipher_encrypt_init_cipher(or_circ->n_crypto);
+ or_circ->p_crypto = crypto_cipher_new(NULL);
+ or_circ->n_crypto = crypto_cipher_new(NULL);
or_circ->p_digest = crypto_digest_new();
or_circ->n_digest = crypto_digest_new();