summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--INSTALL.md42
-rw-r--r--README.md2
-rw-r--r--osx_build_script_toxcore.txt38
-rw-r--r--other/bootstrap_daemon/tox-bootstrapd.c10
-rw-r--r--toxcore/group.c3
-rw-r--r--toxdns/toxdns.h8
-rw-r--r--toxencryptsave/toxencryptsave.c23
-rw-r--r--toxencryptsave/toxencryptsave.h8
8 files changed, 108 insertions, 26 deletions
diff --git a/INSTALL.md b/INSTALL.md
index 824cfb5f..14d2ef67 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -152,12 +152,34 @@ Grab the following packages:
152 * https://gnu.org/software/automake/ 152 * https://gnu.org/software/automake/
153 * https://github.com/jedisct1/libsodium 153 * https://github.com/jedisct1/libsodium
154 * http://check.sourceforge.net/ 154 * http://check.sourceforge.net/
155 * http://yasm.tortall.net/Download.html 155 * http://yasm.tortall.net/Download.html (install before libvpx)
156 * https://code.google.com/p/webm/downloads/list 156 * https://code.google.com/p/webm/downloads/list
157 * http://www.opus-codec.org/downloads/ 157 * http://www.opus-codec.org/downloads/
158 * http://www.freedesktop.org/wiki/Software/pkg-config/ 158 * http://www.freedesktop.org/wiki/Software/pkg-config/
159 159
160You must install yasm before installing libvpx, otherwise libvpx will fail to make correctly. 160Macports: (https://www.macports.org/)
161All toxcore dependencies can be installed from MacPorts. This is often easier on PowerPC Macs,
162and any version of OS X prior to 10.6, since Homebrew is supported on 10.6 and up, but not much
163(or at all) on older systems. A few packages have slightly different names from the corresponding
164package in Debian.
165
166Same: libtool autoconf automake libsodium check yasm
167Different: libvpx (webm) libopus pkgconfig gettext
168
169(the libintl, from gettext, built into OS X 10.5 is missing libintl_setlocale, but the Macports build has it)
170
171Verify where libintl is on your system: (MacPorts puts it in /opt/local)
172$ for d in /usr/local/lib /opt/local/lib /usr/lib /lib; do ls -l $d/libintl.*; done
173
174Check if that copy has libintl_setlocale:
175nm /opt/local/lib/libintl.8.dylib | grep _libintl_setlocale
176
177Certain other tools may not be installed, or outdated, and should also be installed from MacPorts for simplicity: git cmake
178
179If libsodium was installed with MacPorts, you may want to symlink the copy in /opt/local/lib to /usr/local/lib. That way you don't need special configure switches for toxcore to find libsodium, and every time MacPorts updates libsodium, the new version will be linked to toxcore every time you build:
180ln -s /opt/local/lib/libsodium.dylib /usr/local/lib/libsodium.dylib
181
182Much of the build can then be done as for other platforms: git clone, and so on. Differences will be noted with (OS X 10.5 specific)
161 183
162pkg-config is important for enabling a/v support in tox core, failure to install pkg-config will prevent tox core form finding the required libopus/libvpx libraries. (pkg-config may not configure properly, if you get an error about GLIB, run configure with the following parameter, --with-internal-glib). 184pkg-config is important for enabling a/v support in tox core, failure to install pkg-config will prevent tox core form finding the required libopus/libvpx libraries. (pkg-config may not configure properly, if you get an error about GLIB, run configure with the following parameter, --with-internal-glib).
163 185
@@ -174,9 +196,21 @@ Compiling and installing Tox Core
174```bash 196```bash
175cd toxcore 197cd toxcore
176autoreconf -i 198autoreconf -i
177./configure 199./configure (OS X 10.5 specific)
200./configure CC="gcc -arch ppc -arch i386" CXX="g++ -arch ppc -arch i386" CPP="gcc -E" CXXCPP="g++ -E"
178make 201make
179make install 202make install (OS X 10.5 specific)
203should be: sudo make install
204If it worked, you should have all the toxcore dylibs in /usr/local/lib: (besides the four below, the rest are symlinks to these)
205$ ls -la /usr/local/lib/libtox*.dylib
206libtoxav.0.dylib
207libtoxcore.0.dylib
208libtoxdns.0.dylib
209libtoxencryptsave.0.dylib
210to check what CPU architecture they're compiled for:
211$ lipo -i /usr/local/lib/libtoxencryptsave.0.dylib
212You should now be able to move on to compiling Toxic/Venom or some other client application
213There is also a shell script called "osx_build_script_toxcore.txt" which automates everything from "git pull" to "sudo make install", once the dependencies are already taken care of by MacPorts.
180``` 214```
181 215
182If after running ./configure you get an error about core being unable to find libsodium (and you have installed it) run the following in place of ./configure; 216If after running ./configure you get an error about core being unable to find libsodium (and you have installed it) run the following in place of ./configure;
diff --git a/README.md b/README.md
index fab45653..9945028c 100644
--- a/README.md
+++ b/README.md
@@ -22,7 +22,7 @@ Every peer is represented as a [byte string][String] (the public key [Tox ID] of
22 22
23## Q&A: 23## Q&A:
24 24
25### What are your goals of Tox? 25### What are your goals with Tox?
26 26
27We want Tox to be as simple as possible while remaining as secure as possible. 27We want Tox to be as simple as possible while remaining as secure as possible.
28 28
diff --git a/osx_build_script_toxcore.txt b/osx_build_script_toxcore.txt
new file mode 100644
index 00000000..8aea0d1c
--- /dev/null
+++ b/osx_build_script_toxcore.txt
@@ -0,0 +1,38 @@
1#!/usr/bin/env bash
2# written by Lubo Diakov
3# hard coded toxcore directory, replace with other path or variable as needed
4cd ~/Downloads/toxcore
5echo "Now working in:"`pwd`
6
7# must have working git binary, and have done git clone at least once before
8git pull
9echo "If git pull responds: Already up-to-date. you can cancel the build"
10echo "by typing anything except y or Y below"
11read -p "Continue with build? (enter y to continue): " Last_Chance
12
13# blah blah
14if [[ $Last_Chance = [Yy] ]]; then echo "Continuing!";
15else echo "Aborted!"; exit
16fi
17sleep 3
18
19# if libsodium is built with macports, link it from /opt/local/ to /usr/local
20if [ ! -L "/usr/local/lib/libsodium.dylib" ]; then
21 # Control will enter here if $DIRECTORY doesn't exist.
22 ln -s /opt/local/lib/libsodium.dylib /usr/local/lib/libsodium.dylib
23fi
24echo "The symlink /usr/local/lib/libsodium.dylib exists."
25sleep 3
26
27# replace ppc, i386 as needed.
28./configure CC="gcc -arch ppc -arch i386" CXX="g++ -arch ppc -arch i386" CPP="gcc -E" CXXCPP="g++ -E"
29
30# get rid of prior builds, start clean
31make clean
32make
33echo ""
34echo "Sudo is required for make install only, all other steps run without it."
35echo "Please type your sudo password below for make install:"
36sudo make install
37
38exit
diff --git a/other/bootstrap_daemon/tox-bootstrapd.c b/other/bootstrap_daemon/tox-bootstrapd.c
index e4cadb35..7e78da4e 100644
--- a/other/bootstrap_daemon/tox-bootstrapd.c
+++ b/other/bootstrap_daemon/tox-bootstrapd.c
@@ -53,7 +53,7 @@
53 53
54 54
55#define DAEMON_NAME "tox-bootstrapd" 55#define DAEMON_NAME "tox-bootstrapd"
56#define DAEMON_VERSION_NUMBER 2014081600UL // yyyymmmddvv format: yyyy year, mm month, dd day, vv version change count for that day 56#define DAEMON_VERSION_NUMBER 2014101000UL // yyyymmmddvv format: yyyy year, mm month, dd day, vv version change count for that day
57 57
58#define SLEEP_TIME_MILLISECONDS 30 58#define SLEEP_TIME_MILLISECONDS 30
59#define sleep usleep(1000*SLEEP_TIME_MILLISECONDS) 59#define sleep usleep(1000*SLEEP_TIME_MILLISECONDS)
@@ -61,7 +61,7 @@
61#define DEFAULT_PID_FILE_PATH "tox-bootstrapd.pid" 61#define DEFAULT_PID_FILE_PATH "tox-bootstrapd.pid"
62#define DEFAULT_KEYS_FILE_PATH "tox-bootstrapd.keys" 62#define DEFAULT_KEYS_FILE_PATH "tox-bootstrapd.keys"
63#define DEFAULT_PORT 33445 63#define DEFAULT_PORT 33445
64#define DEFAULT_ENABLE_IPV6 0 // 1 - true, 0 - false 64#define DEFAULT_ENABLE_IPV6 1 // 1 - true, 0 - false
65#define DEFAULT_ENABLE_LAN_DISCOVERY 1 // 1 - true, 0 - false 65#define DEFAULT_ENABLE_LAN_DISCOVERY 1 // 1 - true, 0 - false
66#define DEFAULT_ENABLE_TCP_RELAY 1 // 1 - true, 0 - false 66#define DEFAULT_ENABLE_TCP_RELAY 1 // 1 - true, 0 - false
67#define DEFAULT_TCP_RELAY_PORTS 443, 3389, 33445 // comma-separated list of ports. make sure to adjust DEFAULT_TCP_RELAY_PORTS_COUNT accordingly 67#define DEFAULT_TCP_RELAY_PORTS 443, 3389, 33445 // comma-separated list of ports. make sure to adjust DEFAULT_TCP_RELAY_PORTS_COUNT accordingly
@@ -210,7 +210,9 @@ void parse_tcp_relay_ports_config(config_t *cfg, uint16_t **tcp_relay_ports, int
210 } 210 }
211 211
212 // the loop above skips invalid ports, so we adjust the allocated memory size 212 // the loop above skips invalid ports, so we adjust the allocated memory size
213 *tcp_relay_ports = realloc(*tcp_relay_ports, (*tcp_relay_port_count) * sizeof(uint16_t)); 213 if ((*tcp_relay_port_count) * sizeof(uint16_t) > 0) {
214 *tcp_relay_ports = realloc(*tcp_relay_ports, (*tcp_relay_port_count) * sizeof(uint16_t));
215 }
214} 216}
215 217
216// Gets general config options 218// Gets general config options
@@ -616,7 +618,7 @@ int main(int argc, char *argv[])
616 pid_t pid = fork(); 618 pid_t pid = fork();
617 619
618 if (pid > 0) { 620 if (pid > 0) {
619 fprintf(pidf, "%d ", pid); 621 fprintf(pidf, "%d", pid);
620 fclose(pidf); 622 fclose(pidf);
621 syslog(LOG_DEBUG, "Forked successfully: PID: %d.\n", pid); 623 syslog(LOG_DEBUG, "Forked successfully: PID: %d.\n", pid);
622 return 0; 624 return 0;
diff --git a/toxcore/group.c b/toxcore/group.c
index a71bd5cf..84d7d2bb 100644
--- a/toxcore/group.c
+++ b/toxcore/group.c
@@ -1437,12 +1437,9 @@ static void handle_message_packet_group(Group_Chats *g_c, int groupnumber, const
1437 1437
1438 if (peer_number == kill_peer_number) { 1438 if (peer_number == kill_peer_number) {
1439 delpeer(g_c, groupnumber, index); 1439 delpeer(g_c, groupnumber, index);
1440 return;
1441 } else { 1440 } else {
1442 //TODO 1441 //TODO
1443 } 1442 }
1444
1445 return;
1446 } 1443 }
1447 break; 1444 break;
1448 1445
diff --git a/toxdns/toxdns.h b/toxdns/toxdns.h
index 90b74281..06071b82 100644
--- a/toxdns/toxdns.h
+++ b/toxdns/toxdns.h
@@ -24,6 +24,10 @@
24#ifndef TOXDNS_H 24#ifndef TOXDNS_H
25#define TOXDNS_H 25#define TOXDNS_H
26 26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
27#include <stdint.h> 31#include <stdint.h>
28 32
29/* Clients are encouraged to set this as the maximum length names can have. */ 33/* Clients are encouraged to set this as the maximum length names can have. */
@@ -85,4 +89,8 @@ int tox_generate_dns3_string(void *dns3_object, uint8_t *string, uint16_t string
85int tox_decrypt_dns3_TXT(void *dns3_object, uint8_t *tox_id, uint8_t *id_record, uint32_t id_record_len, 89int tox_decrypt_dns3_TXT(void *dns3_object, uint8_t *tox_id, uint8_t *id_record, uint32_t id_record_len,
86 uint32_t request_id); 90 uint32_t request_id);
87 91
92#ifdef __cplusplus
93}
94#endif
95
88#endif 96#endif
diff --git a/toxencryptsave/toxencryptsave.c b/toxencryptsave/toxencryptsave.c
index 953ee802..7efba089 100644
--- a/toxencryptsave/toxencryptsave.c
+++ b/toxencryptsave/toxencryptsave.c
@@ -59,7 +59,7 @@ uint32_t tox_encrypted_size(const Tox *tox)
59 * returns 0 on success 59 * returns 0 on success
60 * returns -1 on failure 60 * returns -1 on failure
61 */ 61 */
62int tox_derive_key_from_pass(uint8_t* passphrase, uint32_t pplength, uint8_t* out_key) 62int tox_derive_key_from_pass(uint8_t *passphrase, uint32_t pplength, uint8_t *out_key)
63{ 63{
64 if (pplength == 0) 64 if (pplength == 0)
65 return -1; 65 return -1;
@@ -98,7 +98,7 @@ int tox_derive_key_from_pass(uint8_t* passphrase, uint32_t pplength, uint8_t* ou
98 * returns 0 on success 98 * returns 0 on success
99 * returns -1 on failure 99 * returns -1 on failure
100 */ 100 */
101int tox_pass_key_encrypt(uint8_t* data, uint32_t data_len, const uint8_t* key, uint8_t* out) 101int tox_pass_key_encrypt(uint8_t *data, uint32_t data_len, const uint8_t *key, uint8_t *out)
102{ 102{
103 /* the output data consists of, in order: 103 /* the output data consists of, in order:
104 * salt, nonce, mac, enc_data 104 * salt, nonce, mac, enc_data
@@ -110,7 +110,7 @@ int tox_pass_key_encrypt(uint8_t* data, uint32_t data_len, const uint8_t* key, u
110 110
111 /* first add the prefix */ 111 /* first add the prefix */
112 uint8_t nonce[crypto_box_NONCEBYTES]; 112 uint8_t nonce[crypto_box_NONCEBYTES];
113 random_nonce(nonce); 113 random_nonce(nonce);
114 114
115 memcpy(out, key, crypto_pwhash_scryptsalsa208sha256_SALTBYTES); 115 memcpy(out, key, crypto_pwhash_scryptsalsa208sha256_SALTBYTES);
116 key += crypto_pwhash_scryptsalsa208sha256_SALTBYTES; 116 key += crypto_pwhash_scryptsalsa208sha256_SALTBYTES;
@@ -134,9 +134,10 @@ int tox_pass_key_encrypt(uint8_t* data, uint32_t data_len, const uint8_t* key, u
134 * returns 0 on success 134 * returns 0 on success
135 * returns -1 on failure 135 * returns -1 on failure
136 */ 136 */
137int tox_pass_encrypt(uint8_t* data, uint32_t data_len, uint8_t* passphrase, uint32_t pplength, uint8_t* out) 137int tox_pass_encrypt(uint8_t *data, uint32_t data_len, uint8_t *passphrase, uint32_t pplength, uint8_t *out)
138{ 138{
139 uint8_t key[TOX_PASS_KEY_LENGTH]; 139 uint8_t key[TOX_PASS_KEY_LENGTH];
140
140 if (tox_derive_key_from_pass(passphrase, pplength, key) == -1) 141 if (tox_derive_key_from_pass(passphrase, pplength, key) == -1)
141 return -1; 142 return -1;
142 143
@@ -171,7 +172,7 @@ int tox_encrypted_save(const Tox *tox, uint8_t *data, uint8_t *passphrase, uint3
171 * returns the length of the output data (== data_len - TOX_PASS_ENCRYPTION_EXTRA_LENGTH) on success 172 * returns the length of the output data (== data_len - TOX_PASS_ENCRYPTION_EXTRA_LENGTH) on success
172 * returns -1 on failure 173 * returns -1 on failure
173 */ 174 */
174int tox_pass_key_decrypt(const uint8_t* data, uint32_t length, const uint8_t* key, uint8_t* out) 175int tox_pass_key_decrypt(const uint8_t *data, uint32_t length, const uint8_t *key, uint8_t *out)
175{ 176{
176 if (length <= TOX_PASS_ENCRYPTION_EXTRA_LENGTH) 177 if (length <= TOX_PASS_ENCRYPTION_EXTRA_LENGTH)
177 return -1; 178 return -1;
@@ -201,14 +202,14 @@ int tox_pass_key_decrypt(const uint8_t* data, uint32_t length, const uint8_t* ke
201 * returns the length of the output data (== data_len - TOX_PASS_ENCRYPTION_EXTRA_LENGTH) on success 202 * returns the length of the output data (== data_len - TOX_PASS_ENCRYPTION_EXTRA_LENGTH) on success
202 * returns -1 on failure 203 * returns -1 on failure
203 */ 204 */
204int tox_pass_decrypt(const uint8_t* data, uint32_t length, uint8_t* passphrase, uint32_t pplength, uint8_t* out) 205int tox_pass_decrypt(const uint8_t *data, uint32_t length, uint8_t *passphrase, uint32_t pplength, uint8_t *out)
205{ 206{
206 207
207 uint8_t passkey[crypto_hash_sha256_BYTES]; 208 uint8_t passkey[crypto_hash_sha256_BYTES];
208 crypto_hash_sha256(passkey, passphrase, pplength); 209 crypto_hash_sha256(passkey, passphrase, pplength);
209 210
210 uint8_t salt[crypto_pwhash_scryptsalsa208sha256_SALTBYTES]; 211 uint8_t salt[crypto_pwhash_scryptsalsa208sha256_SALTBYTES];
211 memcpy(salt, data, crypto_pwhash_scryptsalsa208sha256_SALTBYTES); 212 memcpy(salt, data, crypto_pwhash_scryptsalsa208sha256_SALTBYTES);
212 213
213 /* derive the key */ 214 /* derive the key */
214 uint8_t key[crypto_box_KEYBYTES + crypto_pwhash_scryptsalsa208sha256_SALTBYTES]; 215 uint8_t key[crypto_box_KEYBYTES + crypto_pwhash_scryptsalsa208sha256_SALTBYTES];
@@ -236,13 +237,15 @@ int tox_encrypted_load(Tox *tox, const uint8_t *data, uint32_t length, uint8_t *
236{ 237{
237 if (memcmp(data, TOX_ENC_SAVE_MAGIC_NUMBER, TOX_ENC_SAVE_MAGIC_LENGTH) != 0) 238 if (memcmp(data, TOX_ENC_SAVE_MAGIC_NUMBER, TOX_ENC_SAVE_MAGIC_LENGTH) != 0)
238 return -1; 239 return -1;
239 data += TOX_ENC_SAVE_MAGIC_LENGTH; length -= TOX_ENC_SAVE_MAGIC_LENGTH; 240
241 data += TOX_ENC_SAVE_MAGIC_LENGTH;
242 length -= TOX_ENC_SAVE_MAGIC_LENGTH;
240 243
241 uint32_t decrypt_length = length - TOX_PASS_ENCRYPTION_EXTRA_LENGTH; 244 uint32_t decrypt_length = length - TOX_PASS_ENCRYPTION_EXTRA_LENGTH;
242 uint8_t temp_data[decrypt_length]; 245 uint8_t temp_data[decrypt_length];
243 246
244 if (tox_pass_decrypt(data, length, passphrase, pplength, temp_data) 247 if (tox_pass_decrypt(data, length, passphrase, pplength, temp_data)
245 != decrypt_length) 248 != decrypt_length)
246 return -1; 249 return -1;
247 250
248 return tox_load(tox, temp_data, decrypt_length); 251 return tox_load(tox, temp_data, decrypt_length);
diff --git a/toxencryptsave/toxencryptsave.h b/toxencryptsave/toxencryptsave.h
index 6abcca42..2fb6a8c5 100644
--- a/toxencryptsave/toxencryptsave.h
+++ b/toxencryptsave/toxencryptsave.h
@@ -61,7 +61,7 @@ uint32_t tox_encrypted_size(const Tox *tox);
61 * returns 0 on success 61 * returns 0 on success
62 * returns -1 on failure 62 * returns -1 on failure
63 */ 63 */
64int tox_derive_key_from_pass(uint8_t* passphrase, uint32_t pplength, uint8_t* out_key); 64int tox_derive_key_from_pass(uint8_t *passphrase, uint32_t pplength, uint8_t *out_key);
65 65
66/* Encrypt arbitrary with a key produced by tox_derive_key_from_pass. The output 66/* Encrypt arbitrary with a key produced by tox_derive_key_from_pass. The output
67 * array must be at least data_len + TOX_PASS_ENCRYPTION_EXTRA_LENGTH bytes long. 67 * array must be at least data_len + TOX_PASS_ENCRYPTION_EXTRA_LENGTH bytes long.
@@ -73,7 +73,7 @@ int tox_derive_key_from_pass(uint8_t* passphrase, uint32_t pplength, uint8_t* ou
73 * returns 0 on success 73 * returns 0 on success
74 * returns -1 on failure 74 * returns -1 on failure
75 */ 75 */
76int tox_pass_key_encrypt(uint8_t* data, uint32_t data_len, const uint8_t* key, uint8_t* out); 76int tox_pass_key_encrypt(uint8_t *data, uint32_t data_len, const uint8_t *key, uint8_t *out);
77 77
78/* Encrypts the given data with the given passphrase. The output array must be 78/* Encrypts the given data with the given passphrase. The output array must be
79 * at least data_len + TOX_PASS_ENCRYPTION_EXTRA_LENGTH bytes long. This delegates 79 * at least data_len + TOX_PASS_ENCRYPTION_EXTRA_LENGTH bytes long. This delegates
@@ -84,7 +84,7 @@ int tox_pass_key_encrypt(uint8_t* data, uint32_t data_len, const uint8_t* key, u
84 * returns 0 on success 84 * returns 0 on success
85 * returns -1 on failure 85 * returns -1 on failure
86 */ 86 */
87int tox_pass_encrypt(uint8_t* data, uint32_t data_len, uint8_t* passphrase, uint32_t pplength, uint8_t* out); 87int tox_pass_encrypt(uint8_t *data, uint32_t data_len, uint8_t *passphrase, uint32_t pplength, uint8_t *out);
88 88
89/* Save the messenger data encrypted with the given password. 89/* Save the messenger data encrypted with the given password.
90 * data must be at least tox_encrypted_size(). 90 * data must be at least tox_encrypted_size().
@@ -111,7 +111,7 @@ int tox_pass_key_decrypt(const uint8_t* data, uint32_t length, const uint8_t* ke
111 * returns the length of the output data (== data_len - TOX_PASS_ENCRYPTION_EXTRA_LENGTH) on success 111 * returns the length of the output data (== data_len - TOX_PASS_ENCRYPTION_EXTRA_LENGTH) on success
112 * returns -1 on failure 112 * returns -1 on failure
113 */ 113 */
114int tox_pass_decrypt(const uint8_t* data, uint32_t length, uint8_t* passphrase, uint32_t pplength, uint8_t* out); 114int tox_pass_decrypt(const uint8_t *data, uint32_t length, uint8_t *passphrase, uint32_t pplength, uint8_t *out);
115 115
116/* Load the messenger from encrypted data of size length. 116/* Load the messenger from encrypted data of size length.
117 * 117 *