summaryrefslogtreecommitdiff
path: root/src/common
AgeCommit message (Collapse)Author
2017-03-15Run the copyright update script.Nick Mathewson
2017-03-15Merge branch 'bug21540_029_v2'Nick Mathewson
2017-03-15Correctly handle fd-drain errors on windows workqueuesNick Mathewson
Windows doesn't let you check the socket error for a socket with WSAGetLastError() and getsockopt(SO_ERROR). But getsockopt(SO_ERROR) clears the error on the socket, so you can't call it more than once per error. When we introduced recv_ni to help drain alert sockets, back in 0.2.6.3-alpha, we had the failure path for recv_ni call getsockopt() twice, though: once to check for EINTR and one to check for EAGAIN. Of course, we never got the eagain, so we treated it as an error, and warned about: "No error". The fix here is to have these functions return -errno on failure. Fixes bug 21540; bugfix on 0.2.6.3-alpha.
2017-03-14Create logfiles in mode 0640Nick Mathewson
Patch from toralf; closes 21729.
2017-03-13Add a null statement to prevent some SMARTLIST_FOREACH() bugs.Nick Mathewson
So we require that SMARTLIST_FOREACH_END() have the name of the loop variable in it. But right now the only enforcement for that is to clear the variable at the end of the loop, which is really not sufficient: I spent 45 minutes earlier today debugging an issue where I had said: SMARTLIST_FOREACH_BEGIN(spool, spooled_resource_t *, spooled) { ... } SMARTLIST_FOREACH_END(spool); This patch makes it so that ONLY loop variables can be used, by referring to the _sl_idx variable.
2017-03-09Remove fgets() compatbility function and related tests.Alexander Færøy
This patch removes the `tor_fgets()` wrapper around `fgets(3)` since it is no longer needed. The function was created due to inconsistency between the returned values of `fgets(3)` on different versions of Unix when using `fgets(3)` on non-blocking file descriptors, but with the recent changes in bug #21654 we switch from unbuffered to direct I/O on non-blocking file descriptors in our utility module. We continue to use `fgets(3)` directly in the geoip and dirserv module since this usage is considered safe. This patch also removes the test-case that was created to detect differences in the implementation of `fgets(3)` as well as the changes file since these changes was not included in any releases yet. See: https://bugs.torproject.org/21654
2017-03-09Use less-than instead of not-equal-to for comparison in read loops.Alexander Færøy
This patch changes a number of read loops in the util module to use less-than comparison instead of not-equal-to comparison. We do this in the case that we have a bug elsewhere that might cause `numread` to become larger than `count` and thus become an infinite loop.
2017-03-09Remove buffered I/O stream usage in process_handle_t.Alexander Færøy
This patch removes the buffered I/O stream usage in process_handle_t and its related utility functions. This simplifies the code and avoids racy code where we used buffered I/O on non-blocking file descriptors. See: https://bugs.torproject.org/21654
2017-03-08Use read(2) instead of fgets(3) when reading process output.Alexander Færøy
This patch modifies `tor_read_all_handle()` to use read(2) instead of fgets(3) when reading the stdout from the child process. This should eliminate the race condition that can be triggered in the 'slow/util/*' tests on slower machines running OpenBSD, FreeBSD and HardenedBSD. See: https://bugs.torproject.org/21654
2017-03-01Use tor_fgets() instead of fgets().Alexander Færøy
This patch changes our use of fgets() to tor_fgets() for more consistent error handling across different versions of the C library.
2017-03-01Add compatibility function for fgets(3).Alexander Færøy
This patch adds the `tor_fgets()` function to our compatibility layer. `tor_fgets()` adds an additional check for whether the error-bit have been enabled for the given file stream, if that is the case and `errno` is set to `EAGAIN` we make sure that we always return NULL. Unfortunately `fgets(3)` behaves differently on different versions of the C library. See: https://bugs.torproject.org/21416 See: https://bugs.torproject.org/20988
2017-02-27Merge branch 'disable_memory_sentinels_squashed'Nick Mathewson
2017-02-27Code to disable memory sentinels for fuzzingNick Mathewson
This feature makes it possible to turn off memory sentinels (like those used for safety in buffers.c and memarea.c) when fuzzing, so that we can catch bugs that they would otherwise prevent.
2017-02-27Merge branch 'bug21420_029_squashed' into maint-0.3.0Nick Mathewson
2017-02-27Revise the logic for picking the start time for link certsNick Mathewson
Since 0.2.4.11-alpha (in 0196647970a91d) we've tried to randomize the start time to up to some time in the past. But unfortunately we allowed the start time to be in the future as well, which isn't really legit. The new behavior lets the start time be be up to MAX(cert_lifetime-2days, 0) in the past, but never in the future. Fixes bug 21420; bugfix on 0.2.4.11-alpha.
2017-02-14Merge branch 'bug20894_029_v3'Nick Mathewson
2017-02-14Don't atoi off the end of a buffer chunk.Nick Mathewson
Fixes bug 20894; bugfix on 0.2.0.16-alpha. We already applied a workaround for this as 20834, so no need to freak out (unless you didn't apply 20384 yet).
2017-02-03Use the standard OpenBSD preprocessor definitioncypherpunks
2017-01-30Merge branch 'combined-fuzzing-v4'Nick Mathewson
2017-01-30Make a bunch of signature/digest-checking functions mockableNick Mathewson
2017-01-27Merge branches 'server_ciphers' and 'ciphers.inc'Nick Mathewson
2017-01-25Fix a signed/unsigned comparison warningNick Mathewson
2017-01-25Fail if file is too large to mmap.junglefowl
If tor_mmap_file is called with a file which is larger than SIZE_MAX, only a small part of the file will be memory-mapped due to integer truncation. This can only realistically happen on 32 bit architectures with large file support.
2017-01-24Re-run gen_server_ciphersNick Mathewson
2017-01-24Regenerate ciphers.incNick Mathewson
2017-01-11comment fix from pastlyNick Mathewson
2017-01-11Merge branch 'bug20569_030_02_squashed'Nick Mathewson
2017-01-11hs: Use AES-256 for v3 descriptorDavid Goulet
That key size is taken from proposal 224 thus specified in the protocol. Closes #20569 Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-01-11Merge remote-tracking branch 'public/ticket21037'Nick Mathewson
2017-01-03Make tor_addr_lookup() mockable.Nick Mathewson
2017-01-02Make ed25519_fmt() log 0-valued keys more nicely.Nick Mathewson
Because <unset> makes more sense than AAAAAAAAAAAAAAAAAAA... (I have indeed verified that ed25519_fmt() is only used for logging. This patch also clarifies the intention that ed25519_fmt() is only for logging. Closes ticket 21037.
2016-12-23Note memset as redundant; see 20764.Nick Mathewson
2016-12-23This is no longer inline.Nick Mathewson
2016-12-23Fix unreachable heap corruption in base64_decode()Hans Jerry Illikainen
Give size_mul_check() external linkage and use it in base64_decode() to avoid a potential integer wrap. Closes #19222
2016-12-23Merge branch 'maint-0.2.9'Nick Mathewson
2016-12-21Withstand failures in CLOCK_MONOTONIC_COARSENick Mathewson
This came up on #21035, where somebody tried to build on a linux system with kernel headers including CLOCK_MONOTONIC_COARSE, then run on a kernel that didn't support it. I've adopted a belt-and-suspenders approach here: we detect failures at initialization time, and we also detect (loudly) failures later on. Fixes bug 21035; bugfix on 0.2.9.1-alpha when we started using monotonic time.
2016-12-18fix typos and trivial syntax problemsRoger Dingledine
2016-12-18clarify debug-level log while initializing entropyRoger Dingledine
I got confused when I saw my Tor saying it was opening a file that doesn't exist. It turns out it isn't opening it, it's just calling open() on it and then moving on when it's not there.
2016-12-16Revert "Stop checking whether environ is declared."Nick Mathewson
This reverts commit 954eeda619a59dae76144ad69967f0ed7341b564. Apparently, OpenBSD is what expects you to declare environ yourself. So 19142 is a wontfix.
2016-12-16Merge branch 'prop271_030_v1_squashed'Nick Mathewson
2016-12-16Lay down some infrastructure for bridges in the New Guard Order.Nick Mathewson
This includes: * making bridge_info_t exposed but opaque * allowing guards where we don't know an identity * making it possible to learn the identity of a guard * creating a guard that lacks a node_t * remembering a guard's address and port. * Looking up a guard by address and port. * Only enforcing the rule that we need a live consensus to update the "listed" status for guards when we are not using bridges.
2016-12-16Merge remote-tracking branch 'public/ticket19142'Nick Mathewson
2016-12-14Merge branch 'dgoulet_ticket19043_030_03_squashed'Nick Mathewson
2016-12-14crypto: Change crypto_mac_sha3_256 to use the key length in the constructionDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2016-12-14prop224: Add unittests handling v3 ESTABLISH_INTRO cells.George Kadianakis
Test for both v2 and v3 ESTABLISH_INTRO handling.
2016-12-14prop224 prepwork: Introduce HMAC-SHA3 function.George Kadianakis
2016-12-12Stop checking whether environ is declared.Nick Mathewson
There seems to be pretty good evidence that it's always declared, and that checking for it is pointless. Closes ticket 19142.
2016-12-12Merge remote-tracking branch 'jryans/log-severity'Nick Mathewson
2016-12-08whitespace cleanupsNick Mathewson
2016-12-08Merge branch 'feature15056_v1_squashed'Nick Mathewson