Skip to content

Commit

Permalink
Updating toxcore to 0.1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
dvor committed May 5, 2017
1 parent 6751005 commit f8035ef
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 13 deletions.
2 changes: 1 addition & 1 deletion toxcore.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

Pod::Spec.new do |s|
s.name = "toxcore"
s.version = "0.1.7"
s.version = "0.1.8"
s.summary = "Cocoapods wrapper for toxcore"
s.homepage = "https://github.com/Antidote-for-Tox/toxcore"
s.license = 'GPLv3'
Expand Down
1 change: 0 additions & 1 deletion toxcore/toxcore/LAN_discovery.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

/* Used for get_broadcast(). */
#ifdef __linux
#include <arpa/inet.h>
#include <linux/netdevice.h>
#include <sys/ioctl.h>
#endif
Expand Down
4 changes: 3 additions & 1 deletion toxcore/toxcore/network.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@
#include <windows.h>
#include <ws2tcpip.h>

#else // Linux includes
#else // UNIX includes

#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <unistd.h>
Expand Down
7 changes: 2 additions & 5 deletions toxcore/toxcore/network.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,11 @@

#if !(defined(_WIN32) || defined(__WIN32__) || defined(WIN32))

#include <arpa/inet.h>
#include <errno.h>
#include <fcntl.h>
#include <netdb.h>
#include <netinet/in.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>

#else

Expand Down Expand Up @@ -815,15 +812,15 @@ int ip_equal(const IP *a, const IP *b)

/* same family */
if (a->family == b->family) {
if (a->family == AF_INET) {
if (a->family == AF_INET || a->family == TCP_INET) {
struct in_addr addr_a;
struct in_addr addr_b;
fill_addr4(a->ip4, &addr_a);
fill_addr4(b->ip4, &addr_b);
return addr_a.s_addr == addr_b.s_addr;
}

if (a->family == AF_INET6) {
if (a->family == AF_INET6 || a->family == TCP_INET6) {
return a->ip6.uint64[0] == b->ip6.uint64[0] &&
a->ip6.uint64[1] == b->ip6.uint64[1];
}
Expand Down
9 changes: 7 additions & 2 deletions toxcore/toxcore/tox.api.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ const VERSION_MINOR = 1;
* The patch or revision number. Incremented when bugfixes are applied without
* changing any functionality or API or ABI.
*/
const VERSION_PATCH = 7;
const VERSION_PATCH = 8;

/**
* A macro to check at preprocessing time whether the client code is compatible
Expand Down Expand Up @@ -240,6 +240,11 @@ const PUBLIC_KEY_SIZE = 32;
*/
const SECRET_KEY_SIZE = 32;

/**
* The size of the nospam in bytes when written in a Tox address.
*/
const NOSPAM_SIZE = sizeof(uint32_t);

/**
* The size of a Tox address in bytes. Tox addresses are in the format
* [Public Key ($PUBLIC_KEY_SIZE bytes)][nospam (4 bytes)][checksum (2 bytes)].
Expand All @@ -248,7 +253,7 @@ const SECRET_KEY_SIZE = 32;
* byte is an XOR of all the even bytes (0, 2, 4, ...), the second byte is an
* XOR of all the odd bytes (1, 3, 5, ...) of the Public Key and nospam.
*/
const ADDRESS_SIZE = PUBLIC_KEY_SIZE + sizeof(uint32_t) + sizeof(uint16_t);
const ADDRESS_SIZE = PUBLIC_KEY_SIZE + NOSPAM_SIZE + sizeof(uint16_t);

/**
* Maximum length of a nickname in bytes.
Expand Down
11 changes: 9 additions & 2 deletions toxcore/toxcore/tox.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ uint32_t tox_version_minor(void);
* The patch or revision number. Incremented when bugfixes are applied without
* changing any functionality or API or ABI.
*/
#define TOX_VERSION_PATCH 7
#define TOX_VERSION_PATCH 8

uint32_t tox_version_patch(void);

Expand Down Expand Up @@ -245,6 +245,13 @@ uint32_t tox_public_key_size(void);

uint32_t tox_secret_key_size(void);

/**
* The size of the nospam in bytes when written in a Tox address.
*/
#define TOX_NOSPAM_SIZE (sizeof(uint32_t))

uint32_t tox_nospam_size(void);

/**
* The size of a Tox address in bytes. Tox addresses are in the format
* [Public Key (TOX_PUBLIC_KEY_SIZE bytes)][nospam (4 bytes)][checksum (2 bytes)].
Expand All @@ -253,7 +260,7 @@ uint32_t tox_secret_key_size(void);
* byte is an XOR of all the even bytes (0, 2, 4, ...), the second byte is an
* XOR of all the odd bytes (1, 3, 5, ...) of the Public Key and nospam.
*/
#define TOX_ADDRESS_SIZE (TOX_PUBLIC_KEY_SIZE + sizeof(uint32_t) + sizeof(uint16_t))
#define TOX_ADDRESS_SIZE (TOX_PUBLIC_KEY_SIZE + TOX_NOSPAM_SIZE + sizeof(uint16_t))

uint32_t tox_address_size(void);

Expand Down
13 changes: 13 additions & 0 deletions toxcore/toxencryptsave/toxencryptsave.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,19 @@
#error TOX_PASS_ENCRYPTION_EXTRA_LENGTH is assumed to be equal to (crypto_box_MACBYTES + crypto_box_NONCEBYTES + crypto_pwhash_scryptsalsa208sha256_SALTBYTES + TOX_ENC_SAVE_MAGIC_LENGTH)
#endif

uint32_t tox_pass_salt_length(void)
{
return TOX_PASS_SALT_LENGTH;
}
uint32_t tox_pass_key_length(void)
{
return TOX_PASS_KEY_LENGTH;
}
uint32_t tox_pass_encryption_extra_length(void)
{
return TOX_PASS_ENCRYPTION_EXTRA_LENGTH;
}

struct Tox_Pass_Key {
uint8_t salt[TOX_PASS_SALT_LENGTH];
uint8_t key[TOX_PASS_KEY_LENGTH];
Expand Down

0 comments on commit f8035ef

Please sign in to comment.