diff options
Diffstat (limited to 'other/bootstrap_daemon/tox_bootstrap_daemon.c')
-rw-r--r-- | other/bootstrap_daemon/tox_bootstrap_daemon.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/other/bootstrap_daemon/tox_bootstrap_daemon.c b/other/bootstrap_daemon/tox_bootstrap_daemon.c index 66f6436d..abad7760 100644 --- a/other/bootstrap_daemon/tox_bootstrap_daemon.c +++ b/other/bootstrap_daemon/tox_bootstrap_daemon.c | |||
@@ -36,9 +36,9 @@ | |||
36 | #include "config.h" | 36 | #include "config.h" |
37 | #endif | 37 | #endif |
38 | 38 | ||
39 | #include "../../toxcore/DHT.h" | 39 | #include "../../toxcore/onion_announce.h" |
40 | #include "../../toxcore/friend_requests.h" | ||
41 | #include "../../toxcore/LAN_discovery.h" | 40 | #include "../../toxcore/LAN_discovery.h" |
41 | #include "../../toxcore/util.h" | ||
42 | 42 | ||
43 | #include "../../testing/misc_tools.c" | 43 | #include "../../testing/misc_tools.c" |
44 | 44 | ||
@@ -75,11 +75,12 @@ int manage_keys(DHT *dht, char *keys_file_path) | |||
75 | return 0; | 75 | return 0; |
76 | } | 76 | } |
77 | 77 | ||
78 | load_keys(dht->c, keys); | 78 | memcpy(dht->self_public_key, keys, crypto_box_PUBLICKEYBYTES); |
79 | memcpy(dht->self_secret_key, keys + crypto_box_PUBLICKEYBYTES, crypto_box_SECRETKEYBYTES); | ||
79 | } else { | 80 | } else { |
80 | // Otherwise save new keys | 81 | // Otherwise save new keys |
81 | new_keys(dht->c); | 82 | memcpy(keys, dht->self_public_key, crypto_box_PUBLICKEYBYTES); |
82 | save_keys(dht->c, keys); | 83 | memcpy(keys + crypto_box_PUBLICKEYBYTES, dht->self_secret_key, crypto_box_SECRETKEYBYTES); |
83 | 84 | ||
84 | keys_file = fopen(keys_file_path, "w"); | 85 | keys_file = fopen(keys_file_path, "w"); |
85 | 86 | ||
@@ -92,10 +93,6 @@ int manage_keys(DHT *dht, char *keys_file_path) | |||
92 | 93 | ||
93 | fclose(keys_file); | 94 | fclose(keys_file); |
94 | 95 | ||
95 | // We want our DHT public key to be the same as our internal one since this is a bootstrap node | ||
96 | memcpy(dht->self_public_key, dht->c->self_public_key, crypto_box_PUBLICKEYBYTES); | ||
97 | memcpy(dht->self_secret_key, dht->c->self_secret_key, crypto_box_SECRETKEYBYTES); | ||
98 | |||
99 | return 1; | 96 | return 1; |
100 | } | 97 | } |
101 | 98 | ||
@@ -351,7 +348,7 @@ int main(int argc, char *argv[]) | |||
351 | IP ip; | 348 | IP ip; |
352 | ip_init(&ip, enable_ipv6); | 349 | ip_init(&ip, enable_ipv6); |
353 | 350 | ||
354 | DHT *dht = new_DHT(new_net_crypto(new_networking(ip, port))); | 351 | DHT *dht = new_DHT(new_networking(ip, port)); |
355 | 352 | ||
356 | if (dht == NULL) { | 353 | if (dht == NULL) { |
357 | syslog(LOG_ERR, "Couldn't initialize Tox DHT instance. Exiting.\n"); | 354 | syslog(LOG_ERR, "Couldn't initialize Tox DHT instance. Exiting.\n"); |
@@ -384,7 +381,7 @@ int main(int argc, char *argv[]) | |||
384 | return 1; | 381 | return 1; |
385 | } | 382 | } |
386 | 383 | ||
387 | print_public_key(dht->c->self_public_key); | 384 | print_public_key(dht->self_public_key); |
388 | 385 | ||
389 | // Write the PID file | 386 | // Write the PID file |
390 | FILE *pidf = fopen(pid_file_path, "w"); | 387 | FILE *pidf = fopen(pid_file_path, "w"); |