mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-02 00:32:45 +03:00
chore(net): stub out more of client version check during login
This commit is contained in:
parent
b7b257f43f
commit
597be15103
5
src/client/Util.cpp
Normal file
5
src/client/Util.cpp
Normal 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
8
src/client/Util.hpp
Normal 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
|
||||||
@ -1,6 +1,7 @@
|
|||||||
#include "glue/CGlueMgr.hpp"
|
#include "glue/CGlueMgr.hpp"
|
||||||
#include "client/Client.hpp"
|
#include "client/Client.hpp"
|
||||||
#include "client/ClientServices.hpp"
|
#include "client/ClientServices.hpp"
|
||||||
|
#include "client/Util.hpp"
|
||||||
#include "console/CVar.hpp"
|
#include "console/CVar.hpp"
|
||||||
#include "glue/CRealmList.hpp"
|
#include "glue/CRealmList.hpp"
|
||||||
#include "gx/Coordinate.hpp"
|
#include "gx/Coordinate.hpp"
|
||||||
@ -485,10 +486,10 @@ void CGlueMgr::PollLoginServerLogin() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case LOGIN_STATE_CHECKINGVERSIONS: {
|
case LOGIN_STATE_CHECKINGVERSIONS: {
|
||||||
uint8_t versionChecksum[20];
|
uint8_t versionChecksum[VERSION_CHECKSUM_LEN];
|
||||||
// TODO
|
auto versionChallenge = ClientServices::LoginConnection()->GetVersionChallenge();
|
||||||
// uint8_t* versionChallenge = ClientServices::LoginConnection()->GetVersionChallenge();
|
ChecksumExecutables(versionChallenge, VERSION_CHALLENGE_LEN, versionChecksum);
|
||||||
// ChecksumExecutables(versionChallenge, 16, versionChecksum);
|
|
||||||
ClientServices::LoginConnection()->ProveVersion(versionChecksum);
|
ClientServices::LoginConnection()->ProveVersion(versionChecksum);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -3,6 +3,9 @@
|
|||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
#define VERSION_CHALLENGE_LEN 16
|
||||||
|
#define VERSION_CHECKSUM_LEN 20
|
||||||
|
|
||||||
enum LOGIN_RESULT {
|
enum LOGIN_RESULT {
|
||||||
LOGIN_OK = 0,
|
LOGIN_OK = 0,
|
||||||
LOGIN_INVALID_CHALLENGE_MESSAGE = 1,
|
LOGIN_INVALID_CHALLENGE_MESSAGE = 1,
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
#include "net/connection/WowConnection.hpp"
|
#include "net/connection/WowConnection.hpp"
|
||||||
#include "net/grunt/ClientResponse.hpp"
|
#include "net/grunt/ClientResponse.hpp"
|
||||||
#include "net/grunt/Command.hpp"
|
#include "net/grunt/Command.hpp"
|
||||||
#include "net/grunt/Types.hpp"
|
|
||||||
#include "net/srp/SRP6_Random.hpp"
|
#include "net/srp/SRP6_Random.hpp"
|
||||||
#include <common/MD5.hpp>
|
#include <common/MD5.hpp>
|
||||||
#include <storm/Error.hpp>
|
#include <storm/Error.hpp>
|
||||||
@ -115,13 +114,13 @@ int32_t Grunt::ClientLink::CmdAuthLogonChallenge(CDataStore& msg) {
|
|||||||
uint8_t* salt;
|
uint8_t* salt;
|
||||||
uint8_t* versionChallenge;
|
uint8_t* versionChallenge;
|
||||||
|
|
||||||
if (!CanRead(msg, largeSafePrimeLen + SALT_LEN + GRUNT_VERSION_CHALLENGE_LEN)) {
|
if (!CanRead(msg, largeSafePrimeLen + SALT_LEN + VERSION_CHALLENGE_LEN)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.GetDataInSitu(reinterpret_cast<void*&>(largeSafePrime), largeSafePrimeLen);
|
msg.GetDataInSitu(reinterpret_cast<void*&>(largeSafePrime), largeSafePrimeLen);
|
||||||
msg.GetDataInSitu(reinterpret_cast<void*&>(salt), SALT_LEN);
|
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;
|
uint8_t logonFlags;
|
||||||
|
|
||||||
@ -354,7 +353,7 @@ int32_t Grunt::ClientLink::CmdAuthReconnectChallenge(CDataStore& msg) {
|
|||||||
// Reconnect challenge success (result == 0)
|
// Reconnect challenge success (result == 0)
|
||||||
|
|
||||||
msg.GetDataInSitu(reinterpret_cast<void*&>(reconnectKey), RECONNECT_KEY_LEN);
|
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()) {
|
if (!msg.IsValid()) {
|
||||||
return 1;
|
return 1;
|
||||||
@ -636,7 +635,7 @@ void Grunt::ClientLink::ProveVersion(const uint8_t* versionChecksum) {
|
|||||||
SHA1_CONTEXT ctx;
|
SHA1_CONTEXT ctx;
|
||||||
SHA1_Init(&ctx);
|
SHA1_Init(&ctx);
|
||||||
SHA1_Update(&ctx, this->m_srpClient.clientPublicKey, sizeof(this->m_srpClient.clientPublicKey));
|
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);
|
SHA1_Final(versionProof, &ctx);
|
||||||
command.PutData(versionProof, sizeof(versionProof));
|
command.PutData(versionProof, sizeof(versionProof));
|
||||||
|
|
||||||
@ -685,7 +684,7 @@ void Grunt::ClientLink::ProveVersion(const uint8_t* versionChecksum) {
|
|||||||
|
|
||||||
SHA1_Init(&sha1);
|
SHA1_Init(&sha1);
|
||||||
SHA1_Update(&sha1, clientSalt, sizeof(clientSalt));
|
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);
|
SHA1_Final(clientChecksum, &sha1);
|
||||||
|
|
||||||
command.PutData(clientChecksum, sizeof(clientChecksum));
|
command.PutData(clientChecksum, sizeof(clientChecksum));
|
||||||
|
|||||||
@ -21,6 +21,7 @@ class Grunt::ClientResponse {
|
|||||||
virtual void RealmListResult(CDataStore* msg) = 0;
|
virtual void RealmListResult(CDataStore* msg) = 0;
|
||||||
virtual LOGIN_STATE NextSecurityState(LOGIN_STATE state) = 0;
|
virtual LOGIN_STATE NextSecurityState(LOGIN_STATE state) = 0;
|
||||||
virtual int32_t GetServerId() = 0;
|
virtual int32_t GetServerId() = 0;
|
||||||
|
virtual const uint8_t* GetVersionChallenge() = 0;
|
||||||
virtual void GetRealmList() = 0;
|
virtual void GetRealmList() = 0;
|
||||||
virtual void Logon(const char* a2, const char* a3) = 0;
|
virtual void Logon(const char* a2, const char* a3) = 0;
|
||||||
virtual void ProveVersion(const uint8_t* versionChecksum) = 0;
|
virtual void ProveVersion(const uint8_t* versionChecksum) = 0;
|
||||||
|
|||||||
@ -1,7 +1,4 @@
|
|||||||
#ifndef NET_GRUNT_TYPES_HPP
|
#ifndef NET_GRUNT_TYPES_HPP
|
||||||
#define NET_GRUNT_TYPES_HPP
|
#define NET_GRUNT_TYPES_HPP
|
||||||
|
|
||||||
#define GRUNT_VERSION_CHALLENGE_LEN 16
|
|
||||||
#define GRUNT_VERSION_CHECKSUM_LEN 20
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -89,6 +89,10 @@ int32_t GruntLogin::GetServerId() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const uint8_t* GruntLogin::GetVersionChallenge() {
|
||||||
|
return this->m_versionChallenge;
|
||||||
|
}
|
||||||
|
|
||||||
void GruntLogin::GetVersionProof(const uint8_t* versionChallenge) {
|
void GruntLogin::GetVersionProof(const uint8_t* versionChallenge) {
|
||||||
if (this->IsReconnect()) {
|
if (this->IsReconnect()) {
|
||||||
// TODO
|
// TODO
|
||||||
|
|||||||
@ -3,13 +3,13 @@
|
|||||||
|
|
||||||
#include "net/grunt/ClientResponse.hpp"
|
#include "net/grunt/ClientResponse.hpp"
|
||||||
#include "net/grunt/Grunt.hpp"
|
#include "net/grunt/Grunt.hpp"
|
||||||
#include "net/grunt/Types.hpp"
|
|
||||||
#include "net/login/Login.hpp"
|
#include "net/login/Login.hpp"
|
||||||
|
#include "net/Types.hpp"
|
||||||
|
|
||||||
class GruntLogin : public Login {
|
class GruntLogin : public Login {
|
||||||
public:
|
public:
|
||||||
// Member variables
|
// Member variables
|
||||||
uint8_t m_versionChallenge[GRUNT_VERSION_CHALLENGE_LEN];
|
uint8_t m_versionChallenge[VERSION_CHALLENGE_LEN];
|
||||||
Grunt::ClientLink* m_clientLink = nullptr;
|
Grunt::ClientLink* m_clientLink = nullptr;
|
||||||
|
|
||||||
// Virtual member functions
|
// 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 void ReconnectResult(Grunt::Result result, const uint8_t* sessionKey, uint32_t sessionKeyLen, uint16_t flags);
|
||||||
virtual LOGIN_STATE NextSecurityState(LOGIN_STATE state);
|
virtual LOGIN_STATE NextSecurityState(LOGIN_STATE state);
|
||||||
virtual int32_t GetServerId();
|
virtual int32_t GetServerId();
|
||||||
|
virtual const uint8_t* GetVersionChallenge();
|
||||||
virtual void GetRealmList();
|
virtual void GetRealmList();
|
||||||
virtual void Logon(const char* a2, const char* a3);
|
virtual void Logon(const char* a2, const char* a3);
|
||||||
virtual void ProveVersion(const uint8_t* versionChecksum);
|
virtual void ProveVersion(const uint8_t* versionChecksum);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user