105-handshake-revision.txt 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. Version negotiation for the Tor protocol.
  2. 1.0. Version numbers
  3. The node-to-node TLS-based "OR connection" protocol and the multi-hop
  4. "circuit" protocol are versioned quasi-independently. (Certain versions
  5. of the circuit protocol may require a minimum version of the connection
  6. protocol to be used.)
  7. Version numbers are incremented for backward-incompatible protocol changes
  8. only. Backward-compatible changes are generally implemented by adding
  9. additional fields to existing structures; implementations MUST ignore
  10. fields they do not expect.
  11. 2.1. VERSIONS cells
  12. When a Tor connection is established, both parties normally send a
  13. VERSIONS cell before sending any other cells. (But see below.)
  14. NumVersions [1 byte]
  15. Versions [NumVersions bytes]
  16. "Versions" is a sequence of NumVersions link connection protocol versions,
  17. each one byte long. Parties should list all of the versions which they
  18. are able and willing to support. Parties can only communicate if they
  19. have some connection protocol version in common.
  20. Version 0.1.x.y-alpha and earlier don't understand VERSIONS cells,
  21. and therefore don't support version negotiation. Thus, waiting until
  22. the other side has sent a VERSIONS cell won't work for these servers:
  23. if they send no cells back, it is impossible to tell whether they
  24. have sent a VERSIONS cell that has been stalled, or whether they have
  25. dropped our own VERSIONS cell as unrecognized. Thus, immediately after
  26. a TLS connection has been established, the parties check whether the
  27. other side has an obsolete certificate (organizationName equal to "Tor"
  28. or "TOR"). If the other party presented an obsolete certificate,
  29. we assume a v1 connection. Otherwise, both parties send VERSIONS
  30. cells listing all their supported versions. Upon receiving the
  31. other party's VERSIONS cell, the implementation begins using the
  32. highest-valued version common to both cells. If the first cell from
  33. the other party is _not_ a VERSIONS cell, we assume a v1 protocol.
  34. Implementations MUST discard cells that are not the first cells sent on a
  35. connection.
  36. 2.2. MITM-prevention and time checking
  37. If we negotiate a v2 connection or higher, the first cell we send SHOULD
  38. be a NETINFO cell. Implementations SHOULD NOT send NETINFO cells at other
  39. times.
  40. A NETINFO cell contains:
  41. Timestamp [4 bytes]
  42. This OR's address [variable]
  43. Other OR's address [variable]
  44. Timestamp is the OR's current Unix time, in seconds since the epoch. If
  45. an implementation receives time values from many validated ORs that
  46. indicate that its clock is skewed, it SHOULD try to warn the
  47. administrator.
  48. Each address contains Type/Length/Value as used in Section 6.4. The first
  49. address is the address of the interface the party sending the VERSIONS cell
  50. used to connect to or accept connections from the other -- we include it
  51. to block a man-in-the-middle attack on TLS that lets an attacker bounce
  52. traffic through his own computers to enable timing and packet-counting
  53. attacks.
  54. The second address is the one that the party sending the VERSIONS cell
  55. believes the other has -- it can be used to learn what your IP address
  56. is if you have no other hints.