aboutsummaryrefslogtreecommitdiff
path: root/src/or/connection_or.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-06-05 15:44:36 -0400
committerNick Mathewson <nickm@torproject.org>2017-06-05 15:44:36 -0400
commitd5acdadaeffa8e1c61abef5881e9cc6e42d9a755 (patch)
treeee2887749e97b34092109038dfe3a784df34155c /src/or/connection_or.c
parentd1c1dc229e189cbf4e463b82751af007801a02eb (diff)
parente5bdfd66cf03e8410c511f6dcf309142c64c85f5 (diff)
downloadtor-d5acdadaeffa8e1c61abef5881e9cc6e42d9a755.tar.gz
tor-d5acdadaeffa8e1c61abef5881e9cc6e42d9a755.zip
Merge branch 'bug22460_030_01' into maint-0.3.0
Diffstat (limited to 'src/or/connection_or.c')
-rw-r--r--src/or/connection_or.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index b9ac9b2c5d..1e2d731f53 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -1855,6 +1855,9 @@ connection_init_or_handshake_state(or_connection_t *conn, int started_here)
s->started_here = started_here ? 1 : 0;
s->digest_sent_data = 1;
s->digest_received_data = 1;
+ if (! started_here && get_current_link_cert_cert()) {
+ s->own_link_cert = tor_cert_dup(get_current_link_cert_cert());
+ }
s->certs = or_handshake_certs_new();
s->certs->started_here = s->started_here;
return 0;
@@ -1869,6 +1872,7 @@ or_handshake_state_free(or_handshake_state_t *state)
crypto_digest_free(state->digest_sent);
crypto_digest_free(state->digest_received);
or_handshake_certs_free(state->certs);
+ tor_cert_free(state->own_link_cert);
memwipe(state, 0xBE, sizeof(or_handshake_state_t));
tor_free(state);
}
@@ -2234,7 +2238,8 @@ add_certs_cell_cert_helper(certs_cell_t *certs_cell,
/** Add an encoded X509 cert (stored as <b>cert_len</b> bytes at
* <b>cert_encoded</b>) to the trunnel certs_cell_t object that we are
- * building in <b>certs_cell</b>. Set its type field to <b>cert_type</b>. */
+ * building in <b>certs_cell</b>. Set its type field to <b>cert_type</b>.
+ * (If <b>cert</b> is NULL, take no action.) */
static void
add_x509_cert(certs_cell_t *certs_cell,
uint8_t cert_type,
@@ -2252,7 +2257,7 @@ add_x509_cert(certs_cell_t *certs_cell,
/** Add an Ed25519 cert from <b>cert</b> to the trunnel certs_cell_t object
* that we are building in <b>certs_cell</b>. Set its type field to
- * <b>cert_type</b>. */
+ * <b>cert_type</b>. (If <b>cert</b> is NULL, take no action.) */
static void
add_ed25519_cert(certs_cell_t *certs_cell,
uint8_t cert_type,
@@ -2315,9 +2320,10 @@ connection_or_send_certs_cell(or_connection_t *conn)
CERTTYPE_ED_ID_SIGN,
get_master_signing_key_cert());
if (conn_in_server_mode) {
+ tor_assert_nonfatal(conn->handshake_state->own_link_cert);
add_ed25519_cert(certs_cell,
CERTTYPE_ED_SIGN_LINK,
- get_current_link_cert_cert());
+ conn->handshake_state->own_link_cert);
} else {
add_ed25519_cert(certs_cell,
CERTTYPE_ED_SIGN_AUTH,