aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_hs_common.c
AgeCommit message (Collapse)Author
2023-02-10Extend blinding testvec with timeperiod test.Nick Mathewson
When I copied this to arti, I messed up and thought that the default time period was 1440 seconds for some weird testing reason. That led to confusion. This commit adds a test case that time period 1440 is May 20, 1973: now arti and c tor match!
2023-01-25Add a test vector for disaster SRV calculation.Nick Mathewson
2023-01-19Add more test-vectors for key blinding.Nick Mathewson
These are verified-as-correct against the current C implementation; adding them here gives us something to copy into Arti.
2021-10-19Merge branch 'ticket40476_045_01' into ticket40476_046_01David Goulet
2021-10-19test: Fix unit tests after disabling version 2David Goulet
Some tests were removed because they were testing something not usable anymore. Some tests remains to make sure that things are indeed disabled. Part of #40476 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-05-05Prepare for #40373: Re-introduce parsing for v2 onion addresses.George Kadianakis
Welcome back ONION_V2_HOSTNAME! :)
2021-03-12Update copyrights to 2021, using "make update-copyright"Nick Mathewson
2021-02-19hs-v2: Remove client supportDavid Goulet
Related to #40266 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-01-12Merge branch 'ticket40237_044_01' into ticket40237_045_01David Goulet
2021-01-12Merge branch 'ticket40237_043_01' into ticket40237_044_01David Goulet
2021-01-12Merge branch 'ticket40237_035_01' into ticket40237_043_01David Goulet
2021-01-12hs-v3: Require reasonably live consensusDavid Goulet
Some days before this commit, the network experienced a DDoS on the directory authorities that prevented them to generate a consensus for more than 5 hours straight. That in turn entirely disabled onion service v3, client and service side, due to the subsystem requiring a live consensus to function properly. We know require a reasonably live consensus which means that the HSv3 subsystem will to its job for using the best consensus tor can find. If the entire network is using an old consensus, than this should be alright. If the service happens to use a live consensus while a client is not, it should still work because the client will use the current SRV it sees which might be the previous SRV for the service for which it still publish descriptors for. If the service is using an old one and somehow can't get a new one while clients are on a new one, then reachability issues might arise. However, this is a situation we already have at the moment since the service will simply not work if it doesn't have a live consensus while a client has one. Fixes #40237 Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-11-12Fix typos.Samanta Navarro
Typos found with codespell. Please keep in mind that this should have impact on actual code and must be carefully evaluated: src/core/or/lttng_circuit.inc - ctf_enum_value("CONTROLER", CIRCUIT_PURPOSE_CONTROLLER) + ctf_enum_value("CONTROLLER", CIRCUIT_PURPOSE_CONTROLLER)
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-08socks: Returns 0xF6 only if BAD_HOSTNAMEGuinness
This commit modifies the behavior of `parse_extended_address` in such a way that if it fails, it will always return a `BAD_HOSTNAME` value, which is then used to return the 0xF6 extended error code. This way, in any case that is not a valid v2 address, we return the 0xF6 error code, which is the expected behavior. Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-02-24Rename voting_schedule_*() functions.Nick Mathewson
This is an automated commit, generated by this command: ./scripts/maint/rename_c_identifier.py \ voting_schedule_recalculate_timing dirauth_sched_recalculate_timing \ voting_schedule_get_start_of_next_interval voting_sched_get_start_of_interval_after \ voting_schedule_get_next_valid_after_time dirauth_sched_get_next_valid_after_time
2020-02-24Move voting_schedule.[ch] to src/feature/dirauth/Nick Mathewson
2020-01-21hs-v3: Implement hs_parse_address_no_log()David Goulet
The hs_parse_address() can not be used without an options_t object existing since on error it uses the escaped_safe_str() that looks at the options. This new function won't log and returns an error message in case of failure that can then be used to log. Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-01-08It's 2020. Update the copyright dates with "make update-copyright"Nick Mathewson
2019-11-18hs-v3: Set extended error if .onion is invalidDavid Goulet
In order to achieve this, the parse_extended_hostname() had to be refactored to return either success or failure and setting the hostname type in the given parameter. The reason for that is so it can detect invalid onion addresses that is having a ".onion", the right length but just not passing validation. That way, we can send back the prop304 ExtendedError "X'F1' Onion Service Descriptor Is Invalid" to notify the SOCKS connection of the invalid onion address. Part of #30382 Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-06-28Coverity: fix test issues with always-present 'service' var.Nick Mathewson
Coverity is worried that we check "service" at the end of these test functions, since it doesn't see any way to reach the cleanup code without having first dereferenced the variable. Removing the check would be unwise in this case: instead we add a tt_assert check before using "service" so that coverity thinks that the check is doing something useful. Bugfix on 0.3.2.1-alpha.
2019-05-16hs tests: explicitly free 'service' variable.Nick Mathewson
This should fix about 15 CID issues, where coverity can't tell that hs_free_all() frees the service we allocated.
2019-04-26Make nodelist_get_list() return a const pointer.Nick Mathewson
2019-01-16Bump copyright date to 2019Nick Mathewson
2019-01-16Bump copyright date to 2019.Nick Mathewson
2018-11-22Fix a comment typo in test_hs_common.cteor
2018-09-21Split directory.c code into several modulesNick Mathewson
Parts of this C file naturally belong in dircache, dirclient, and dircommon: so, move them there.
2018-09-07hs-v3: Encrypt the descriptor using a cookieSuphanat Chunhapanya
Previously, we encrypted the descriptor without the descriptor cookie. This commit, when the client auth is enabled, the descriptor cookie is always used. I also removed the code that is used to generate fake auth clients because it will not be used anymore. Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-07-17Merge branch 'bug25552_ope_squashed'Nick Mathewson
2018-07-17Fix time source bug in sr_state_get_start_time_of_current_protocol_run().George Kadianakis
The following bug was causing many issues for this branch in chutney: In sr_state_get_start_time_of_current_protocol_run() we were using the consensus valid-after to calculate beginning_of_current_round, but we were using time(NULL) to calculate the current_round slot. This was causing time sync issues when the consensus valid-after and time(NULL) were disagreeing on what the current round is. Our fix is to use the consensus valid-after in both places. This also means that we are not using 'now' (aka time(NULL)) anymore in that function, and hence we can remove that argument from the function (and its callers). I'll do this in the next commit so that we keep things separated. Furthermore, we fix a unittest that broke.
2018-07-17Fix up some unittests by being more careful with the local time.George Kadianakis
Now that the rev counter depends on the local time, we need to be more careful in the unittests. Some unittests were breaking because they were using consensus values from 1985, but they were not updating the local time appropriately. That was causing the OPE module to complain that it was trying to encrypt insanely large values.
2018-07-05Fix every include path changed in the previous commit (automated)Nick Mathewson
I am very glad to have written this script.
2018-07-05Remove util.hNick Mathewson
Inline its contents (which were all includes) into or.h, and some of its contents into other places that didn't include or.h at all.
2018-07-01Extract or_state_t to its own header.Nick Mathewson
Fewer modules needed this than I had expected.
2018-07-01Minimize headers that include crypto_formats and x25519 stuffNick Mathewson
2018-06-29Merge branch 'maint-0.3.4'Nick Mathewson
2018-06-29Merge branch 'maint-0.3.3' into maint-0.3.4Nick Mathewson
2018-06-29Merge branch 'maint-0.3.2' into maint-0.3.3Nick Mathewson
2018-06-23Fix memory leak in helper_add_hsdir_to_networkstatus().Alexander Færøy
This patch fixes a memory leak in helper_add_hsdir_to_networkstatus() where the rs object might not get properly freed. See: Coverity CID 1437427.
2018-06-21Rectify include paths (automated)Nick Mathewson
2018-06-20Run rectify_include_paths.pyNick Mathewson
2018-06-20Update copyrights to 2018.Nick Mathewson
2018-06-15Extract routerinfo_t into its own header.Nick Mathewson
I was expecting this to be much worse.
2018-06-15Extract microdesc_t into its own header.Nick Mathewson
2018-06-15Extract routerstatus_t into its own header.Nick Mathewson
2018-06-15Extract networkstatus_t and ..sr_info_t into their own headersNick Mathewson
2018-06-15Extract node_t into its own header.Nick Mathewson
2018-05-03Merge remote-tracking branch 'isis/bug24660_r1'Nick Mathewson
2018-05-02Make hs_get_responsible_hsdirs() deterministic.Nick Mathewson
This test was using the current time to pick the time period number, and a randomly generated hs key. Therefore, it sometimes picked an index that would wrap around the example dht, and sometimes would not. The fix here is just to fix the time period and the public key. Fixes bug 25997; bugfix on 0.3.2.1-alpha.
2018-05-01vote: Move dirvote_recalculate_timing() to voting_schedule.cDavid Goulet
By doing so, it is renamed to voting_schedule_recalculate_timing(). This required a lot of changes to include voting_schedule.h everywhere that this function was used. This effectively now makes voting_schedule.{c|h} not include dirauth/dirvote.h for that symbol and thus no dependency on the dirauth module anymore. Signed-off-by: David Goulet <dgoulet@torproject.org>