Network: Change protocol for game/rcon/settings password auth

Instead of sending a hash, do a DH/X25519 key exchange
using the password.
This also allows authenticating the associated rcon payload and response.
This commit is contained in:
Jonathan G Rennison
2023-06-15 21:32:15 +01:00
parent 9042eb338f
commit 3d2dc77aa2
7 changed files with 280 additions and 81 deletions

View File

@@ -1412,6 +1412,23 @@ void NetworkRandomBytesWithFallback(void *buf, size_t bytes)
}
}
void NetworkGameKeys::Initialise()
{
assert(!this->inited);
this->inited = true;
static_assert(sizeof(this->x25519_priv_key) == 32);
NetworkRandomBytesWithFallback(this->x25519_priv_key, sizeof(this->x25519_priv_key));
crypto_x25519_public_key(this->x25519_pub_key, this->x25519_priv_key);
}
NetworkSharedSecrets::~NetworkSharedSecrets()
{
static_assert(sizeof(*this) == 64);
crypto_wipe(this, sizeof(*this));
}
#ifdef __EMSCRIPTEN__
extern "C" {