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";
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);
}
/* 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 "
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,
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");
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;
* 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. */