aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_link_handshake.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-06-01 09:26:24 -0400
committerNick Mathewson <nickm@torproject.org>2017-06-01 09:26:24 -0400
commit34a6755b94015fcbc838b46b54667899c238ac04 (patch)
tree5e904e93310020615cb0e0351e4effe05ab3d7f8 /src/test/test_link_handshake.c
parenta9be768959c189846178723d5fe44d3b59b0d983 (diff)
downloadtor-34a6755b94015fcbc838b46b54667899c238ac04.tar.gz
tor-34a6755b94015fcbc838b46b54667899c238ac04.zip
Fix ed25519 link certificate race on tls context rotation
Whenever we rotate our TLS context, we change our Ed25519 Signing->Link certificate. But if we've already started a TLS connection, then we've already sent the old X509 link certificate, so the new Ed25519 Signing->Link certificate won't match it. To fix this, we now store a copy of the Signing->Link certificate when we initialize the handshake state, and send that certificate as part of our CERTS cell. Fixes one case of bug22460; bugfix on 0.3.0.1-alpha.
Diffstat (limited to 'src/test/test_link_handshake.c')
-rw-r--r--src/test/test_link_handshake.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/test/test_link_handshake.c b/src/test/test_link_handshake.c
index 421f3aaedf..d1b9c65afa 100644
--- a/src/test/test_link_handshake.c
+++ b/src/test/test_link_handshake.c
@@ -892,6 +892,11 @@ test_link_handshake_send_authchallenge(void *arg)
or_connection_t *c1 = or_connection_new(CONN_TYPE_OR, AF_INET);
var_cell_t *cell1=NULL, *cell2=NULL;
+ crypto_pk_t *rsa0 = pk_generate(0), *rsa1 = pk_generate(1);
+ tt_int_op(tor_tls_context_init(TOR_TLS_CTX_IS_PUBLIC_SERVER,
+ rsa0, rsa1, 86400), ==, 0);
+ init_mock_ed_keys(rsa0);
+
MOCK(connection_or_write_var_cell_to_buf, mock_write_var_cell);
tt_int_op(connection_init_or_handshake_state(c1, 0), ==, 0);
@@ -917,6 +922,8 @@ test_link_handshake_send_authchallenge(void *arg)
connection_free_(TO_CONN(c1));
tor_free(cell1);
tor_free(cell2);
+ crypto_pk_free(rsa0);
+ crypto_pk_free(rsa1);
}
typedef struct authchallenge_data_s {