mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-29 16:43:47 +00:00
feat(Core/Crypto): add support OpenSSL 3.0 (#13354)
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
#include "AccountMgr.h"
|
||||
#include "BanMgr.h"
|
||||
#include "ByteBuffer.h"
|
||||
#include "Common.h"
|
||||
#include "CryptoHash.h"
|
||||
#include "Log.h"
|
||||
#include "Opcodes.h"
|
||||
#include "Player.h"
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
#include <openssl/sha.h>
|
||||
|
||||
Warden::Warden() : _session(nullptr), _checkTimer(10000/*10 sec*/), _clientResponseTimer(0),
|
||||
_dataSent(false), _module(nullptr), _initialized(false)
|
||||
@@ -77,11 +76,11 @@ void Warden::RequestModule()
|
||||
LOG_DEBUG("warden", "Request module");
|
||||
|
||||
// Create packet structure
|
||||
WardenModuleUse request;
|
||||
WardenModuleUse request{};
|
||||
request.Command = WARDEN_SMSG_MODULE_USE;
|
||||
|
||||
memcpy(request.ModuleId, _module->Id, 16);
|
||||
memcpy(request.ModuleKey, _module->Key, 16);
|
||||
memcpy(request.ModuleId, _module->Id.data(), 16);
|
||||
memcpy(request.ModuleKey, _module->Key.data(), 16);
|
||||
request.Size = _module->CompressedSize;
|
||||
|
||||
EndianConvert(request.Size);
|
||||
@@ -155,30 +154,21 @@ bool Warden::IsValidCheckSum(uint32 checksum, const uint8* data, const uint16 le
|
||||
}
|
||||
}
|
||||
|
||||
struct keyData
|
||||
union keyData
|
||||
{
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint8 bytes[20];
|
||||
} bytes;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32 ints[5];
|
||||
} ints;
|
||||
};
|
||||
std::array<uint8, 20> bytes;
|
||||
std::array<uint32, 5> ints;
|
||||
};
|
||||
|
||||
uint32 Warden::BuildChecksum(const uint8* data, uint32 length)
|
||||
{
|
||||
keyData hash;
|
||||
SHA1(data, length, hash.bytes.bytes);
|
||||
keyData hash{};
|
||||
hash.bytes = Acore::Crypto::SHA1::GetDigestOf(data, size_t(length));
|
||||
uint32 checkSum = 0;
|
||||
|
||||
for (uint8 i = 0; i < 5; ++i)
|
||||
{
|
||||
checkSum = checkSum ^ hash.ints.ints[i];
|
||||
checkSum = checkSum ^ hash.ints[i];
|
||||
}
|
||||
|
||||
return checkSum;
|
||||
|
||||
Reference in New Issue
Block a user