Age | Commit message (Collapse) | Author |
|
|
|
It now uses the NaCl functions when the length is appropriate.
Moved crypto defines to crypto_core.h
|
|
Handshake most likely has no more possible flaws to it, next thing
to do is to do the same with the data packets.
Wrote a couple more functions.
|
|
|
|
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.
|
|
Removed a bunch of useless space from various structs.
pack_nodes() and unpack_nodes() are now used to transmit lists of
nodes for the DHT and onion parts. They provide a way to transmit
both ipv6 and ipv4 nodes in the same packet in a portable way that
takes as little space as possible without compression.
Using pack_nodes, merged the send nodes and send nodes ipv6 packets
into one packet greatly reducing the risk of amplification attacks.
|
|
Mac OS X doesn't have MSG_NOSIGNAL, so we need to use SO_NOSIGPIPE.
Signed-off-by: Steven Noonan <steven@uplinklabs.net>
|
|
Some work done on the TCP part.
|
|
|
|
All the IP/Port related structs now have __attribute__ ((__packed__))
|
|
Main changes:
1. Strings no longer need to be NULL terminated.
2. tox_get_friend_id is now named tox_get_friend_number.
3. The friend request callback function is now (Tox *tox, uint8_t *,
uint8_t *, uint16_t, void *), the Tox object pointer has been added to
it.
|
|
|
|
|
|
|
|
A way to send and handle lossy UDP packets coming from friends.
Will be used for A/V.
|
|
define DHT_SERVER_EXTRA_PACKETS to enable.
|
|
|
|
|
|
Plan 9 requires u.h in every file
|
|
|
|
|
|
Also added some tests.
|
|
No functionality changed.
|
|
AF_INET/AF_INET6 can vary across devices, we introduce TOX_AF_INET and
TOX_AF_INET6 to fix this.
|
|
|
|
|
|
Significantly trimmed down version of an ID<=>IP cache.
|
|
|
|
Besides acknowledging timeouts, the module isn't trying to do anything fancy with the data besides storing and retrieving.
|
|
Also removed some old, useless loading code.
|
|
|
|
|
|
unix_time():
- returns local value for current epoch
- value is updated explicitly with unix_time_update() called at new_DHT()/doMessenger()/do_DHT()
is_timeout():
- uses the local value for current epoch
id_cpy()/id_eq() => id_copy()/id_equal():
- centralized duplicate definitions
- replaced (most) memcpy()/memcmp() of (*, *, CLIENT_ID_SIZE) with id_copy()/id_equal()
|
|
|
|
|
|
always off).
Additionally (besides cleanups):
network.h/tox.h:
- WIN32: fix a strange sa_family_t definition
- WIN32: define EWOULDBLOCK to WSAEWOULDBLOCK
- WIN32: kill macro for an existing function (IN6_ADDR_EQUAL)
network.c:
- use EWOULDBLOCK instead of EAGAIN (same value, but EWOULDBLOCK is more "popular")
- new_networking(): only try to enable IPv4-in-IPv6 if it's not already enabled per default
- inet_ntop()/inet_pton(): WIN32: remove partial initializers in favor of a simple memset()
- ip_equal(): WIN32: use an existing function
- logging: networking_wait_execute(): only dump result if not timeout
- logging: loglogdata(): kill an unused variable
LAN_discovery.c:
- send_broadcasts(): re-enabled, can only support IPv4 by principle, split into fetch_broadcast_info() (to fetch the addresses once) and send_broadcasts() (actual sending)
DHT.c:
- DHT_load_state_callback(): enclosed a fprintf(stderr, ...) into #ifdef DEBUG
Lossless_UDP.c:
- change_handshake(): harden against strange sa_family_t definitions
Messenger.c:
- logging: fix ID to string conversion
util.c:
- logging: eliminate a signed-warning
|
|
|
|
Also-by: Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>
|
|
sendpacket() sets a timestamp if it happened
network.*:
- sendpacket(): checks result and on EAGAIN, stores time of this event
- networking_wait_prepare(): uses the time if set to check up to 500ms later for the socket to be writeable again
- networking_wait_cleanup(): clears the time if the socket was writeable
- fixed some accidental tabs
Messenger.*, tox.*:
- pass-through functions to reach networking_wait_cleanup()
- fixed some accidental tabs
|
|
To allow the actual waiting to run without any locking, split it into preparing the data it uses and the execution of the wait.
The caller must provide with the buffer to store whatever data it requires to wait.
Completely eliminates any reliance on the existence of anything but that data in the actual wait routine.
Also fixed a few argument type warnings inside LOGGING.
|
|
Lossless_UDP.*:
- sendqueue_total() sums sendqueue() across all connections
network.*, Messenger.c:
- sendqueue_total() is collected and then used in deciding if we select() on write-readiness
|
|
tox.*, Messenger.*, network.*;
- new function tox_wait() => waitMessenger() => networking_wait():
- waits for a given amount of time for any sort of socket activity
- mustn't change anything inside, mustn't poll or do other stuff
- the point is to be able to call this asynchronously from a second thread
- the outside shall follow up with an immediate tox_do() when there's socket activity
tox.*:
- allow inclusion of tox.h into tox.c, ensuring that the outside interface and the internal always match
util.c:
- squished a few warnings about questionable format strings
|
|
|
|
|
|
|
|
struct in6_addr member names can differ per platform.
|
|
|
|
Nonces don't need to be random, only different.
also random_int now gives same quality random numbers for both NaCl and
libsodium.
|
|
messages.
|