aboutsummaryrefslogtreecommitdiff
path: root/src/lib
AgeCommit message (Collapse)Author
2020-08-11Merge remote-tracking branch 'tor-gitlab/mr/102' into maint-0.4.4George Kadianakis
2020-08-03Add a tor_str_wipe_and_free() function.Nick Mathewson
Frequently we want to do if (s) { memwipe(s, 0, sizeof(s)); tor_free(s); } and it's good to have a way to do this concisely.
2020-07-30Merge branch 'bug40076_043' into bug40076_044Nick Mathewson
2020-07-30Merge branch 'bug40076_042' into bug40076_043Nick Mathewson
2020-07-30Merge branch 'maint-0.4.2' into bug40076_042Nick Mathewson
2020-07-30Fix a bug in buf_move_all() when the input buffer is empty.Nick Mathewson
We found this in #40076, after we started using buf_move_all() in more places. Fixes bug #40076; bugfix on 0.3.3.1-alpha. As far as I know, the crash only affects master, but I think this warrants a backport, "just in case".
2020-07-29Merge branch 'maint-0.4.2' into maint-0.4.3Nick Mathewson
2020-07-29Merge branch 'maint-0.3.5' into maint-0.4.2Nick Mathewson
2020-07-29Merge remote-tracking branch 'tor-gitlab/mr/68' into maint-0.4.4Nick Mathewson
2020-07-29Merge remote-tracking branch 'tor-gitlab/mr/85' into maint-0.4.4Alexander Færøy
2020-07-29Fix startup crash with seccomp sandbox enabled #40072Daniel Pinto
Fix crash introduced in #40020. On startup, tor calls check_private_dir on the data and key directories. This function uses open instead of opendir on the received directory. Data and key directoryes are only opened here, so the seccomp rule added should be for open instead of opendir, despite the fact that they are directories.
2020-07-28Use _lseeki64() on windows.Nick Mathewson
Fixes bug 31036; bugfix on 0.2.1.8-alpha when we moved the logging system to use posix fds.
2020-07-21Merge remote-tracking branch 'tor-gitlab/mr/68' into maint-0.4.4Nick Mathewson
2020-07-21Merge remote-tracking branch 'tor-gitlab/mr/67' into maint-0.4.4Nick Mathewson
2020-07-20Fix seccomp sandbox rules for openat #27315Daniel Pinto
The need for casting negative syscall arguments depends on the glibc version. This affects the rules for the openat syscall which uses the constant AT_FDCWD that is defined as a negative number. This commit adds logic to only apply the cast when necessary, on glibc versions from 2.27 onwards.
2020-07-20Fix seccomp sandbox rules for opening directories #40020Daniel Pinto
Different versions of glibc use either open or openat for the opendir function. This commit adds logic to use the correct rule for each glibc version, namely: - Until 2.14 open is used - From 2.15 to to 2.21 openat is used - From 2.22 to 2.26 open is used - From 2.27 onwards openat is used
2020-07-20Fix seccomp sandbox rules for openat #27315Daniel Pinto
The need for casting negative syscall arguments depends on the glibc version. This affects the rules for the openat syscall which uses the constant AT_FDCWD that is defined as a negative number. This commit adds logic to only apply the cast when necessary, on glibc versions from 2.27 onwards.
2020-07-14Merge remote-tracking branch 'tor-gitlab/merge-requests/43' into maint-0.4.4Alexander Færøy
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-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 'maint-0.4.3' into maint-0.4.4Nick Mathewson
2020-07-09Merge branch 'trove_2020_001_035' into maint-0.3.5Nick Mathewson
2020-07-08Merge branch 'maint-0.4.2' into maint-0.4.3Alexander 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 '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-01Merge branch 'maint-0.4.3' into maint-0.4.4George 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
2020-06-30Merge branch 'maint-0.3.5' into maint-0.4.2Alexander Færøy
2020-06-30Merge remote-tracking branch 'nickm-github/bug32884_035' into maint-0.3.5Alexander Færøy
2020-06-29Merge remote-tracking branch 'tor-github/pr/1697/head' into maint-0.4.2Nick Mathewson
2020-06-29Merge remote-tracking branch 'tor-github/pr/1722/head' into maint-0.4.2Nick Mathewson
2020-06-23Merge branch 'ticket34382' into maint-0.4.4Nick Mathewson
2020-06-05Merge remote-tracking branch 'tor-github/pr/1902/head'Nick Mathewson
2020-06-05Fix some checks of tor_inet_ntoa() return valuerl1987
Also, fix a format string.
2020-06-04sandbox: Do not require M_SYSCALL.Nick Mathewson
M_SYSCALL is used to report information about a sandbox violation, but when we don't have a definition for it, it still makes sense to compile. Closes ticket 34382.
2020-06-04Merge remote-tracking branch 'tor-github/pr/1910/head'Nick Mathewson
2020-06-04config: Styling fix + use fmt_addr()c
Conform to C99 as suggested by nickm on #32888 and use fmt_addr() rather than tor_addr_to_str_dup()