Nick Mathewson
d8893bc93c
Merge remote-tracking branch 'isis/bug23881_r1'
2018-03-19 17:20:37 -04:00
Nick Mathewson
bda1dfb9e0
Merge remote-tracking branch 'isis/bug25185'
2018-02-15 20:35:30 -05:00
Nick Mathewson
5af03c1ef3
rust protover: match the C implementation on empty-str cases
...
Empty versions lists are permitted; empty keywords are not.
2018-02-15 19:08:52 -05:00
Nick Mathewson
b58a2febe3
Forbid u32::MAX as a protover range element in rust
...
Part of the 25249 fix to make rust match the C.
2018-02-15 19:07:38 -05:00
Nick Mathewson
f69510ba4b
Rust protover compat: forbid more than MAX_VERSIONS_TO_EXPAND in a range
...
Also correct MAX_VERSIONS_TO_EXPAND to match the C.
NOTE that this patch leads to incorrect behavior: the C code allows
huge ranges; it just doesn't allow votes on them (currently). For
full compatibility, we'll need to make the rust code store ranges as
ranges natively, possibly using something like the range_map crate.
Still, this patch is smaller than a "proper" fix.
Fixes TROVE-2018-003.
2018-02-15 19:07:25 -05:00
Isis Lovecruft
6c77593a57
rust: Use tor_util::strings utils for protover_compute_for_old_tor.
2018-02-10 02:18:55 +00:00
Isis Lovecruft
3c4e006e7e
rust: Use tor_util::strings utils for protover_get_supported_protocols.
2018-02-10 02:15:06 +00:00
Isis Lovecruft
45c59eff6c
rust: Replace two unwrap()
s in FFI code with unwrap_or()
s.
2018-02-10 01:21:31 +00:00
Nick Mathewson
d9826b0a30
Merge remote-tracking branch 'frewsxcv/frewsxcv-protover'
2018-02-08 17:45:17 -05:00
Nick Mathewson
af049657eb
Stop claiming that compute_for_old_tor() returns pairs
2018-02-08 17:36:08 -05:00
Nick Mathewson
d8307cb0e9
Remove new unsafe {} use.
...
Rationale: this helps for performance only, but we don't actually
have any reason to think that the checks here are
performance-critical. Let's not normalize the use of unsafe {}.
2018-02-08 17:29:50 -05:00
Isis Lovecruft
b85436c596
protover: Fix memleak in Rust impl of protover_compute_for_old_tor.
...
* FIXES #25127 : https://bugs.torproject.org/25127
* ADDS a new module to the Rust tor_util crate for small utilities
for working with static strings between languages.
* CHANGES the return type of protover_compute_for_old_tor to point to
immutable data.
* CHANGES the code from the previous commit to use the new static
string utilities.
2018-02-07 22:51:58 +00:00
Isis Lovecruft
7ea9e080c5
protover: Fix memleak in Rust implementation.
...
* FIXES #25127 : https://bugs.torproject.org/25127 .
2018-02-06 02:56:16 +00:00
teor
b67f010678
Add Link protocol version 5 to the supported protocols list in protover.rs
...
And fix the unsupported protover example so it uses a Link protover much
higher than 5.
Part of #25070 , bugfix on 0.3.3.1-alpha, which introduced the protover crate.
2018-01-30 02:18:57 +11:00
Corey Farwell
124caf28e6
Wrap types in protover.rs.
...
https://trac.torproject.org/projects/tor/ticket/24030
Introduce new wrapper types:
- `SupportedProtocols`
- `Versions`
Introduce a type alias:
- `Version` (`u32`)
2018-01-29 07:30:51 -05:00
Chelsea Holland Komlo
d0184963f9
fixups from code review
2018-01-22 18:33:22 -05:00
Corey Farwell
2529319f68
[fixup] this might be an improvement?
2017-12-28 18:17:45 -08:00
Corey Farwell
8ba5805bae
Remove unneeded heap allocations in protover.rs.
2017-12-27 22:05:06 -08:00
Chelsea Holland Komlo
71a5376141
move macro body to inline rust function
2017-12-21 15:29:33 -05:00
Chelsea Holland Komlo
cd8bcacfe1
cargo fmt fixes
2017-12-21 15:29:33 -05:00
Chelsea Holland Komlo
3dfe8e6522
add minimal rust module for logging to tor's logger
...
Allows an optional no-op for testing purposes
2017-12-21 15:29:33 -05:00
Chelsea Holland Komlo
1c50331b9a
annotate where C and Rust need to stay in sync
2017-11-11 23:19:34 -05:00
Nick Mathewson
039a776367
slight improvement to rust idiomicity
2017-11-09 09:48:52 -05:00
Nick Mathewson
c80bb04542
Rust implementation of protocol_list_supports_protocol_or_later()
2017-11-09 09:42:09 -05:00
Nick Mathewson
69502942b0
[rust] Avoid a clone in contract_protocol_list()
2017-10-27 13:02:14 -04:00
Nick Mathewson
2ca8fcb892
Add missing copyright/license statements on all .rs files
...
(Yes, I have Chelsea's permission.)
2017-10-27 10:02:08 -04:00
Chelsea Holland Komlo
6be75bd61d
cargo fmt; fix line length warnings
2017-10-27 10:02:08 -04:00
Chelsea Holland Komlo
90daad999e
remove experimental rust features
...
allow unsafe on function that calls C
2017-10-27 10:02:08 -04:00
Chelsea Holland Komlo
d14a83f74f
remove unneeded dependencies, remove types where unnecessary
2017-10-27 10:02:08 -04:00
Chelsea Holland Komlo
be583a34a3
use tor allocator for string allocation in rust
2017-10-27 10:02:08 -04:00
Chelsea Holland Komlo
d1820c1516
rust implementation of protover
2017-10-27 10:02:08 -04:00