aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_link_handshake.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-05-21 13:43:34 -0400
committerNick Mathewson <nickm@torproject.org>2016-11-03 08:37:21 -0400
commite23389841c7797615b09ee6457e841b4ed13ea75 (patch)
tree5303cc276c4888567b883f3fec70209a2b5de2fa /src/test/test_link_handshake.c
parent4ef42e7c529a95b69d3e830e115e5d0453d38dfb (diff)
downloadtor-e23389841c7797615b09ee6457e841b4ed13ea75.tar.gz
tor-e23389841c7797615b09ee6457e841b4ed13ea75.zip
Migrate certificates into a sub-structure of or_handshake_state
This will help us do cert-checking in the background in the future, perhaps.
Diffstat (limited to 'src/test/test_link_handshake.c')
-rw-r--r--src/test/test_link_handshake.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/test/test_link_handshake.c b/src/test/test_link_handshake.c
index 6c0567098f..3314880785 100644
--- a/src/test/test_link_handshake.c
+++ b/src/test/test_link_handshake.c
@@ -147,8 +147,8 @@ test_link_handshake_certs_ok(void *arg)
channel_tls_process_certs_cell(cell2, chan1);
tt_assert(c1->handshake_state->received_certs_cell);
- tt_assert(c1->handshake_state->auth_cert == NULL);
- tt_assert(c1->handshake_state->id_cert);
+ tt_assert(c1->handshake_state->certs->auth_cert == NULL);
+ tt_assert(c1->handshake_state->certs->id_cert);
tt_assert(! tor_mem_is_zero(
(char*)c1->handshake_state->authenticated_peer_id, 20));
@@ -165,8 +165,8 @@ test_link_handshake_certs_ok(void *arg)
channel_tls_process_certs_cell(cell1, chan2);
tt_assert(c2->handshake_state->received_certs_cell);
- tt_assert(c2->handshake_state->auth_cert);
- tt_assert(c2->handshake_state->id_cert);
+ tt_assert(c2->handshake_state->certs->auth_cert);
+ tt_assert(c2->handshake_state->certs->id_cert);
tt_assert(tor_mem_is_zero(
(char*)c2->handshake_state->authenticated_peer_id, 20));
@@ -303,8 +303,8 @@ test_link_handshake_recv_certs_ok(void *arg)
tt_int_op(0, ==, mock_close_called);
tt_int_op(d->c->handshake_state->authenticated, ==, 1);
tt_int_op(d->c->handshake_state->received_certs_cell, ==, 1);
- tt_assert(d->c->handshake_state->id_cert != NULL);
- tt_assert(d->c->handshake_state->auth_cert == NULL);
+ tt_assert(d->c->handshake_state->certs->id_cert != NULL);
+ tt_assert(d->c->handshake_state->certs->auth_cert == NULL);
done:
;
@@ -324,8 +324,8 @@ test_link_handshake_recv_certs_ok_server(void *arg)
tt_int_op(0, ==, mock_close_called);
tt_int_op(d->c->handshake_state->authenticated, ==, 0);
tt_int_op(d->c->handshake_state->received_certs_cell, ==, 1);
- tt_assert(d->c->handshake_state->id_cert != NULL);
- tt_assert(d->c->handshake_state->auth_cert != NULL);
+ tt_assert(d->c->handshake_state->certs->id_cert != NULL);
+ tt_assert(d->c->handshake_state->certs->auth_cert != NULL);
done:
;
@@ -767,15 +767,15 @@ authenticate_data_setup(const struct testcase_t *test)
const uint8_t *der;
size_t sz;
tor_x509_cert_get_der(id_cert, &der, &sz);
- d->c1->handshake_state->id_cert = tor_x509_cert_decode(der, sz);
- d->c2->handshake_state->id_cert = tor_x509_cert_decode(der, sz);
+ d->c1->handshake_state->certs->id_cert = tor_x509_cert_decode(der, sz);
+ d->c2->handshake_state->certs->id_cert = tor_x509_cert_decode(der, sz);
tor_x509_cert_get_der(link_cert, &der, &sz);
mock_peer_cert = tor_x509_cert_decode(der, sz);
tt_assert(mock_peer_cert);
tt_assert(! tor_tls_get_my_certs(0, &auth_cert, &id_cert));
tor_x509_cert_get_der(auth_cert, &der, &sz);
- d->c2->handshake_state->auth_cert = tor_x509_cert_decode(der, sz);
+ d->c2->handshake_state->certs->auth_cert = tor_x509_cert_decode(der, sz);
/* Make an authenticate cell ... */
tt_int_op(0, ==, connection_or_send_authenticate_cell(d->c1,
@@ -825,7 +825,7 @@ test_link_handshake_auth_cell(void *arg)
uint8_t sig[128];
uint8_t digest[32];
- auth_pubkey = tor_tls_cert_get_key(d->c2->handshake_state->auth_cert);
+ auth_pubkey = tor_tls_cert_get_key(d->c2->handshake_state->certs->auth_cert);
int n = crypto_pk_public_checksig(
auth_pubkey,
(char*)sig, sizeof(sig), (char*)auth1_getarray_sig(auth1),
@@ -898,13 +898,13 @@ AUTHENTICATE_FAIL(nocerts,
AUTHENTICATE_FAIL(noidcert,
require_failure_message = "We never got an identity "
"certificate";
- tor_x509_cert_free(d->c2->handshake_state->id_cert);
- d->c2->handshake_state->id_cert = NULL)
+ tor_x509_cert_free(d->c2->handshake_state->certs->id_cert);
+ d->c2->handshake_state->certs->id_cert = NULL)
AUTHENTICATE_FAIL(noauthcert,
require_failure_message = "We never got an authentication "
"certificate";
- tor_x509_cert_free(d->c2->handshake_state->auth_cert);
- d->c2->handshake_state->auth_cert = NULL)
+ tor_x509_cert_free(d->c2->handshake_state->certs->auth_cert);
+ d->c2->handshake_state->certs->auth_cert = NULL)
AUTHENTICATE_FAIL(tooshort,
require_failure_message = "Cell was way too short";
d->cell->payload_len = 3)