summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2020-07-09bump to 0.3.5.11Nick Mathewson
2020-07-09Merge branch 'trove_2020_001_035' into maint-0.3.5Nick Mathewson
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-06Run `tor_tls_cert_matches_key()` Test Suite with both OpenSSL and NSS.Alexander Færøy
This patch lifts the `tor_tls_cert_matches_key()` tests out of the OpenSSL specific TLS test suite and moves it into the generic TLS test suite that is executed for both OpenSSL and NSS. This patch is largely a code movement, but we had to rewrite parts of the test to avoid using OpenSSL specific data-types (such as `X509 *`) and replace it with the generic Tor abstraction type (`tor_x509_cert_impl_t *`). This patch is part of the fix for TROVE-2020-001. See: https://bugs.torproject.org/33119
2020-06-30Downgrade "Bug: No entry found in extrainfo map" message.Nick Mathewson
This is not actually a bug! It can happen for a bunch of reasons, which all boil down to "trying to add an extrainfo for which we no longer have the corresponding routerinfo". Fixes #16016; bugfix on 0.2.6.3-alpha.
2020-06-30Merge branch 'tor-github/pr/1909' into maint-0.3.5Alexander Færøy
2020-06-30Merge branch 'tor-github/pr/1793' into maint-0.3.5Alexander Færøy
2020-06-30Merge branch 'tor-github/pr/1785' into maint-0.3.5Alexander 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/1725/head' into maint-0.3.5Nick Mathewson
2020-05-30Preemptive circs should work with UseEntryGuards 0Roger Dingledine
Resume being willing to use preemptively-built circuits when UseEntryGuards is set to 0. We accidentally disabled this feature with that config setting (in our fix for #24469), leading to slower load times. Fixes bug 34303; bugfix on 0.3.3.2-alpha.
2020-05-06Use __attribute__((fallthrough)) rather than magic GCC comments.Nick Mathewson
GCC added an implicit-fallthrough warning a while back, where it would complain if you had a nontrivial "case:" block that didn't end with break, return, or something like that. Clang recently added the same thing. GCC, however, would let you annotate a fall-through as intended by any of various magic "/* fall through */" comments. Clang, however, only seems to like "__attribute__((fallthrough))". Fortunately, GCC accepts that too. A previous commit in this branch defined a FALLTHROUGH macro to do the right thing if GNUC is defined; here we replace all of our "fall through" comments with uses of that macro. This is an automated commit, made with the following perl one-liner: #!/usr/bin/perl -i -p s#/\* *falls? ?thr.*?\*/#FALLTHROUGH;#i;
2020-05-06Remove an incorrect "Fall through" comment.Nick Mathewson
2020-05-06address.c: add a single (harmless) missing break;Nick Mathewson
2020-05-06include compat_compiler for ed25519_donnaNick Mathewson
2020-05-06Replace some "fall through" comments not at the end of a case.Nick Mathewson
2020-05-06Replace a "fall through" comment that was outside a switch.Nick Mathewson
2020-05-06Add a fallthrough macro.Nick Mathewson
This macro defers to __attribute__((fallthrough)) on GCC (and clang). Previously we had been using GCC's magic /* fallthrough */ comments, but clang very sensibly doesn't accept those. Since not all compiler recognize it, we only define it when our configure script detects that it works. Part of a fix for 34078.
2020-04-09Merge remote-tracking branch 'tor-github/pr/1784' into maint-0.3.5teor
2020-03-19Add a TOR_SKIP_TESTCASES environment variable for suppressing tests.Nick Mathewson
For example, "TOR_SKIP_TESTCASES=crypto/.. ./src/test/test" will run the tests and suppress all the "crypto/" tests. You could get the same effect by running "./src/test/test :crypto/..", but that can be harder to arrange from CI. Part of a fix/workaround for 33643.
2020-03-18Bump version to 0.3.5.10-devNick Mathewson
2020-03-18Port rsa_private_key_too_long() to work on OpenSSL 1.1.0.Nick Mathewson
2020-03-17Merge branch 'trove_2020_002_035' into maint-0.3.5Nick Mathewson
2020-03-17Fix TROVE-2020-003.George Kadianakis
Given that ed25519 public key validity checks are usually not needed and (so far) they are only necessary for onion addesses in the Tor protocol, we decided to fix this specific bug instance without modifying the rest of the codebase (see below for other fix approaches). In our minimal fix we check that the pubkey in hs_service_add_ephemeral() is valid and error out otherwise.
2020-03-17Trivial bugfixes found during TROVE investigation.George Kadianakis
2020-03-17Use >= consistently with max_bits.Nick Mathewson
2020-03-17Add off-by-one checks for key length.Nick Mathewson
2020-03-17Extract key length check into a new function, and check more fields.Nick Mathewson
In the openssl that I have, it should be safe to only check the size of n. But if I'm wrong, or if other openssls work differently, we should check whether any of the fields are too large. Issue spotted by Teor.
2020-03-14Fix memory leak in crypto_pk_asn1_decode_private.Nick Mathewson
(Deep, deep thanks to Taylor for reminding me to test this!)
2020-03-14Add a test for crypto_pk_asn1_decode_private maxbits.Nick Mathewson
2020-03-14Revise TROVE-2020-002 fix to work on older OpenSSL versions.Nick Mathewson
Although OpenSSL before 1.1.1 is no longer supported, it's possible that somebody is still using it with 0.3.5, so we probably shouldn't break it with this fix.
2020-03-13Bump to 0.3.5.10Nick Mathewson
2020-03-13Merge remote-tracking branch 'tor-github/pr/1693/head' into maint-0.3.5Nick Mathewson
2020-03-12Fix unit tests that look at contactinfo logs.Nick Mathewson
2020-03-12config: Warn if ContactInfo is not setDavid Goulet
Closes #33361 Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-03-11pem_decode(): Tolerate CRLF line endingsNick Mathewson
Fixes bug 33032; bugfix on 0.3.5.1-alpha when we introduced our own PEM decoder.
2020-03-10dos: Pass transport name on new client connectionDavid Goulet
For a bridge configured with a pluggable transport, the transport name is used, with the IP address, for the GeoIP client cache entry. However, the DoS subsystem was not aware of it and always passing NULL when doing a lookup into the GeoIP cache. This resulted in bridges with a PT are never able to apply DoS defenses for newly created connections. Fixes #33491 Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-02-12hs-v3: Remove BUG() that can occur normallyDavid Goulet
Fixes #28992 Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-02-12Lowercase the BridgeDistribution value from torrc in descriptors.Alexander Færøy
This patch ensures that we always lowercase the BridgeDistribution from torrc in descriptors before submitting it. See: https://bugs.torproject.org/32753
2020-02-10Fix a Rust compilation warning; resolve bug 33212.Nick Mathewson
2020-02-05When parsing tokens, reject early on spurious keys.Nick Mathewson
2020-02-05When parsing, reject >1024-bit RSA private keys sooner.Nick Mathewson
Private-key validation is fairly expensive for long keys in openssl, so we need to avoid it sooner.
2020-01-30Merge remote-tracking branch 'tor-github/pr/1614' into maint-0.3.5teor
2020-01-29Change BUG() messages in buf_flush_to_tls() to IF_BUG_ONCE()Nick Mathewson
We introduced these BUG() checks in b0ddaac07428a06 to prevent a recurrence of bug 23690. But there's a report of the BUG() message getting triggered and filling up the disk. Let's change it to IF_BUG_ONCE(). Fixes bug 33093; bugfix on 0.3.2.2-alpha.
2020-01-16Merge remote-tracking branch 'tor-github/pr/1513' into maint-0.3.5teor
2020-01-06When initializing pthreads, always set the main thread.Nick Mathewson
Fixes bug 32884. This is a bugfix on 0.3.3.1-alpha, when we started allowing restart-in-process with tor_api.h.
2019-12-17Correct how we use libseccompPeter Gerber
This fixes a startup crash with libseccomp v2.4.0 if Sandbox is set to 1.