Skip to content

Commit

Permalink
Change method of PK production for FAKE friend in DHT
Browse files Browse the repository at this point in the history
  • Loading branch information
NamsooCho committed Oct 22, 2018
1 parent 744dc2f commit f4cfd4b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions toxcore/DHT.c
Original file line number Diff line number Diff line change
Expand Up @@ -2741,10 +2741,12 @@ DHT *new_dht(const Logger *log, Mono_Time *mono_time, Networking_Core *net, bool
dht->dht_harden_ping_array = ping_array_new(DHT_PING_ARRAY_SIZE, PING_TIMEOUT);

for (uint32_t i = 0; i < DHT_FAKE_FRIEND_NUMBER; ++i) {
uint8_t random_key_bytes[CRYPTO_PUBLIC_KEY_SIZE];
random_bytes(random_key_bytes, sizeof(random_key_bytes));
uint8_t random_public_key_bytes[CRYPTO_PUBLIC_KEY_SIZE];
uint8_t random_secret_key_bytes[CRYPTO_SECRET_KEY_SIZE];

if (dht_addfriend(dht, random_key_bytes, nullptr, nullptr, 0, nullptr) != 0) {
crypto_new_keypair(random_public_key_bytes, random_secret_key_bytes);

if (dht_addfriend(dht, random_public_key_bytes, nullptr, nullptr, 0, nullptr) != 0) {
kill_dht(dht);
return nullptr;
}
Expand Down

0 comments on commit f4cfd4b

Please sign in to comment.