aboutsummaryrefslogtreecommitdiff
path: root/src/lib
AgeCommit message (Collapse)Author
2020-08-11Improved documentation and comments #25140Daniel Pinto
2020-07-15Add support for patterns on %include #25140Daniel Pinto
Also adds generic tor_glob function to expand globs.
2020-07-14Merge remote-tracking branch 'tor-gitlab/mr/50'Nick Mathewson
2020-07-14Update docstring for read_file_to_str() on stripping of CR characters.Alexander Færøy
See: https://bugs.torproject.org/tpo/core/tor/33781
2020-07-14Strip '\r' characters when reading text files on Unix.Alexander Færøy
This patch ensures that we strip "\r" characters on both Windows as well as Unix when we read text files. This should prevent the issue where some Tor state files have been moved from a Windows machine, and thus contains CRLF line ending, to a Unix machine where only \n is needed. We add a test-case to ensure that we handle this properly on all our platforms. See: https://bugs.torproject.org/tpo/core/tor/33781
2020-07-14Merge remote-tracking branch 'tor-gitlab/merge-requests/48'Alexander Færøy
2020-07-14Merge branch 'ticket40033_045_01_squashed'Nick Mathewson
2020-07-14Rename blacklist and whitelist wordingDavid Goulet
Closes #40033 Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-14Merge branch 'maint-0.4.4'Alexander Færøy
2020-07-14Merge remote-tracking branch 'tor-gitlab/merge-requests/43' into maint-0.4.4Alexander Færøy
2020-07-14Merge branch 'tor-gitlab/mr/47'David Goulet
2020-07-14addr: Use tor_addr_t instead of uint32_t for IPv4David Goulet
This changes a LOT of code but in the end, behavior is the same. Unfortunately, many functions had to be changed to accomodate but in majority of cases, to become simpler. Functions are also removed specifically those that were there to convert an IPv4 as a host format to a tor_addr_t. Those are not needed anymore. The IPv4 address field has been standardized to "ipv4_addr", the ORPort to "ipv4_orport" (currently IPv6 uses ipv6_orport) and DirPort to "ipv4_dirport". This is related to Sponsor 55 work that adds IPv6 support for relays and this work is needed in order to have a common interface between IPv4 and IPv6. Closes #40043. Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-14doc: Move manpages into doc/man/David Goulet
Closes #40044 Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-13Merge branch 'maint-0.4.4'Nick Mathewson
2020-07-13Bug 31812: Change http URL's to httpsJeremyRand
2020-07-10NSS: Tell NSS that our SSL sockets are nonblocking.Nick Mathewson
Closes ticket 40035.
2020-07-10Merge remote-tracking branch 'tor-gitlab/mr/29'Nick Mathewson
2020-07-09Merge branch 'maint-0.4.4'Nick Mathewson
2020-07-09Merge branch 'maint-0.4.3' into maint-0.4.4Nick Mathewson
2020-07-09Merge branch 'maint-0.4.2' into maint-0.4.3Nick Mathewson
2020-07-09Merge branch 'maint-0.3.5' into maint-0.4.2Nick Mathewson
2020-07-09Merge branch 'trove_2020_001_035' into maint-0.3.5Nick Mathewson
2020-07-08trace: Emit a warning if tracing is built inDavid Goulet
Built in tracing should _not_ be run if it was not set on purpose. Warn as loud as we can in order to inform the user that they are running a version with tracing capabilities built in. This commit also adds a subsys stub because utlimately the logging will happen in the init phase but because the default log file is not set in the sys_logging init function, the stub is not useful for now. Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-08trace: Helper macro to disambiguate identifiersDavid Goulet
In order to disambiguate the subsystem and event_name identifiers in the tor_trace() macro, add TR_SUBSYS() and TR_EV() which help to identify the parameters of tor_trace() explicitly. Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-08trace: Comments and configure fixDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-08trace: Add LTTng-UST interface supportDavid Goulet
No probes at this point. They are per subsystem and thus in later commits. Part of #32910
2020-07-08trace: Add USDT probes generation supportDavid Goulet
This commit adds both configure options and probe generation for tracepoints. Part of #32910 Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-08trace: Hook lib/trace as a subsystemDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-08trace: Better structure lib/trace and configure optionsDavid Goulet
In the next commits, we'll add more tracing options for instrumentation and specific tracer. This rename follows a more meaningful naming standard. It also adds a catch all "HAVE_TRACING" define that indicate in the code that we have tracing enabled. Part of #32910 Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-08Merge branch 'maint-0.4.2' into maint-0.4.3Alexander Færøy
2020-07-08Merge branch 'maint-0.4.4'Alexander Færøy
2020-07-08Merge branch 'maint-0.4.3' into maint-0.4.4Alexander Færøy
2020-07-08Merge branch 'maint-0.3.5' into maint-0.4.2Alexander Færøy
2020-07-07Resolve a compiler warning from a 32-bit signed/unsigned comparisonNick Mathewson
This warning only affects platforms (like win32) with 32-bit time_t. Fixes bug 40028; bugfix on 0.3.2.8-rc.
2020-07-06Use ((x + 7) >> 3) instead of (x >> 3) when converting from bits to bytes.Alexander Færøy
This patch changes our bits-to-bytes conversion logic in the NSS implementation of `tor_tls_cert_matches_key()` from using (x >> 3) to ((x + 7) >> 3) since DER bit-strings are allowed to contain a number of bits that is not a multiple of 8. Additionally, we add a comment on why we cannot use the `DER_ConvertBitString()` macro from NSS, as we would potentially apply the bits-to-bytes conversion logic twice, which would lead to an insignificant amount of bytes being compared in `SECITEM_ItemsAreEqual()` and thus turn the logic into being a prefix match instead of a full match. The `DER_ConvertBitString()` macro is defined in NSS as: /* ** Macro to convert der decoded bit string into a decoded octet ** string. All it needs to do is fiddle with the length code. */ #define DER_ConvertBitString(item) \ { \ (item)->len = ((item)->len + 7) >> 3; \ } Thanks to Taylor Yu for spotting this problem. This patch is part of the fix for TROVE-2020-001. See: https://bugs.torproject.org/33119
2020-07-06Add constness to length variables in `tor_tls_cert_matches_key`.Alexander Færøy
We add constness to `peer_info_orig_len` and `cert_info_orig_len` in `tor_tls_cert_matches_key` to ensure that we don't accidentally alter the variables. This patch is part of the fix for TROVE-2020-001. See: https://bugs.torproject.org/33119
2020-07-06Fix out-of-bound memory read in `tor_tls_cert_matches_key()` for NSS.Alexander Færøy
This patch fixes an out-of-bound memory read in `tor_tls_cert_matches_key()` when Tor is compiled to use Mozilla's NSS instead of OpenSSL. The NSS library stores some length fields in bits instead of bytes, but the comparison function found in `SECITEM_ItemsAreEqual()` needs the length to be encoded in bytes. This means that for a 140-byte, DER-encoded, SubjectPublicKeyInfo struct (with a 1024-bit RSA public key in it), we would ask `SECITEM_ItemsAreEqual()` to compare the first 1120 bytes instead of 140 (140bytes * 8bits = 1120bits). This patch fixes the issue by converting from bits to bytes before calling `SECITEM_ItemsAreEqual()` and convert the `len`-fields back to bits before we leave the function. This patch is part of the fix for TROVE-2020-001. See: https://bugs.torproject.org/33119
2020-07-02Merge branch 'tor-github/pr/1968'David Goulet
2020-07-02Merge branch 'maint-0.4.4'Nick Mathewson
2020-07-02Merge branch 'ticket32622_044_squashed' into maint-0.4.4Nick Mathewson
2020-07-02Carry TLS error strings forward to controller when reporting them.Nick Mathewson
Now instead of saying "DONE, DONE" or "MISC, MISC" or "TLS_ERROR, TLS_ERROR", we can finally give a nice sensible "TLS_ERROR, wrong version number" which should help debug a great deal. Closes ticket 32622.
2020-07-02Add a convenience function to check for unspec address.Nick Mathewson
2020-07-01Merge branch 'maint-0.4.3' into maint-0.4.4George Kadianakis
2020-07-01Merge branch 'maint-0.4.4'George Kadianakis
2020-07-01Merge branch 'maint-0.4.2' into maint-0.4.3George Kadianakis
2020-07-01Merge branch 'maint-0.3.5' into maint-0.4.2George Kadianakis
2020-07-01Merge branch 'tor-github/pr/1766' into maint-0.3.5George Kadianakis
2020-06-30Merge branch 'tor-github/pr/1887' into maint-0.4.3Alexander Færøy
2020-06-30Merge branch 'maint-0.3.5' into maint-0.4.2Alexander Færøy
2020-06-30Merge branch 'tor-github/pr/1785' into maint-0.3.5Alexander Færøy