mirror of
https://github.com/whoahq/whoa.git
synced 2026-11-20 21:14:56 +03:00
chore(net): stub out more of client version check during login
This commit is contained in:
9 files changed
+34
-15
No files matched your search
@@ -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,
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user