mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 08:12:44 +03:00
chore(net): tidy up version challenge defines
This commit is contained in:
parent
4312158dfa
commit
b7b257f43f
@ -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 <common/MD5.hpp>
|
||||
#include <storm/Error.hpp>
|
||||
@ -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<void*&>(largeSafePrime), largeSafePrimeLen);
|
||||
msg.GetDataInSitu(reinterpret_cast<void*&>(salt), SALT_LEN);
|
||||
msg.GetDataInSitu(reinterpret_cast<void*&>(versionChallenge), VERSION_CHALLENGE_LEN);
|
||||
msg.GetDataInSitu(reinterpret_cast<void*&>(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<void*&>(reconnectKey), RECONNECT_KEY_LEN);
|
||||
msg.GetDataInSitu(reinterpret_cast<void*&>(versionChallenge), VERSION_CHALLENGE_LEN);
|
||||
msg.GetDataInSitu(reinterpret_cast<void*&>(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));
|
||||
|
||||
7
src/net/grunt/Types.hpp
Normal file
7
src/net/grunt/Types.hpp
Normal file
@ -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
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user