commit d3f560929f20bf9b8565ab6a00cc05106573b7da
parent e952b56820f932cb37a7dca71a3fb1f54cd3f114
Author: Nick Mathewson <nickm@torproject.org>
Date: Thu, 24 Apr 2025 14:19:31 -0400
Rename "RENEGOTIATING state.
Diffstat:
4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/core/mainloop/connection.c b/src/core/mainloop/connection.c
@@ -314,8 +314,8 @@ conn_state_to_string(int type, int state)
case OR_CONN_STATE_CONNECTING: return "connect()ing";
case OR_CONN_STATE_PROXY_HANDSHAKING: return "handshaking (proxy)";
case OR_CONN_STATE_TLS_HANDSHAKING: return "handshaking (TLS)";
- case OR_CONN_STATE_TLS_SERVER_RENEGOTIATING:
- return "waiting for renegotiation or V3 handshake";
+ case OR_CONN_STATE_SERVER_VERSIONS_WAIT:
+ return "waiting for V3+ handshake";
case OR_CONN_STATE_OR_HANDSHAKING_V3:
return "handshaking (Tor, v3 handshake)";
case OR_CONN_STATE_OPEN: return "open";
@@ -4506,7 +4506,7 @@ connection_handle_write_impl(connection_t *conn, int force)
return -1;
}
return 0;
- } else if (conn->state == OR_CONN_STATE_TLS_SERVER_RENEGOTIATING) {
+ } else if (conn->state == OR_CONN_STATE_SERVER_VERSIONS_WAIT) {
return connection_handle_read(conn);
}
diff --git a/src/core/or/channeltls.c b/src/core/or/channeltls.c
@@ -1246,7 +1246,7 @@ channel_tls_handle_var_cell(var_cell_t *var_cell, or_connection_t *conn)
/* But that should be happening any longer've disabled bufferevents. */
tor_assert_nonfatal_unreached_once();
FALLTHROUGH_UNLESS_ALL_BUGS_ARE_FATAL;
- case OR_CONN_STATE_TLS_SERVER_RENEGOTIATING:
+ case OR_CONN_STATE_SERVER_VERSIONS_WAIT:
if (!(command_allowed_before_handshake(var_cell->command))) {
log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
"Received a cell with command %d in unexpected "
@@ -1416,7 +1416,7 @@ enter_v3_handshake_with_cell(var_cell_t *cell, channel_tls_t *chan)
tor_assert(TO_CONN(chan->conn)->state == OR_CONN_STATE_TLS_HANDSHAKING ||
TO_CONN(chan->conn)->state ==
- OR_CONN_STATE_TLS_SERVER_RENEGOTIATING);
+ OR_CONN_STATE_SERVER_VERSIONS_WAIT);
if (started_here) {
log_fn(LOG_PROTOCOL_WARN, LD_OR,
@@ -1476,7 +1476,6 @@ channel_tls_process_versions_cell(var_cell_t *cell, channel_tls_t *chan)
case OR_CONN_STATE_OR_HANDSHAKING_V3:
break;
case OR_CONN_STATE_TLS_HANDSHAKING:
- case OR_CONN_STATE_TLS_SERVER_RENEGOTIATING:
default:
log_fn(LOG_PROTOCOL_WARN, LD_OR,
"VERSIONS cell while in unexpected state");
diff --git a/src/core/or/connection_or.c b/src/core/or/connection_or.c
@@ -1709,11 +1709,14 @@ connection_tls_continue_handshake(or_connection_t *conn)
tor_assert(conn->base_.state == OR_CONN_STATE_TLS_HANDSHAKING);
return connection_or_launch_v3_or_handshake(conn);
} else {
- /* v3 handshake, but we are not a client. */
+ /* v3+ handshake, but we are not a client. */
log_debug(LD_OR, "Done with initial SSL handshake (server-side). "
"Expecting VERSIONS cell");
+ /* Note: We could instead just send a VERSIONS cell now,
+ * since the V2 handshake is no longer a thing.
+ * But that would require re-plumbing this state machine. */
connection_or_change_state(conn,
- OR_CONN_STATE_TLS_SERVER_RENEGOTIATING);
+ OR_CONN_STATE_SERVER_VERSIONS_WAIT);
connection_stop_writing(TO_CONN(conn));
connection_start_reading(TO_CONN(conn));
return 0;
diff --git a/src/core/or/orconn_event.h b/src/core/or/orconn_event.h
@@ -35,10 +35,8 @@
* yet. */
#define OR_CONN_STATE_TLS_HANDSHAKING 3
/** State for a connection at an OR: We're waiting for the client to
- * renegotiate (to indicate a v2 handshake) or send a versions cell (to
- * indicate a v3 handshake) */
-// XXXX Rename.
-#define OR_CONN_STATE_TLS_SERVER_RENEGOTIATING 5
+ * send a versions cell (to indicate a v3+ handshake) */
+#define OR_CONN_STATE_SERVER_VERSIONS_WAIT 5
/** State for an OR connection: We're done with our SSL handshake, but we
* haven't yet negotiated link protocol versions, done a V3 handshake, and
* sent a netinfo cell. */