105-handshake-revision.txt 3.4 KB

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