Skip to content
  1. Sep 01, 2015
  2. Aug 28, 2015
  3. Aug 26, 2015
  4. Aug 24, 2015
    • Isis Lovecruft's avatar
      fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!... · 9400cf7c
      Isis Lovecruft authored
      fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Implement Bridge Guards (prop188).
      
       * FIXES about a zillion whitespace issues.
      
       * FIXES a mistake where the first relay_early cell on a loose circuit was
         stored (and unconditionally sent outwards later) without checking the
         cell_direction.  Unclear if this would have had serious consequences, but
         it would be incorrect behaviour nonetheless.
      
       * CHANGES several functions in loose.c from static to STATIC, for
         unittesting.
      9400cf7c
    • Isis Lovecruft's avatar
      fixup! fixup! Add unittests for loose.c. · 7f9a5b73
      Isis Lovecruft authored
      7f9a5b73
  5. Aug 20, 2015
  6. Aug 18, 2015
  7. Aug 17, 2015
    • Isis Lovecruft's avatar
      Redefine CIRCUIT_IS_ORIGIN to use ORIGIN_CIRCUIT_MAGIC, not purpose. · 1568e144
      Isis Lovecruft authored
      Previously, we were using `CIRCUIT_PURPOSE_IS_ORIGIN` to define this, which
      means that, if `circ->purpose > CIRCUIT_PURPOSE_OR_MAX_` (currently 4), then
      the circuit is determined to be an `origin_circuit_t`.  This is increasingly
      dangerous when we add new circuit types (e.g. `loose_or_circuit_t`), as memory
      corruption problems could easily cause `circ->purpose` to be interpreted as
      higher than 4, which would then likely trigger further memory issues due to
      the circuit being downcast to the wrong type.
      
      To avoid these problems, `CIRCUIT_IS_ORIGIN` is rewritten to check that:
      
          ((circuit_t *)(c))->magic == ORIGIN_CIRCUIT_MAGIC
      
      just like `CIRCUIT_IS_ORCIRC` and `CIRCUIT_IS_LOOSE`.
      
       * CHANGE `CIRCUIT_IS_ORIGIN` to check `ORIGIN_CIRCUIT_MAGIC`.
      1568e144
  8. Aug 15, 2015
    • Isis Lovecruft's avatar
      Refactor circuit_get_cpath_hop() to operate on just the cpath. · 04fd0097
      Isis Lovecruft authored
      This allows us to reuse the logic for other types of `circuit_t`s, not
      just `origin_circuit_t`.
      
       * ADD new function, `cpath_get_hop()`, which contains most of the
         original logic from `circuit_get_cpath_hop()`.
      
       * CHANGE `circuit_get_cpath_hop()` to call `cpath_get_hop()`.
      04fd0097
    • Isis Lovecruft's avatar
      Generalize logic for calculating cpath length. · 05d5eaa1
      Isis Lovecruft authored
       * ADD a new function `cpath_get_len()`, which operates on a
         `crypt_path_t` to determine it's length.  This permits us to reuse
         this logic for other types of circuits, not just `origin_circuit_t`s.
      
       * CHANGE `circuit_get_cpath_len()` to call `cpath_get_len()` with
         `origin_circuit_t->cpath`.
      05d5eaa1
    • Isis Lovecruft's avatar
      Generalise logic for whether a circuit_t supports ntor. · 43670da1
      Isis Lovecruft authored
      This allows us to determine whether some `circuit_t` can support ntor,
      solely based upon that `circuit_t`'s cpath.  This will permit us to
      reuse this logic in the future for both `origin_circuit_t`s and
      `loose_or_circuit_t`s.
      
       * ADD new function, `cpath_supports_ntor`, which determines whether the
         hops in a cpath support the ntor handshake. It includes logic which
         once lived in `circuit_cpath_supports_ntor`.
      
       * REFACTOR `circuit_cpath_supports_ntor` to use `cpath_supports_ntor`.
      43670da1
  9. Aug 06, 2015
    • Isis Lovecruft's avatar
      Refactor loop over cpath for getting nicknames into separate function. · fbb21bbd
      Isis Lovecruft authored
      This refactors `circuit_list_path_impl()` to move the loop over the
      `hops` in a `circ->cpath` to a separate function.  This is necessary
      because retrieving router nicknames/fingerprints from a chosen cpath
      requires the same process — regardless of what type of `circuit_t` the
      `cpath` is an attribute of.  With these changes, other types of
      `circuit_t`s — not solely `origin_circuit_t` — can reuse this giant code
      block for logging their chosen paths.  In the future, this will be used
      for logging `loose_or_circuit_t`s for prop#188.
      
       * ADDS a new function, `circuit_list_cpath_impl()`, which takes
         `crypt_path_t *cpath` and a `smartlist_t *elements`, iterates over
         the `cpath` to retrieve information regarding the hops within, and
         adds this information to the list of `elements`.
      
       * ADD a wrapper function `circuit_list_cpath()`, which wraps
         `circuit_list_cpath_impl()`.
      
       * REFACTORS `circuit_list_path_impl()` to call `circuit_list_cpath()`,
         giving it the former's pre-allocated `smartlist_t` in order to gather
         router info.  It then uses to build a string suitable for logging the
         circuit's path (just as it did before).
      fbb21bbd
  10. Jul 31, 2015
    • Nick Mathewson's avatar
      Move formatting functions around. · 347fe449
      Nick Mathewson authored
      The base64 and base32 functions used to be in crypto.c;
      crypto_format.h had no header; some general-purpose functions were in
      crypto_curve25519.c.
      
      This patch makes a {crypto,util}_format.[ch], and puts more functions
      there.  Small modules are beautiful!
      347fe449
  11. Jul 30, 2015
    • David Goulet's avatar
      Add get_max_sockets() and remove dead code · 8c83e8ce
      David Goulet authored
      
      
      The control port was using set_max_file_descriptors() with a limit set to 0
      to query the number of maximum socket Tor can use. With the recent changes
      to that function, a check was introduced to make sure a user can not set a
      value below the amount we reserved for non socket.
      
      This commit adds get_max_sockets() that returns the value of max_sockets so
      we can stop using that "setter" function to get the current value.
      
      Finally, the dead code is removed that is the code that checked for limit
      equal to 0. From now on, set_max_file_descriptors() should never be used
      with a limit set to 0 for a valid use case.
      
      Fixes #16697
      
      Signed-off-by: default avatarDavid Goulet <dgoulet@ev0ke.net>
      8c83e8ce
    • Nick Mathewson's avatar
      whitespace fix · aa22b967
      Nick Mathewson authored
      aa22b967