Commit Graph

112 Commits

Author SHA1 Message Date
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 df2211e154 refactor: Use tox memory allocator for temporary buffers in crypto. 2024-11-28 22:58:25 +00:00
iphydf ce4f29e803 cleanup: Fix all -Wsign-compare warnings. 2024-11-08 18:06:15 +00:00
Maxim Biro 4c902955f3 docs: Public headers, 80 column width comments 2024-03-12 23:19:49 -04:00
iphydf 4e2dba4d9f chore: Reformat sources with astyle.
Restyled astyle is fixed now.
2024-02-02 01:31:32 +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 814c12a6f4 cleanup: Add dynamically derived array sizes to the API. 2024-01-07 14:43:57 +00:00
iphydf 226b23be12 cleanup: Add explicit array sizes to toxencryptsave.
Also mark arrays as `[]` instead of `*`.
2024-01-07 13:27:38 +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 7cfe35dff2 cleanup: Remove explicit layering_check feature.
It's default in .bazelrc now.
2023-11-23 23:55:57 +00:00
iphydf ddda605509 fix: Don't crash if RNG init failed.
`system_random()` can fail and return NULL, which should be handled by
toxencryptsave functions.

Also synced function comments between .h and .c file for toxencryptsave.
2022-04-03 20:46:44 +00:00
iphydf cc31ff07fa feat: Add support for custom random number generator.
This can be used by fuzzers to make RNG-driven code deterministic (i.e.
based on the fuzzer input).
2022-04-01 14:06:05 +00:00
iphydf 88ae190aca cleanup: Split the huge TCP client packet handler.
Also enable cppcheck in both C and C++ mode.
2022-03-19 11:06:50 +00:00
iphydf e1e92c1ac1 docs: Clean up doxygen comments to be more doxygen-like. 2022-03-05 22:30:48 +00:00
iphydf b13590a86d cleanup: Mark all local non-pointers as const where possible. 2022-02-23 19:30:01 +00:00
iphydf 6be655c56c cleanup: Return boolean constants, not ints from bool functions. 2022-02-22 17:50:17 +00:00
iphydf e7bc611dac cleanup: Enable most cppcheck warnings as errors.
Cleaned up some of the warnings it gives. Disabled the ones that are
less useful for us at this time.
2022-02-21 17:17:36 +00:00
iphydf a9ccf1be26 cleanup: Remove all implicit bool conversions in if-conditions.
Note to reviewer: please review carefully. This was done manually.
2022-02-21 15:10:22 +00:00
iphydf 87c38ece30 cleanup: Avoid implicit bool conversions in logical operators. 2022-02-18 10:24:31 +00:00
iphydf 933c6b7517 refactor: Compare pointers in if conditions to nullptr.
Don't use implicit ptr-to-bool conversion.
2022-02-17 19:55:29 +00:00
iphydf 7f0395b746 chore: Make the last few remaining top level comments doxygen style. 2022-02-04 23:25:45 +00:00
iphydf 7f94e411a9 chore: Add cpplint to the CI. 2022-01-17 23:42:38 +00:00
iphydf 4a2cb37e4b fix: Fix some uninitialised memory errors found by valgrind and msan.
Also added a valgrind build to run it on every pull request. I've had to
disable a few tests because valgrind makes those run infinitely slowly,
consistently timing them out.
2022-01-13 20:15:21 +00:00
iphydf f5f22a5c76 chore: Enable layering check in all c-toxcore build files. 2022-01-12 18:33:13 +00:00
iphydf 73484d8995 cleanup: Use calloc instead of malloc for struct allocations.
`malloc` is used only for byte/int arrays. Also, we no longer allow plain
`void *` allocations. Every allocation should have a real value type.
2022-01-09 22:42:50 +00:00
iphydf 24f49fc917 chore: Fix up a few source code comment and style issues.
Tokstyle no longer allows:
* Includes inside an `extern "C"`
* Comments on function definition and declaration to be different.
* Doxygen comments commenting on other doxygen comments.
2021-12-21 18:14:53 +00:00
iphydf 4746a8b3af cleanup: Remove apidsl; remove crypto_memcmp.
* `crypto_memcmp` was replaced by more specific functions. We never want
  to compare arbitrary amounts of data this way. We use these functions
  to compare key material.
* apidsl has been bothering people, so now we un-bother them. You're
  welcome.
