Commit Graph

866 Commits

Author SHA1 Message Date
iphydf 2ccecdc2a1 chore: Add remaining fuzz tests to cflite.
So we can run them daily and get coverage info from them.
2025-02-05 21:03:48 +00:00
iphydf 4626c2e230 test: Add a Net_Crypto fuzz test. 2025-02-05 19:45:48 +00:00
iphydf 463eeae114 cleanup: Avoid clashing with global define DEBUG.
Some systems define this, breaking our test code.
2025-01-22 23:52:44 +00:00
iphydf d10c966b99 feat: Add to_string functions for toxencryptsave errors.
Also added a tox save decryption tool.
2025-01-11 00:50:08 +00:00
iphydf bc43cec062 chore: Happy new year! 2025-01-05 23:24:52 +00:00
iphydf 0204db6184 cleanup: Fix layering check warnings.
These warnings aren't available yet, but will be in a future
toktok-stack build.
2024-12-04 10:24:23 +00:00
iphydf 819aa2b261 feat: Add option to disable DNS lookups in toxcore.
Allows clients to prevent leaking IP addresses through DNS lookups. This
option, together with disabling Tox UDP, entirely prevents any UDP
packets being sent by toxcore.
2024-11-27 17:19:56 +00:00
iphydf 14d823165d chore: Migrate to conan 2. 2024-11-20 23:48:57 +00:00
Green Sky 2e94da60d0 feat(net): add missing connect to network struct 2024-11-12 23:28:22 +01:00
iphydf 350c0ba120 cleanup: Sort apk/apt install commands in Dockerfiles.
CodeQL scanning is complaining about this.
2024-11-06 15:43:33 +00:00
Maxim Biro 0ec4978de5 refactor: Don't expose Tox_System in the public API
It makes no sense to include it in the public API as clients can't make
any meaningful use of it via public API, it can only be used if one also
includes other internal/private headers that we don't install.

It's used only in the testing code, which has access to the internal
headers.

Fixes #2739, at least to some degree. I decided against moving things to
a separate `tox_testing.h` and leaving only things in `tox_private.h`
that we are fine with clients using, as otherwise `tox_lock()` /
`tox_unlock()` would have to be moved out of `tox_private.h` to
somewhere else, but `tox_private.h` actually sounds like the right place
for them, naming-wise. So perhaps it's fine if we have things in
`tox_private.h` that we don't want clients to use.
2024-03-17 11:22:43 -04:00
iphydf 3e05824b80 refactor: Rename out parameters to out_$something.
In preparation for supporting `out` as a type qualifier in parameters.
2024-03-08 22:11:30 +00:00
Maxim Biro 9bb79c174f cleanup: Remove a couple of unnecessary misc_tools dependencies
These programs link against libsodium, which already provides bin-to-hex
and hex-to-bin conversion functions. Removing the misc_tools dependency
shaves ~30KiB (in some cases 10%) off Windows static binaries using it.
2024-03-04 15:11:55 -05:00
iphydf 93c83fbc7c refactor: Use strong typedef instead of struct for Socket.
Sparse checks it. This is neater than using a struct, which has some
slightly weird syntax at times. This also reduces the risk of someone
adding another struct member.
2024-02-09 01:10:06 +00:00
iphydf 5bdaaaedb6 refactor: Remove Tox * from tox_dispatch.
User data can contain a tox instance if it needs to.
2024-02-04 20:18:26 +00:00
iphydf b7404f24f6 cleanup: Remove implicit bool conversions. 2024-02-02 01:31:54 +00:00
iphydf 4e2dba4d9f chore: Reformat sources with astyle.
Restyled astyle is fixed now.
2024-02-02 01:31:32 +00:00
iphydf 4359e3a6bc chore: Rename C++ headers to .hh suffixes.
This helps formatters and other dump (simple) tools know what's C++ and
what's C.
2024-02-01 23:44:37 +00:00
iphydf bdf460a3a9 refactor: Rename system_{memory,...} to os_{memory,...}.
This rename happens in the system PR, so I'm pulling it out to reduce
the size of that PR.
2024-01-25 21:33:52 +00:00
iphydf 1cdcf938b9 cleanup: Add comment after every #endif.
This makes far-away endifs clearer, so we're applying the rule to all
endifs to be consistent.
2024-01-23 21:52:41 +00:00
iphydf bcb6592af5 test: Add C++ classes wrapping system interfaces.
These are more convenient and safer than the manual vtables we have in
the fuzzer support code. We can override individual member functions,
and C++ will take care of correctly casting and offsetting this-pointers
when needed.
2024-01-13 16:16:47 +00:00
iphydf 4cea4f9ca4 fix: Make all the fuzzers work again, and add a test for protodump.
fuzz_select_target wasn't selecting anything, so fuzzers using that
function either did nothing or would only ever select one of the
functions.
2024-01-13 15:06:30 +00:00
iphydf 812f931d5f fix: Make sure there's enough space for CONSUME1 in fuzzers. 2024-01-12 14:52:35 +00:00
iphydf 50f1b30fa9 test: Add fuzz tests to the coverage run.
So we don't need to write so many edge case tests ourselves for things
like parsers, which really don't need those manual tests, as long as we
can check for some properties like "can output the parsed data and it'll
be the same as the input".
2024-01-12 12:33:41 +00:00
iphydf 32b68cffca cleanup: Some more test cleanups, removing overly smart code. 2024-01-10 12:42:37 +00:00
iphydf b148a2afff chore: Simplify msvc build using vcpkg. 2024-01-06 12:27:31 +00:00
iphydf 5cac6d7eb1 cleanup: Move tox_get_system out of the public API.
It's not released, yet, and this function is a pain. We don't want it
going forward.
2024-01-05 19:29:59 +00:00
iphydf ef4897a898 cleanup: Upgrade to clang-tidy-17 and fix some warnings. 2023-12-27 01:05:47 +00:00
iphydf 766e62bc89 chore: Use pkg_search_module directly in cmake.
The `pkg_use_module` was doing magic we used to use, but no longer need.
2023-12-26 01:14:50 +00:00
iphydf 00ff078f91 cleanup: Use target_link_libraries directly in cmake.
Instead of using `target_link_modules`, which does magic that we no
longer need, because we only have 1 library we install, and all binaries
we build link statically because they need access to internal symbols.
2023-12-26 00:24:08 +00:00
iphydf c58928cc89 chore: Add IMPORTED_TARGET to pkg-config packages.
Also use `PRIVATE` for `target_link_libraries`. This helps avoid
implicit transitive dependencies.
2023-12-26 00:04:07 +00:00
iphydf 895a6af122 cleanup: Remove NaCl support.
We now depend on libsodium unconditionally. Future work will require
functions from libsodium, and nobody we're aware of uses the nacl build
for anything other than making sure it still works on CI.
2023-12-25 00:36:38 +00:00
iphydf 447666d1a1 chore: Disable targets for cross-compilation.
This way we can do bazel build //... when cross-compiling.
2023-12-24 00:20:13 +00:00
iphydf 425216d9ec fix: Correct a use-after-free and fix some memory leaks.
Also: use `find_package` to find gtest. This fixes the coverage build to
include unit tests.
2023-12-21 17:17:51 +00:00
iphydf 4e603bb613 refactor: Use enum-from-int rule from tokstyle.
These functions are a bit clearer and don't need to change if enum
values change.

