diff --git a/src/net/grunt/ClientLink.cpp b/src/net/grunt/ClientLink.cpp index b684208..459aecd 100644 --- a/src/net/grunt/ClientLink.cpp +++ b/src/net/grunt/ClientLink.cpp @@ -2,6 +2,7 @@ #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 #include @@ -12,7 +13,6 @@ #define SERVER_PUBLIC_KEY_LEN 32 #define SALT_LEN 32 -#define VERSION_CHALLENGE_LEN 16 #define PIN_SALT_LEN 16 #define SERVER_PROOF_LEN 20 #define RECONNECT_KEY_LEN 16 @@ -115,13 +115,13 @@ int32_t Grunt::ClientLink::CmdAuthLogonChallenge(CDataStore& msg) { uint8_t* salt; uint8_t* versionChallenge; - if (!CanRead(msg, largeSafePrimeLen + SALT_LEN + VERSION_CHALLENGE_LEN)) { + if (!CanRead(msg, largeSafePrimeLen + SALT_LEN + GRUNT_VERSION_CHALLENGE_LEN)) { return 0; } msg.GetDataInSitu(reinterpret_cast(largeSafePrime), largeSafePrimeLen); msg.GetDataInSitu(reinterpret_cast(salt), SALT_LEN); - msg.GetDataInSitu(reinterpret_cast(versionChallenge), VERSION_CHALLENGE_LEN); + msg.GetDataInSitu(reinterpret_cast(versionChallenge), GRUNT_VERSION_CHALLENGE_LEN); uint8_t logonFlags; @@ -354,7 +354,7 @@ int32_t Grunt::ClientLink::CmdAuthReconnectChallenge(CDataStore& msg) { // Reconnect challenge success (result == 0) msg.GetDataInSitu(reinterpret_cast(reconnectKey), RECONNECT_KEY_LEN); - msg.GetDataInSitu(reinterpret_cast(versionChallenge), VERSION_CHALLENGE_LEN); + msg.GetDataInSitu(reinterpret_cast(versionChallenge), GRUNT_VERSION_CHALLENGE_LEN); if (!msg.IsValid()) { return 1; @@ -636,7 +636,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, 20); + SHA1_Update(&ctx, versionChecksum, GRUNT_VERSION_CHECKSUM_LEN); SHA1_Final(versionProof, &ctx); command.PutData(versionProof, sizeof(versionProof)); @@ -685,7 +685,7 @@ void Grunt::ClientLink::ProveVersion(const uint8_t* versionChecksum) { SHA1_Init(&sha1); SHA1_Update(&sha1, clientSalt, sizeof(clientSalt)); - SHA1_Update(&sha1, versionChecksum, 20); + SHA1_Update(&sha1, versionChecksum, GRUNT_VERSION_CHECKSUM_LEN); SHA1_Final(clientChecksum, &sha1); command.PutData(clientChecksum, sizeof(clientChecksum)); diff --git a/src/net/grunt/Types.hpp b/src/net/grunt/Types.hpp new file mode 100644 index 0000000..b8c7310 --- /dev/null +++ b/src/net/grunt/Types.hpp @@ -0,0 +1,7 @@ +#ifndef NET_GRUNT_TYPES_HPP +#define NET_GRUNT_TYPES_HPP + +#define GRUNT_VERSION_CHALLENGE_LEN 16 +#define GRUNT_VERSION_CHECKSUM_LEN 20 + +#endif diff --git a/src/net/login/GruntLogin.hpp b/src/net/login/GruntLogin.hpp index a035a94..012c701 100644 --- a/src/net/login/GruntLogin.hpp +++ b/src/net/login/GruntLogin.hpp @@ -1,14 +1,15 @@ #ifndef NET_LOGIN_GRUNT_LOGIN_HPP #define NET_LOGIN_GRUNT_LOGIN_HPP -#include "net/grunt/Grunt.hpp" #include "net/grunt/ClientResponse.hpp" +#include "net/grunt/Grunt.hpp" +#include "net/grunt/Types.hpp" #include "net/login/Login.hpp" class GruntLogin : public Login { public: // Member variables - uint8_t m_versionChallenge[16]; + uint8_t m_versionChallenge[GRUNT_VERSION_CHALLENGE_LEN]; Grunt::ClientLink* m_clientLink = nullptr; // Virtual member functions