You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since you have a function named public_key_valid, PK from random_bytes generates an invalid PK each 1/2 attempt.
voidrandom_bytes(uint8_t*data, size_tlength)
{
randombytes(data, length); // from NaCl
}
boolpublic_key_valid(constuint8_t*public_key)
{
if (public_key[31] >= 128) { /* Last bit of key is always zero. */return0;
}
return1;
}
The text was updated successfully, but these errors were encountered:
Correct, we send requests for them, but we don't want to find them. I agree it smells and we should fix that. The correct fix involves stronger typing and ensuring that values of type "Public_Key" are never invalid.
https://github.com/TokTok/c-toxcore/blob/2abc00693cc99f277c7c8fe1a201ec33becb01f1/toxcore/DHT.c#L2743..L2751
Since you have a function named
public_key_valid
, PK fromrandom_bytes
generates an invalid PK each 1/2 attempt.The text was updated successfully, but these errors were encountered: