From a8a6a140186f97bb01e2f5e9e5cd746850d36684 Mon Sep 17 00:00:00 2001 From: fusion32 Date: Fri, 19 Sep 2025 23:46:26 -0300 Subject: support 7.72 with non-default `-DTIBIA772=1` switch --- src/connections.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/connections.cc b/src/connections.cc index ac5d4ca..e640cb6 100644 --- a/src/connections.cc +++ b/src/connections.cc @@ -13,7 +13,12 @@ # error "Operating system not currently supported." #endif +#if TIBIA772 +static const int TERMINALVERSION[] = {772, 772, 772}; +#else static const int TERMINALVERSION[] = {770, 770, 770}; +#endif + static RSAKey *g_PrivateKey = NULL; static int g_Listener = -1; static TConnection *g_Connections = NULL; @@ -474,7 +479,10 @@ void ProcessLoginRequest(TConnection *Connection){ return; } - if(!RSADecrypt(g_PrivateKey, AsymmetricData, sizeof(AsymmetricData))){ + // IMPORTANT(fusion): Without a checksum, there is no way of validating + // the asymmetric data. The best we can do is to verify that the first + // plaintext byte is ZERO, but that alone isn't enough. + if(!RSADecrypt(g_PrivateKey, AsymmetricData, sizeof(AsymmetricData)) || AsymmetricData[0] != 0){ LOG_ERR("Failed to decrypt asymmetric data from %s", Connection->RemoteAddress); CloseConnection(Connection); -- cgit v1.2.3