aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_hs_cache.c
AgeCommit message (Collapse)Author
2020-02-24Merge remote-tracking branch 'tor-github/pr/1685/head'Nick Mathewson
2020-02-06hs-v3: Remove descriptor when we remove client authorizationDavid Goulet
When the ONION_CLIENT_AUTH_REMOVE command is given to tor, now also remove the descriptor associated with the client authorization credentials. Fixes #33148 Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-01-21Turn hs_subcredential_t into a proper struct.Nick Mathewson
2020-01-08It's 2020. Update the copyright dates with "make update-copyright"Nick Mathewson
2019-12-20Replace several C identifiers.teor
This is an automated commit, generated by this command: ./scripts/maint/rename_c_identifier.py \ EXPOSE_CLEAN_BACKTRACE BACKTRACE_PRIVATE \ TOR_CHANNEL_INTERNAL_ CHANNEL_OBJECT_PRIVATE \ CHANNEL_PRIVATE_ CHANNEL_FILE_PRIVATE \ EXPOSE_ROUTERDESC_TOKEN_TABLE ROUTERDESC_TOKEN_TABLE_PRIVATE \ SCHEDULER_PRIVATE_ SCHEDULER_PRIVATE
2019-11-18test: Unit test for the hs cache decrypt on new authDavid Goulet
Part of #30382 Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-10-17hs-v3: Add a series of decoding error codeDavid Goulet
This commit introduces the hs_desc_decode_status_t enum which aims at having more fine grained error code when decoding a descriptor. This will be useful in later commits when we support keeping a descriptor that can't be decrypted due to missing or bad client authorization creds. No behavior change. Part of #30382. Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-07-03hs-v3: Disallow single hop client to post/get a descriptorDavid Goulet
Closes #24964 Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-04-30Replace all remaining tor_mem_is_zero() with fast_mem_is_zero()Nick Mathewson
2019-04-14Add an assertion to test_hs_cache.c to appease coverity.Nick Mathewson
Coverity doesn't like to see a path where we test a pointer for NULL if we have already ready dereferenced the pointer on that path. While in this case, the check is not needed, it's best not to remove checks from the unit tests IMO. Instead, I'm adding an earlier check, so that coverity, when analyzing this function, will think that we have always checked the pointer before dereferencing it. Closes ticket 30180; CID 1444641.
2019-04-05crypto_format: Remove the return values from digest256_to_base64()teor
... and ed25519_public_to_base64(). Also remove all checks for the return values, which were redundant anyway, because the functions never failed. Part of 29960.
2019-01-16Bump copyright date to 2019Nick Mathewson
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: Refactor the descriptor decryption/decodingSuphanat Chunhapanya
This commit refactors the existing decryption code to make it compatible with a new logic for when the client authorization is enabled. Signed-off-by: David Goulet <dgoulet@torproject.org>
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-05Fix every include path changed in the previous commit (automated)Nick Mathewson
I am very glad to have written this script.
2018-07-01Minimize headers that include crypto_formats and x25519 stuffNick Mathewson
2018-06-20Run rectify_include_paths.pyNick Mathewson
2018-06-20Update copyrights to 2018.Nick Mathewson
2018-06-15Extract networkstatus_t and ..sr_info_t into their own headersNick Mathewson
2018-06-15Split dir_connection_t into its own headerNick Mathewson
2017-12-08Rename connection_free_ to connection_free_minimal.Nick Mathewson
2017-09-13prop224 test: Test client desc expiration in tests.George Kadianakis
We enrich the test_client_cache() test in two ways: a) We check that transitioning time periods also cleans up expired descriptors in client memory. b) We test hs_cache_lookup_as_client() instead of lookup_v3_desc_as_client(). The former is a higher level function which calls the latter and allows us to test deeper into the subsystem.
2017-09-05Move protocol-specific functions out of buffers.cNick Mathewson
This commit does not change the implementation of any function: it only moves code and adds new includes as necessary. Part of #23149.
2017-08-24Fix operator usage in src/test/*.cAlexander Færøy
This patch fixes the operator usage in src/test/*.c to use the symbolic operators instead of the normal C comparison operators. This patch was generated using: ./scripts/coccinelle/test-operator-cleanup src/test/*.[ch]
2017-08-24test: Add tests for fetching descs and handling SOCKS conns.George Kadianakis
- Add tests that ensure that SOCKS requests for v2/v3 addresses get intercepted and handled. - Add test that stores and lookups an HS descriptor in the client-side cache. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-08test: Fix prop224 HS descriptor to use subcredentialGeorge Kadianakis
We used to use NULL subcredential which is a terrible terrible idea. Refactor HS unittests to use subcredentials. Also add some non-fatal asserts to make sure that we always use subcredentials when decoding/encoding descs. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-05-09test: Move duplicate HS test code and unify itDavid Goulet
Create the hs_test_helpers.{c|h} files that contains helper functions to create introduction point, descriptor and compare descriptor. Used by both the hs cache and hs descriptor tests. Unify them to avoid code duplication. Also, this commit fixes the usage of the signing key that was wrongly used when creating a cross signed certificate. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-03-15Run the copyright update script.Nick Mathewson
2017-03-13prop224: Fix the HS descriptor unittests.George Kadianakis
- HS descriptors are now bigger than 10kb. - encrypted_data_length_is_valid() is not that strict now.
2017-02-24prop224: Rename auth_required HS desc field to intro_auth_required.George Kadianakis
And remove "password" type from the list of intro auths.
2017-02-15hs: Avoid a strlen(NULL) if descriptor is not found in cacheDavid Goulet
Instead of returning 404 error code, this led to a NULL pointer being used and thus a crash of tor. Fixes #21471 Signed-off-by: David Goulet <dgoulet@torproject.org>
2016-12-16hs: Remove private keys from hs_desc_plaintext_data_t.J. Ryan Stinnett
Since both the client and service will use that data structure to store the descriptor decoded data, only the public keys are common to both. Fixes #20572. Signed-off-by: David Goulet <dgoulet@torproject.org>
2016-11-04Would you believe me if I said there were more 32-bit and clang warnings?Nick Mathewson
2016-11-04Fix memory leaks in test_hs_cache.cNick Mathewson
2016-11-04Fix more unit test leaks.Nick Mathewson
2016-11-04Fix a bunch of leaks in hs_cache/upload_and_download_hs_descNick Mathewson
2016-11-04Fix make check-spacesNick Mathewson
2016-11-04prop224: fix unit test to actually initialize a connection objectDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2016-11-04prop224: Use a const pointer for the cache lookup entryDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2016-11-04prop224: Rename cert type to follow naming conventionDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2016-11-04Make check-spaces happy :)George Kadianakis
Signed-off-by: David Goulet <dgoulet@torproject.org> Signed-off-by: George Kadianakis <desnacked@riseup.net>
2016-11-04test: Add prop224 directory fetch/upload unit testsGeorge Kadianakis
Signed-off-by: David Goulet <dgoulet@torproject.org> Signed-off-by: George Kadianakis <desnacked@riseup.net>
2016-11-04test: Add prop224 directory cache unit testsDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org> Signed-off-by: George Kadianakis <desnacked@riseup.net>