See https://github.com/TokTok/hs-tokstyle/pull/212 for the relevant
linter implementation.
2023-12-19 20:53:15 +00:00
iphydf 89b6450d66 test: Add check-c run to bazel build.
Makes iterating on both check-c and the toxcore code easier.
2023-12-15 23:09:24 +00:00
iphydf 7cfe35dff2 cleanup: Remove explicit layering_check feature.
It's default in .bazelrc now.
2023-11-23 23:55:57 +00:00
iphydf 6be29f01e5 chore: Add more logging to loading conferences from savedata.
Better error messages than "something went wrong in type 20".

Also fix bazel-asan/tsan builds.

https://github.com/tweag/rules_nixpkgs/issues/442 is blocking fuzz
tests under asan.
2023-11-08 15:51:11 +00:00
iphydf 82276ef5ac cleanup: Fix GCC compatibility. 2023-11-07 12:18:22 +00:00
iphydf 24b54722ae fix: Ensure we have allocators available for the error paths. 2023-09-11 21:43:43 +00:00
iphydf a549807df7 refactor: Add mem module to allow tests to override allocators.
This will allow us to do more interesting things with memory allocation
within toxcore, and allow fuzzers to explore various allocation failure
paths.
2023-08-30 22:55:05 +00:00
iphydf 7469a529b1 fix: Add missing #include <array>. 2023-08-15 20:47:27 +00:00
iphydf 2e02d56379 chore: Add missing module dependencies.
Also flip some callback asserts, because they can be reached by fuzzing
eventually.

Also update the bootstrapd checksum, since the alpine image changed a
bit.
2023-08-10 21:01:17 +00:00
sudden6 d222d708b5 fix: expand asserts in fuzz_support.cc 2022-12-08 17:27:00 +01:00
Green Sky e1c38b40d6 fix: #1144 by forcing misc_tools to be a static lib 2022-12-08 14:43:01 +01:00
sudden6 9fae455bab test: enable tcp relay for bootstrap fuzzing 2022-12-04 18:52:09 +01:00
jfreegman 0a277b52ea Merge the remainder of the new groupchats implementation
Commit history: https://github.com/jfreegman/toxcore/tree/ngc_jf
Spec: https://toktok.ltd/spec.html#dht-group-chats
2022-09-22 11:16:08 -04:00
iphydf 50094b7385 test: Add a protocol dump test to generate initial fuzzer input. 2022-04-19 23:42:47 +00:00
iphydf debedb3c94 test: Add a Null_System used in toxsave_harness.
This does nothing but has a working simple RNG.
2022-04-14 19:04:25 +00:00
iphydf 19b9cf3812 test: Enable fuzzing for TCP.
If the `recvbuf` network function returns 0 all the time, that means
there is never any data available on the TCP socket. This change makes
it so there is a random amount of data available on the TCP socket.

This invalidates the bootstrap fuzzer corpus.
2022-04-14 13:19:56 +00:00