diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-12-04 21:27:07 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-01-03 11:29:46 -0500 |
commit | f58d4dfcd61aec7ea1900873ca08ecc31d7a7ef7 (patch) | |
tree | 12e9b9fbcbbaf319638926575b913daaea05f7e9 /src/test | |
parent | 5fa1c7484cba293e6467acbca06a4143ce9da68d (diff) | |
download | tor-f58d4dfcd61aec7ea1900873ca08ecc31d7a7ef7.tar tor-f58d4dfcd61aec7ea1900873ca08ecc31d7a7ef7.tar.gz |
Massive refactoring of the various handshake types
The three handshake types are now accessed from a unified interface;
their state is abstracted from the rest of the cpath state, and so on.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/bench.c | 16 | ||||
-rw-r--r-- | src/test/test.c | 14 |
2 files changed, 16 insertions, 14 deletions
diff --git a/src/test/bench.c b/src/test/bench.c index 567b1a4d7..23560cd43 100644 --- a/src/test/bench.c +++ b/src/test/bench.c @@ -110,8 +110,8 @@ bench_onion_TAP(void) int i; crypto_pk_t *key, *key2; uint64_t start, end; - char os[ONIONSKIN_CHALLENGE_LEN]; - char or[ONIONSKIN_REPLY_LEN]; + char os[TAP_ONIONSKIN_CHALLENGE_LEN]; + char or[TAP_ONIONSKIN_REPLY_LEN]; crypto_dh_t *dh_out; key = crypto_pk_new(); @@ -122,17 +122,18 @@ bench_onion_TAP(void) reset_perftime(); start = perftime(); for (i = 0; i < iters; ++i) { - onion_skin_create(key, &dh_out, os); + onion_skin_TAP_create(key, &dh_out, os); crypto_dh_free(dh_out); } end = perftime(); printf("Client-side, part 1: %f usec.\n", NANOCOUNT(start, end, iters)/1e3); - onion_skin_create(key, &dh_out, os); + onion_skin_TAP_create(key, &dh_out, os); start = perftime(); for (i = 0; i < iters; ++i) { char key_out[CPATH_KEY_MATERIAL_LEN]; - onion_skin_server_handshake(os, key, NULL, or, key_out, sizeof(key_out)); + onion_skin_TAP_server_handshake(os, key, NULL, or, + key_out, sizeof(key_out)); } end = perftime(); printf("Server-side, key guessed right: %f usec\n", @@ -141,7 +142,8 @@ bench_onion_TAP(void) start = perftime(); for (i = 0; i < iters; ++i) { char key_out[CPATH_KEY_MATERIAL_LEN]; - onion_skin_server_handshake(os, key2, key, or, key_out, sizeof(key_out)); + onion_skin_TAP_server_handshake(os, key2, key, or, + key_out, sizeof(key_out)); } end = perftime(); printf("Server-side, key guessed wrong: %f usec.\n", @@ -153,7 +155,7 @@ bench_onion_TAP(void) char key_out[CPATH_KEY_MATERIAL_LEN]; int s; dh = crypto_dh_dup(dh_out); - s = onion_skin_client_handshake(dh, or, key_out, sizeof(key_out)); + s = onion_skin_TAP_client_handshake(dh, or, key_out, sizeof(key_out)); tor_assert(s == 0); } end = perftime(); diff --git a/src/test/test.c b/src/test/test.c index cc2d481c7..daac67ee4 100644 --- a/src/test/test.c +++ b/src/test/test.c @@ -819,11 +819,11 @@ test_onion_handshake(void) { /* client-side */ crypto_dh_t *c_dh = NULL; - char c_buf[ONIONSKIN_CHALLENGE_LEN]; + char c_buf[TAP_ONIONSKIN_CHALLENGE_LEN]; char c_keys[40]; /* server-side */ - char s_buf[ONIONSKIN_REPLY_LEN]; + char s_buf[TAP_ONIONSKIN_REPLY_LEN]; char s_keys[40]; /* shared */ @@ -832,18 +832,18 @@ test_onion_handshake(void) pk = pk_generate(0); /* client handshake 1. */ - memset(c_buf, 0, ONIONSKIN_CHALLENGE_LEN); - test_assert(! onion_skin_create(pk, &c_dh, c_buf)); + memset(c_buf, 0, TAP_ONIONSKIN_CHALLENGE_LEN); + test_assert(! onion_skin_TAP_create(pk, &c_dh, c_buf)); /* server handshake */ - memset(s_buf, 0, ONIONSKIN_REPLY_LEN); + memset(s_buf, 0, TAP_ONIONSKIN_REPLY_LEN); memset(s_keys, 0, 40); - test_assert(! onion_skin_server_handshake(c_buf, pk, NULL, + test_assert(! onion_skin_TAP_server_handshake(c_buf, pk, NULL, s_buf, s_keys, 40)); /* client handshake 2 */ memset(c_keys, 0, 40); - test_assert(! onion_skin_client_handshake(c_dh, s_buf, c_keys, 40)); + test_assert(! onion_skin_TAP_client_handshake(c_dh, s_buf, c_keys, 40)); if (memcmp(c_keys, s_keys, 40)) { puts("Aiiiie"); |