diff options
author | Nick Mathewson <nickm@torproject.org> | 2016-09-11 14:00:54 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-11-03 08:40:10 -0400 |
commit | d4c57909f8578bb90e38573b873487be3ba759bd (patch) | |
tree | 236f8a56589177e4d2332041810e5b8a37e46c0c /src/test/test_link_handshake.c | |
parent | acbb60cd6310d30c8cb7631ee52ce86150021ab1 (diff) | |
download | tor-d4c57909f8578bb90e38573b873487be3ba759bd.tar.gz tor-d4c57909f8578bb90e38573b873487be3ba759bd.zip |
Test failing cases of ed25519 authentication.
Diffstat (limited to 'src/test/test_link_handshake.c')
-rw-r--r-- | src/test/test_link_handshake.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/test/test_link_handshake.c b/src/test/test_link_handshake.c index 04bfb5a410..ba1c9b0f2f 100644 --- a/src/test/test_link_handshake.c +++ b/src/test/test_link_handshake.c @@ -1395,8 +1395,25 @@ AUTHENTICATE_FAIL(badcontent, "cell body was not as expected"; d->cell->payload[10] ^= 0xff) AUTHENTICATE_FAIL(badsig_1, - require_failure_message = "RSA signature wasn't valid"; + if (d->is_ed) + require_failure_message = "Ed25519 signature wasn't valid"; + else + require_failure_message = "RSA signature wasn't valid"; d->cell->payload[d->cell->payload_len - 5] ^= 0xff) +AUTHENTICATE_FAIL(missing_ed_id, + { + tor_cert_free(d->c2->handshake_state->certs->ed_id_sign); + d->c2->handshake_state->certs->ed_id_sign = NULL; + require_failure_message = "Ed authenticate without Ed ID " + "cert from peer"; + }) +AUTHENTICATE_FAIL(missing_ed_auth, + { + tor_cert_free(d->c2->handshake_state->certs->ed_sign_auth); + d->c2->handshake_state->certs->ed_sign_auth = NULL; + require_failure_message = "We never got an Ed25519 " + "authentication certificate"; + }) #define TEST_RSA(name, flags) \ { #name , test_link_handshake_ ## name, (flags), \ @@ -1514,6 +1531,9 @@ struct testcase_t link_handshake_tests[] = { TEST_AUTHENTICATE(tooshort_1), TEST_AUTHENTICATE(badcontent), TEST_AUTHENTICATE(badsig_1), + TEST_AUTHENTICATE_ED(badsig_1), + TEST_AUTHENTICATE_ED(missing_ed_id), + TEST_AUTHENTICATE_ED(missing_ed_auth), //TEST_AUTHENTICATE(), END_OF_TESTCASES |