aboutsummaryrefslogtreecommitdiff
path: root/src/or/protover.c
AgeCommit message (Collapse)Author
2018-07-05Move literally everything out of src/orNick Mathewson
This commit won't build yet -- it just puts everything in a slightly more logical place. The reasoning here is that "src/core" will hold the stuff that every (or nearly every) tor instance will need in order to do onion routing. Other features (including some necessary ones) will live in "src/feature". The "src/app" directory will hold the stuff needed to have Tor be an application you can actually run. This commit DOES NOT refactor the former contents of src/or into a logical set of acyclic libraries, or change any code at all. That will have to come in the future. We will continue to move things around and split them in the future, but I hope this lays a reasonable groundwork for doing so.
2018-06-21Merge branch 'maint-0.3.4'Nick Mathewson
2018-06-21Merge branch 'maint-0.3.3' into maint-0.3.4Nick Mathewson
2018-06-20fix memory leak in protover.cRoger Dingledine
Fix a memory leak where directory authorities would leak a chunk of memory for every router descriptor every time they considered voting. This bug was taking down directory authorities in the live network due to out-of-memory issues. Fixes bug 26435; bugfix on 0.3.3.6.
2018-06-20Run rectify_include_paths.pyNick Mathewson
2018-06-20Update copyrights to 2018.Nick Mathewson
2018-06-08Merge branch 'maint-0.3.2' into maint-0.3.3Nick Mathewson
2018-06-08Merge branch 'maint-0.3.3'Nick Mathewson
2018-06-08Merge branch 'maint-0.2.9' into maint-0.3.1Nick Mathewson
2018-06-08Merge branch 'maint-0.3.2' into maint-0.3.3Nick Mathewson
2018-06-08Avoid out-of-bounds smartlist access in protover_compute_vote()rl1987
and contract_protocol_list()
2018-05-22Merge branch 'maint-0.3.3'Nick Mathewson
2018-05-22Merge branch 'trove-2018-005_032' into maint-0.3.3Nick Mathewson
2018-05-22avoid a signed/unsigned comparison.Nick Mathewson
2018-05-22Merge branch 'maint-0.3.3'Nick Mathewson
2018-05-22Merge branch 'trove-2018-005_032' into maint-0.3.3Nick Mathewson
2018-05-22uint breaks compilation on windowsNick Mathewson
2018-05-22vote: TROVE-2018-005 Make DirAuths omit misbehaving routers from their vote.Isis Lovecruft
2018-05-22protover: TROVE-2018-005 Fix potential DoS in protover protocol parsing.Isis Lovecruft
In protover.c, the `expand_protocol_list()` function expands a `smartlist_t` of `proto_entry_t`s to their protocol name concatenated with each version number. For example, given a `proto_entry_t` like so: proto_entry_t *proto = tor_malloc(sizeof(proto_entry_t)); proto_range_t *range = tor_malloc_zero(sizeof(proto_range_t)); proto->name = tor_strdup("DoSaaaaaaaaaaaaaaaaaaaaaa[19KB]aaa"); proto->ranges = smartlist_new(); range->low = 1; range->high = 65536; smartlist_add(proto->ranges, range); (Where `[19KB]` is roughly 19KB of `"a"` bytes.) This would expand in `expand_protocol_list()` to a `smartlist_t` containing 65536 copies of the string, e.g.: "DoSaaaaaaaaaaaaaaaaaaaaaa[19KB]aaa=1" "DoSaaaaaaaaaaaaaaaaaaaaaa[19KB]aaa=2" […] "DoSaaaaaaaaaaaaaaaaaaaaaa[19KB]aaa=65535" Thus constituting a potential resource exhaustion attack. The Rust implementation is not subject to this attack, because it instead expands the above string into a `HashMap<String, HashSet<u32>` prior to #24031, and a `HashMap<UnvalidatedProtocol, ProtoSet>` after). Neither Rust version is subject to this attack, because it only stores the `String` once per protocol. (Although a related, but apparently of too minor impact to be usable, DoS bug has been fixed in #24031. [0]) [0]: https://bugs.torproject.org/24031 * ADDS hard limit on protocol name lengths in protover.c and checks in parse_single_entry() and expand_protocol_list(). * ADDS tests to ensure the bug is caught. * FIXES #25517: https://bugs.torproject.org/25517
2018-05-22Merge branch 'trove-2018-005_032' into trove-2018-005_033Nick Mathewson
2018-05-22vote: TROVE-2018-005 Make DirAuths omit misbehaving routers from their vote.Isis Lovecruft
2018-05-22protover: TROVE-2018-005 Fix potential DoS in protover protocol parsing.Isis Lovecruft
In protover.c, the `expand_protocol_list()` function expands a `smartlist_t` of `proto_entry_t`s to their protocol name concatenated with each version number. For example, given a `proto_entry_t` like so: proto_entry_t *proto = tor_malloc(sizeof(proto_entry_t)); proto_range_t *range = tor_malloc_zero(sizeof(proto_range_t)); proto->name = tor_strdup("DoSaaaaaaaaaaaaaaaaaaaaaa[19KB]aaa"); proto->ranges = smartlist_new(); range->low = 1; range->high = 65536; smartlist_add(proto->ranges, range); (Where `[19KB]` is roughly 19KB of `"a"` bytes.) This would expand in `expand_protocol_list()` to a `smartlist_t` containing 65536 copies of the string, e.g.: "DoSaaaaaaaaaaaaaaaaaaaaaa[19KB]aaa=1" "DoSaaaaaaaaaaaaaaaaaaaaaa[19KB]aaa=2" […] "DoSaaaaaaaaaaaaaaaaaaaaaa[19KB]aaa=65535" Thus constituting a potential resource exhaustion attack. The Rust implementation is not subject to this attack, because it instead expands the above string into a `HashMap<String, HashSet<u32>` prior to #24031, and a `HashMap<UnvalidatedProtocol, ProtoSet>` after). Neither Rust version is subject to this attack, because it only stores the `String` once per protocol. (Although a related, but apparently of too minor impact to be usable, DoS bug has been fixed in #24031. [0]) [0]: https://bugs.torproject.org/24031 * ADDS hard limit on protocol name lengths in protover.c and checks in parse_single_entry() and expand_protocol_list(). * ADDS tests to ensure the bug is caught. * FIXES #25517: https://bugs.torproject.org/25517
2018-04-22add changes file and update check-typos in makefileDeepesh Pathak
2018-04-02protover: Change protover_all_supported() to return only unsupported.Isis Lovecruft
Previously, if "Link=1-5" was supported, and you asked protover_all_supported() (or protover::all_supported() in Rust) if it supported "Link=3-999", the C version would return "Link=3-999" and the Rust would return "Link=6-999". These both behave the same now, i.e. both return "Link=6-999".
2018-04-02protover: Change protover_all_supported() to return only unsupported.Isis Lovecruft
Previously, if "Link=1-5" was supported, and you asked protover_all_supported() (or protover::all_supported() in Rust) if it supported "Link=3-999", the C version would return "Link=3-999" and the Rust would return "Link=6-999". These both behave the same now, i.e. both return "Link=6-999".
2018-03-01Merge branch 'maint-0.3.2' into maint-0.3.3Nick Mathewson
2018-03-01Merge branch 'maint-0.2.9' into maint-0.3.1Nick Mathewson
2018-03-01Spec conformance on protover: always reject ranges where lo>hiNick Mathewson
2018-03-01Forbid UINT32_MAX as a protocol versionNick Mathewson
The C code and the rust code had different separate integer overflow bugs here. That suggests that we're better off just forbidding this pathological case. Also, add tests for expected behavior on receiving a bad protocol list in a consensus. Fixes another part of 25249.
2018-03-01Forbid "-0" as a protocol version.Nick Mathewson
Fixes part of 24249; bugfix on 0.2.9.4-alpha.
2018-03-01Add another NULL-pointer fix for protover.c.Nick Mathewson
This one can only be exploited if you can generate a correctly signed consensus, so it's not as bad as 25074. Fixes bug 25251; also tracked as TROVE-2018-004.
2018-03-01Correctly handle NULL returns from parse_protocol_list when voting.Nick Mathewson
In some cases we had checked for it, but in others we had not. One of these cases could have been used to remotely cause denial-of-service against directory authorities while they attempted to vote. Fixes TROVE-2018-001.
2018-02-01Merge branch 'maint-0.3.2'Nick Mathewson
2018-01-30Add Link protocol version 5 to the supported protocols list in protover.cteor
Part of #25070, bugfix on 0.3.1.1-alpha.
2017-12-08Merge branch 'macro_free_v2_squashed'Nick Mathewson
2017-12-08Change the free macro convention in the rest of src/or/*.hNick Mathewson
2017-11-30Merge branch 'maint-0.3.2'Nick Mathewson
2017-11-30Merge branch 'maint-0.3.0' into maint-0.3.1Nick Mathewson
2017-11-30Merge branch 'maint-0.3.1' into maint-0.3.2Nick Mathewson
2017-11-30Merge branch 'maint-0.2.9' into maint-0.3.0Nick Mathewson
2017-11-27Handle NULL input to protover_compute_for_old_tor()Nick Mathewson
Fixes bug 24245; bugfix on 0.2.9.4-alpha. TROVE-2017-010.
2017-11-21re-run ./scripts/maint/annotate_ifdef_directivesNick Mathewson
2017-11-13Add corresponding rust-c coupling comments to CNick Mathewson
2017-11-09Merge branch 'ticket20895'Nick Mathewson
2017-10-27rust implementation of protoverChelsea Holland Komlo
2017-09-11Add a function to check for support for "protocol X or later"Nick Mathewson
Also, add unit tests for this new function and for the regular "does this list include support for protocol X" code.
2017-05-15Dircache protocol version 2 adds support for diffsNick Mathewson
2017-03-15Run the copyright update script.Nick Mathewson
2017-02-14protover: Add new version for prop224 for HSIntro/HSDirDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2016-12-02Merge branch 'maint-0.2.9'Nick Mathewson