summaryrefslogtreecommitdiff
path: root/toxcore
diff options
context:
space:
mode:
authorNamsooCho <nscho66@gmail.com>2018-10-20 12:59:50 +0900
committerzugz (tox) <mbays+tox@sdf.org>2018-10-24 13:05:32 +0200
commit15cc8050d22dcc2243ff9041c7670a40997f93e8 (patch)
tree4485db382d62b38e03262860569a57c24040be8d /toxcore
parent744dc2f5da2c54ad1e4d7d6ce229bc1756d81263 (diff)
Change method of PK production for fake friend in DHT
Diffstat (limited to 'toxcore')
-rw-r--r--toxcore/DHT.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/toxcore/DHT.c b/toxcore/DHT.c
index 4908de32..6b2715ee 100644
--- a/toxcore/DHT.c
+++ b/toxcore/DHT.c
@@ -2741,10 +2741,12 @@ DHT *new_dht(const Logger *log, Mono_Time *mono_time, Networking_Core *net, bool
2741 dht->dht_harden_ping_array = ping_array_new(DHT_PING_ARRAY_SIZE, PING_TIMEOUT); 2741 dht->dht_harden_ping_array = ping_array_new(DHT_PING_ARRAY_SIZE, PING_TIMEOUT);
2742 2742
2743 for (uint32_t i = 0; i < DHT_FAKE_FRIEND_NUMBER; ++i) { 2743 for (uint32_t i = 0; i < DHT_FAKE_FRIEND_NUMBER; ++i) {
2744 uint8_t random_key_bytes[CRYPTO_PUBLIC_KEY_SIZE]; 2744 uint8_t random_public_key_bytes[CRYPTO_PUBLIC_KEY_SIZE];
2745 random_bytes(random_key_bytes, sizeof(random_key_bytes)); 2745 uint8_t random_secret_key_bytes[CRYPTO_SECRET_KEY_SIZE];
2746 2746
2747 if (dht_addfriend(dht, random_key_bytes, nullptr, nullptr, 0, nullptr) != 0) { 2747 crypto_new_keypair(random_public_key_bytes, random_secret_key_bytes);
2748
2749 if (dht_addfriend(dht, random_public_key_bytes, nullptr, nullptr, 0, nullptr) != 0) {
2748 kill_dht(dht); 2750 kill_dht(dht);
2749 return nullptr; 2751 return nullptr;
2750 } 2752 }