|
@@ -728,7 +728,7 @@ connection_tls_finish_handshake(or_connection_t *conn)
|
|
if (connection_or_check_valid_handshake(conn, started_here, digest_rcvd) < 0)
|
|
if (connection_or_check_valid_handshake(conn, started_here, digest_rcvd) < 0)
|
|
return -1;
|
|
return -1;
|
|
|
|
|
|
- if (!started_here) {
|
|
|
|
|
|
+ if (!started_here) { /* V1 only XXX020 */
|
|
connection_or_init_conn_from_address(conn,conn->_base.addr,
|
|
connection_or_init_conn_from_address(conn,conn->_base.addr,
|
|
conn->_base.port, digest_rcvd, 0);
|
|
conn->_base.port, digest_rcvd, 0);
|
|
}
|
|
}
|
|
@@ -741,10 +741,16 @@ connection_tls_finish_handshake(or_connection_t *conn)
|
|
} else {
|
|
} else {
|
|
conn->_base.state = OR_CONN_STATE_OR_HANDSHAKING;
|
|
conn->_base.state = OR_CONN_STATE_OR_HANDSHAKING;
|
|
conn->handshake_state = tor_malloc_zero(sizeof(or_handshake_state_t));
|
|
conn->handshake_state = tor_malloc_zero(sizeof(or_handshake_state_t));
|
|
|
|
+ conn->handshake_state->started_here = started_here ? 1 : 0;
|
|
|
|
+ if (tor_tls_get_random_values(conn->tls,
|
|
|
|
+ conn->handshake_state->client_random,
|
|
|
|
+ conn->handshake_state->server_random) < 0)
|
|
|
|
+ return -1;
|
|
return connection_or_send_versions(conn);
|
|
return connection_or_send_versions(conn);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
/** DOCDOC */
|
|
/** DOCDOC */
|
|
void
|
|
void
|
|
or_handshake_state_free(or_handshake_state_t *state)
|
|
or_handshake_state_free(or_handshake_state_t *state)
|
|
@@ -752,6 +758,7 @@ or_handshake_state_free(or_handshake_state_t *state)
|
|
tor_assert(state);
|
|
tor_assert(state);
|
|
if (state->signing_key)
|
|
if (state->signing_key)
|
|
crypto_free_pk_env(state->signing_key);
|
|
crypto_free_pk_env(state->signing_key);
|
|
|
|
+ memset(state, 0xBE, sizeof(or_handshake_state_t));
|
|
tor_free(state);
|
|
tor_free(state);
|
|
}
|
|
}
|
|
|
|
|