* Added the memlock/unlock functions from the New Group Chats branch.
* Remove some system dependencies in crypto_core_mem.c.
* Renamed UPPERCASE_NAMES to Snake_Camel_Case names.
2021-12-19 19:22:38 +00:00
iphydf f49ea44daa cleanup: Remove crypto_pwhash import.
Vanilla nacl builds won't have toxencryptsave.
2021-12-15 17:16:35 +00:00
iphydf 6b75f8b889 chore: Remove config.h.
This aligns the autotools build with the cmake build, which doesn't have
a config.h file. It also removes the ambiguity of config.h and
other/bootstrap_daemon/src/config.h.
2021-12-15 10:26:50 +00:00
iphydf 5c53e6a30f chore: Add autotools build; exempt crypto_pwhash from tokstyle. 2021-12-13 18:47:45 +00:00
iphydf 30c939e4ab cleanup: Fix some clang-tidy warnings and make them errors.
The android warnings are disabled now because they suggest using
linux-only extensions of libc. Useful for android indeed, but we're
targeting non-android and non-linux systems as well.
2021-12-10 15:21:27 +00:00
iphydf d930ecca4c chore: Run infer static analyser on circle ci builds.
Also running some other analysis that we used to have on Travis.
2021-12-06 20:25:50 +00:00
iphydf 669ea8797b Fix typo: NAC_LIBS -> NACL_LIBS.
This is working, so probably `NACL_LIBS` is entirely useless, but I
can't be bothered to figure out what this was supposed to be, so here we
are.
2020-05-04 19:54:58 +01:00
iphydf f8ab32aaa4 Add a check that we don't have any unused functions.
This check puts all of our code in a C++ anonymous namespace, which is
effectively making all functions `static`. This allows the compiler to
determine that a function is unused, so we can delete it.
2020-05-02 22:00:09 +01:00
iphydf c08b2fb3e2 Remove tokstyle exemptions from build files.
We put some tokstyle exemptions into the source files themselves,
instead. This way we can check some of the code in those files, and more
in the future when tokstyle supports more constructs (like apidsl).

Also: hacked ping_array.api.h to not emit `_array` as parameter names.
We'll need to fix apidsl to do this better. This works for now.
2020-04-16 11:05:08 +00:00
iphydf 11ad5471b9 Use spdx license identifier instead of GPL blurb. 2020-03-14 13:06:19 +00:00
iphydf 605dfe882c Consistently use camel case enum names.
Including in tests and implementation files.
2018-10-09 17:33:37 +00:00
iphydf 49bb43f662 Standardise header guards.
Using the full path including the repo name.
2018-09-14 19:09:10 +00:00
iphydf 473cde24d8 Update copyright to 2018. 2018-08-26 18:57:29 +00:00
iphydf 8739f7fccb Make tox.c unambiguously parseable.
Rules:
1. Constants are uppercase names: THE_CONSTANT.
2. SUE[1] types start with an uppercase letter and have at least one
   lowercase letter in it: The_Type, THE_Type.
3. Function types end in "_cb": tox_friend_connection_cb.
4. Variable and function names are all lowercase: the_function.

This makes it easier for humans reading the code to determine what an
identifier means. I'm not convinced by the enum type name change, but I
don't know a better rule. Currently, a lot of enum types are spelled like
constants, which is confusing.

[1] struct/union/enum
2018-07-05 23:09:28 +00:00
iphydf 957508f698 Remove utils.c and utils.h from toxencryptsave build.
These were deleted earlier.
2018-06-25 20:27:21 +00:00
iphydf 12365a7cc9 Fixes to the imported sodium sources to compile without warnings. 2018-06-25 20:09:53 +00:00
iphydf be797d4b03 Move system header includes from network.h to network.c 2018-05-20 15:42:42 +00:00
iphydf 92ffad1a72 Use nullptr as NULL pointer constant instead of NULL or 0.
This changes only code, no string literals or comments.
2018-01-30 23:35:50 +00:00
iphydf 6e0ac337c9 Avoid clashes with "build" directories on case-insensitive file systems. 2018-01-28 15:17:34 +00:00
iphydf 42636861d8 Publish a single public BUILD target for c-toxcore. 2018-01-22 21:18:24 +00:00
iphydf 52778aed93 Make BUILD files more finely-grained.
This allows us to precisely see which libraries depend on which and lets
us split them up more, if necessary.
2018-01-21 19:44:09 +00:00
iphydf 0a5be3cbc5 Use C99 standard in bazel builds. 2018-01-18 21:52:31 +00:00