Skip to content
Snippets Groups Projects

tor-proto: add the ability to learn clock skew from NETINFO cells

Merged Nick Mathewson requested to merge nickm/arti:netinfo-clock-skew into main
  1. Mar 23, 2022
    • Nick Mathewson's avatar
      tor-proto: better errors when handshake fails due to untimely certs · 0b2cf533
      Nick Mathewson authored
      We now check the handshake certificates unconditionally, and only
      report them as _expired_ as a last resort.
      
      (Rationale: if somebody is presenting the wrong identity from a year
      ago, it is more interesting that they are presenting the wrong ID
      than it is that they are doing so with an expired cert.
      
      We also now report a different error if the certificate is expired,
      but its expiration is within the range of reported clock skew.
      
      (Rationale: it's helpful to distinguish this case, so that we can
      blame the failure on possible clock skew rather than definitely
      attributing it to a misbehaving relay.)
      
      Part of #405.
      0b2cf533
    • Nick Mathewson's avatar
      tor-proto: add a backend to detect reported clock skew. · 3885a2c0
      Nick Mathewson authored
      NETINFO cells, which are sent in every handshake, may contain
      timestamps.  This patch adds an accessor for the timestamp in the
      Netinfo messages, and teaches the tor-proto code how to compute the
      minimum clock skew in the code.
      
      The computation isn't terribly precise, but it doesn't need to be:
      Tor should work fine if your clock is accurate to within a few
      hours.
      
      This patch also notes a Y2038 problem in the protocol: see
      torspec#80.
      
      Part of #405.
      3885a2c0
Loading