chore(net): stub out more of client version check during login

This commit is contained in:
fallenoak 2025-09-25 23:15:53 -07:00
parent b7b257f43f
commit 597be15103
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
9 changed files with 34 additions and 15 deletions

5
src/client/Util.cpp Normal file
View File

@ -0,0 +1,5 @@
#include "client/Util.hpp"
void ChecksumExecutables(const uint8_t* challenge, uint32_t challengeLength, uint8_t* checksum) {
// TODO
}

8
src/client/Util.hpp Normal file
View File

@ -0,0 +1,8 @@
#ifndef CLIENT_UTIL_HPP
#define CLIENT_UTIL_HPP
#include <cstdint>
void ChecksumExecutables(const uint8_t* challenge, uint32_t challengeLength, uint8_t* checksum);
#endif

View File

@ -1,6 +1,7 @@
#include "glue/CGlueMgr.hpp"
#include "client/Client.hpp"
#include "client/ClientServices.hpp"
#include "client/Util.hpp"
#include "console/CVar.hpp"
#include "glue/CRealmList.hpp"
#include "gx/Coordinate.hpp"
@ -485,10 +486,10 @@ void CGlueMgr::PollLoginServerLogin() {
}
case LOGIN_STATE_CHECKINGVERSIONS: {
uint8_t versionChecksum[20];
// TODO
// uint8_t* versionChallenge = ClientServices::LoginConnection()->GetVersionChallenge();
// ChecksumExecutables(versionChallenge, 16, versionChecksum);
uint8_t versionChecksum[VERSION_CHECKSUM_LEN];
auto versionChallenge = ClientServices::LoginConnection()->GetVersionChallenge();
ChecksumExecutables(versionChallenge, VERSION_CHALLENGE_LEN, versionChecksum);
ClientServices::LoginConnection()->ProveVersion(versionChecksum);
break;

View File

@ -3,6 +3,9 @@
#include <cstdint>
#define VERSION_CHALLENGE_LEN 16
#define VERSION_CHECKSUM_LEN 20
enum LOGIN_RESULT {
LOGIN_OK = 0,
LOGIN_INVALID_CHALLENGE_MESSAGE = 1,

View File

@ -2,7 +2,6 @@
#include "net/connection/WowConnection.hpp"
#include "net/grunt/ClientResponse.hpp"
#include "net/grunt/Command.hpp"
#include "net/grunt/Types.hpp"
#include "net/srp/SRP6_Random.hpp"
#include <common/MD5.hpp>
#include <storm/Error.hpp>
@ -115,13 +114,13 @@ int32_t Grunt::ClientLink::CmdAuthLogonChallenge(CDataStore& msg) {
uint8_t* salt;
uint8_t* versionChallenge;
if (!CanRead(msg, largeSafePrimeLen + SALT_LEN + GRUNT_VERSION_CHALLENGE_LEN)) {
if (!CanRead(msg, largeSafePrimeLen + SALT_LEN + VERSION_CHALLENGE_LEN)) {
return 0;
}
msg.GetDataInSitu(reinterpret_cast<void*&>(largeSafePrime), largeSafePrimeLen);
msg.GetDataInSitu(reinterpret_cast<void*&>(salt), SALT_LEN);
msg.GetDataInSitu(reinterpret_cast<void*&>(versionChallenge), GRUNT_VERSION_CHALLENGE_LEN);
msg.GetDataInSitu(reinterpret_cast<void*&>(versionChallenge), VERSION_CHALLENGE_LEN);
uint8_t logonFlags;
@ -354,7 +353,7 @@ int32_t Grunt::ClientLink::CmdAuthReconnectChallenge(CDataStore& msg) {
// Reconnect challenge success (result == 0)
msg.GetDataInSitu(reinterpret_cast<void*&>(reconnectKey), RECONNECT_KEY_LEN);
msg.GetDataInSitu(reinterpret_cast<void*&>(versionChallenge), GRUNT_VERSION_CHALLENGE_LEN);
msg.GetDataInSitu(reinterpret_cast<void*&>(versionChallenge), VERSION_CHALLENGE_LEN);
if (!msg.IsValid()) {
return 1;
@ -636,7 +635,7 @@ void Grunt::ClientLink::ProveVersion(const uint8_t* versionChecksum) {
SHA1_CONTEXT ctx;
SHA1_Init(&ctx);
SHA1_Update(&ctx, this->m_srpClient.clientPublicKey, sizeof(this->m_srpClient.clientPublicKey));
SHA1_Update(&ctx, versionChecksum, GRUNT_VERSION_CHECKSUM_LEN);
SHA1_Update(&ctx, versionChecksum, VERSION_CHECKSUM_LEN);
SHA1_Final(versionProof, &ctx);
command.PutData(versionProof, sizeof(versionProof));
@ -685,7 +684,7 @@ void Grunt::ClientLink::ProveVersion(const uint8_t* versionChecksum) {
SHA1_Init(&sha1);
SHA1_Update(&sha1, clientSalt, sizeof(clientSalt));
SHA1_Update(&sha1, versionChecksum, GRUNT_VERSION_CHECKSUM_LEN);
SHA1_Update(&sha1, versionChecksum, VERSION_CHECKSUM_LEN);
SHA1_Final(clientChecksum, &sha1);
command.PutData(clientChecksum, sizeof(clientChecksum));

View File

@ -21,6 +21,7 @@ class Grunt::ClientResponse {
virtual void RealmListResult(CDataStore* msg) = 0;
virtual LOGIN_STATE NextSecurityState(LOGIN_STATE state) = 0;
virtual int32_t GetServerId() = 0;
virtual const uint8_t* GetVersionChallenge() = 0;
virtual void GetRealmList() = 0;
virtual void Logon(const char* a2, const char* a3) = 0;
virtual void ProveVersion(const uint8_t* versionChecksum) = 0;

View File

@ -1,7 +1,4 @@
#ifndef NET_GRUNT_TYPES_HPP
#define NET_GRUNT_TYPES_HPP
#define GRUNT_VERSION_CHALLENGE_LEN 16
#define GRUNT_VERSION_CHECKSUM_LEN 20
#endif

View File

@ -89,6 +89,10 @@ int32_t GruntLogin::GetServerId() {
return 0;
}
const uint8_t* GruntLogin::GetVersionChallenge() {
return this->m_versionChallenge;
}
void GruntLogin::GetVersionProof(const uint8_t* versionChallenge) {
if (this->IsReconnect()) {
// TODO

View File

@ -3,13 +3,13 @@
#include "net/grunt/ClientResponse.hpp"
#include "net/grunt/Grunt.hpp"
#include "net/grunt/Types.hpp"
#include "net/login/Login.hpp"
#include "net/Types.hpp"
class GruntLogin : public Login {
public:
// Member variables
uint8_t m_versionChallenge[GRUNT_VERSION_CHALLENGE_LEN];
uint8_t m_versionChallenge[VERSION_CHALLENGE_LEN];
Grunt::ClientLink* m_clientLink = nullptr;
// Virtual member functions
@ -24,6 +24,7 @@ class GruntLogin : public Login {
virtual void ReconnectResult(Grunt::Result result, const uint8_t* sessionKey, uint32_t sessionKeyLen, uint16_t flags);
virtual LOGIN_STATE NextSecurityState(LOGIN_STATE state);
virtual int32_t GetServerId();
virtual const uint8_t* GetVersionChallenge();
virtual void GetRealmList();
virtual void Logon(const char* a2, const char* a3);
virtual void ProveVersion(const uint8_t* versionChecksum);