Age | Commit message (Collapse) | Author |
|
Also added and used the new crypto_malloc and crypto_free.
The latter also zeroes out the memory safely. The former only exists for
symmetry (static analysis can detect asymmetric usages).
|
|
Changes:
* 100 columns maximum (not strict, can be a bit more sometimes).
* No space after cast.
|
|
|
|
* Moved PAIR to toxav, where it's used (but really this should die).
* Replace most MIN calls with typed `min_*` calls. Didn't replace the
ones where the desired semantics are unclear. Moved the MIN macro to
the one place where it's still used.
* Avoid assignments in `while` loops. Instead, factored out the loop body
into a separate `bool`-returning function.
* Use named types for callbacks (`_cb` types).
* Avoid assignments in `if` conditions.
* Removed `MAKE_REALLOC` and expanded its two calls. We can't have
templates in C, and this fake templating is ugly and hard to analyse
and debug (it expands on a single line).
* Moved epoll system include to the .c file, out of the .h file.
* Avoid assignments in expressions (`a = b = c;`).
* Avoid multiple declarators per struct member declaration.
* Fix naming inconsistencies.
* Replace `net_to_host` macro with function.
|
|
Have one script per build. This means more duplication between the
scripts, but it's much easier to understand and to run locally.
|
|
We control the random functions in crypto_core, so we can make them
deterministic more easily. This will help test reproducibility in the
future.
|
|
|
|
|
|
Also replace &(x) with &x for consistency.
|
|
|
|
socket -> net_socket
htons -> net_htons
htonl -> net_htonl
connect -> net_connect
sendto -> net_sendto_ip4
getaddrinfo -> net_getipport
sa_family_t -> Family
|
|
|
|
"All rights reserved" was incorrect. The project was licensed under GPL3,
which means a lot of rights are licensed to everybody in the world, i.e.
not reserved to the "Tox Project".
|
|
Implementation mostly taken from libsodium utils.
Fix #347
|
|
|
|
|
|
`new_nonce` has been an alias for `random_nonce` for a while now. Having
two names for the same operation is confusing. `random_nonce` better
expresses the intent. The documentation for `new_nonce` talks about
guaranteeing that the nonce is different from previous ones, which is
incorrect, it's just quite likely to be different.
|
|
These definitely don't belong in a module called "crypto core". The DHT
module seems like the best place to put them, since they are sent to DHT
nodes.
|
|
In the future, all TODOs added either need a bug number (TODO(#NN)) or a
person's github user name. By default, I made irungentoo the owner of
all toxcore TODOs, mannol the owner of toxav TODOs, and myself the owner
of API TODOs.
|
|
|
|
Some of these (like the incompatible pointers one) are really annoying for
later refactoring.
|
|
Fixed bug from merged PR.
Don't build useless files when building with libsodium.
|
|
fix: make increment_nonce & increment_nonce_number independent of user-controlled input
fix: make crypto_core more stable agains null ptr dereference
|
|
Moving 'return -1;' directly below the conditions improves readability
and also better represents the coding style of other functions in
crypt_core.c (and everywhere else).
|
|
keys.
|
|
randombytes() doesn't seem to have any real speed disadvantage.
Also makes people who think nonces need to be random happy.
|
|
Moved some functions to onion.c.
Fixed possible portability issues.
|
|
|
|
|
|
|
|
This typo doesn't seem to cause any issue because according to the
code in vanilla NaCl the first crypto_box_ZEROBYTES (for encryption)
and crypto_box_BOXZEROBYTES (for decryption) of the array passed to
the crypto_box*() functions don't need to be zero for it to work.
The documentation however clearly states that they need to be zero
which means they need to be zero.
|
|
|
|
|
|
|
|
Still need to decide exactly how data packets will work though.
|
|
It now uses the NaCl functions when the length is appropriate.
Moved crypto defines to crypto_core.h
|
|
|
|
Fixed circular dependency between DHT and net_crypto: DHT no longer
depends on net_crypto.
Moved the crypto request packets functions to crypto core and DHT.
Cleaned up/added some defines that can be used to get the true maximum
length of things like the friends request message.
MAX_DATA_SIZE has been replaced in most places by more appropriate defines.
|
|
Started writing the code.
Astyled some files.
|
|
Moved Bunch of functions from net_crypto to crypto_core.
decrypt_data_fast and decrypt_data_symmetric were the same thing
therefore, removed decrypt_data_fast.
Replaced all the crypto_secretbox_* defines with the equivalent
crypto_box_* one.
New define: crypto_box_KEYBYTES that is equal to
crypto_box_BEFORENMBYTES.
|