Batch #13186 by ragnarok-clanker: forced by an admin (40 lower score(s), 206 changed function(s)); checked with 620 compiled unit(s), including every includer of Source/Archive/GPak.h, Source/Client/Mode/CGameMode.h, Source/Client/Mode/CLoginMode.h, Source/Client/Session.h, Source/Client/Stove/StoveMgr.h, Source/Client/Stove/StovePCSDK.h, Source/Client/Timer.h, Source/Contents/Actors/GameActor.h, Source/Contents/Actors/RenderObject.h, Source/Contents/CashEmotionMgr.h, Source/Contents/Configuration/ServiceOptions.h, Source/Contents/Skills/SkillTreeScript.h, Source/Render/DX9/D3DX9Runtime.h, Source/Resource/GifResource.h, Source/UI/AdventureGuide/UIAdventureGuide.h, Source/UI/Cooldowns/CooldownOwner.h, Source/UI/Edit/UIEditBoxEx.h, Source/UI/Lists/UIListBoxTemplate.h, Source/UI/Quest/UIRenewQuestUI.h, Source/UI/Rodex/UIRodexComposeWnd.h, Source/UI/Text/UITextViewerControl.h, Source/UI/UIBroadcastBalloon.h, Source/UI/UICaptchaRegisterWnd.h, Source/UI/UIMacroDetectorWnd.h, Source/UI/UIReputeWnd.h, Source/UI/Window/UIRegisterMgr.h, Source/UI/Window/UISecondCostumeWnd.h, Source/UI/Window/UISelCharForUServerWnd.h, Source/UI/Window/UIWindow.h, Source/UI/Window/UIWindowMgr.h, Source/Utility/EncryptedName.h.
89 lines
2.2 KiB
C++
89 lines
2.2 KiB
C++
#include "Security/ThemidaMgr.h"
|
|
|
|
#include "Archive/GPak.h"
|
|
|
|
#include <new>
|
|
#include <random>
|
|
|
|
// GLOBAL: gl_24891
|
|
CThemidaMgr* g_themidaMgr;
|
|
|
|
struct ThemidaKeyEncoderA {
|
|
unsigned char* Generate(const unsigned char* input);
|
|
};
|
|
|
|
struct ThemidaKeyEncoderB {
|
|
unsigned char* Generate(const unsigned char* input);
|
|
};
|
|
|
|
// OFFSET: 0x0076EC00
|
|
// FUNCTION: fn_08235
|
|
CThemidaMgr::CThemidaMgr() : m_valid(true) {
|
|
}
|
|
|
|
// OFFSET: 0x0076EC10
|
|
// FUNCTION: fn_08236
|
|
CThemidaMgr::~CThemidaMgr() {
|
|
}
|
|
|
|
// OFFSET: 0x0076EC20
|
|
// FUNCTION: fn_08237
|
|
unsigned char* ThemidaKeyEncoderA::Generate(const unsigned char* input) {
|
|
auto* output = reinterpret_cast<unsigned char*>(this);
|
|
PakUniformRandom random(1, 0xfe, std::random_device{}());
|
|
FillRandomBytes(reinterpret_cast<char*>(output), reinterpret_cast<char*>(output) + 5, random);
|
|
output[5] = input[0] ^ output[1] ^ output[0];
|
|
output[6] = input[1] ^ output[2] ^ output[1];
|
|
output[7] = input[2] ^ output[3] ^ output[2];
|
|
output[8] = output[4] ^ input[3] ^ output[3];
|
|
return output;
|
|
}
|
|
|
|
// OFFSET: 0x0076ECC0
|
|
// FUNCTION: fn_08238
|
|
unsigned char* ThemidaKeyEncoderB::Generate(const unsigned char* input) {
|
|
auto* output = reinterpret_cast<unsigned char*>(this);
|
|
PakUniformRandom random(1, 0xfe, std::random_device{}());
|
|
FillRandomBytes(reinterpret_cast<char*>(output), reinterpret_cast<char*>(output) + 5, random);
|
|
output[5] = input[0] ^ output[1] ^ output[0];
|
|
output[6] = input[1] ^ output[2] ^ output[1];
|
|
output[7] = input[2] ^ output[3] ^ output[2];
|
|
output[8] = output[4] ^ input[3] ^ output[3];
|
|
return output;
|
|
}
|
|
|
|
// OFFSET: 0x0076EDE0
|
|
// FUNCTION: fn_08240
|
|
bool CThemidaMgr::Create() {
|
|
if (g_themidaMgr == nullptr) {
|
|
g_themidaMgr = new (std::nothrow) CThemidaMgr();
|
|
if (g_themidaMgr != nullptr) {
|
|
if (!g_themidaMgr->m_valid) {
|
|
delete g_themidaMgr;
|
|
g_themidaMgr = nullptr;
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// OFFSET: 0x0076EE90
|
|
// FUNCTION: fn_08241
|
|
void CThemidaMgr::Destroy() {
|
|
if (g_themidaMgr != nullptr) {
|
|
delete g_themidaMgr;
|
|
g_themidaMgr = nullptr;
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x0076EEB0
|
|
// FUNCTION: fn_08242
|
|
void CThemidaMgr::Check() {
|
|
}
|
|
|
|
// OFFSET: 0x0076F050
|
|
// FUNCTION: fn_08243
|
|
void CThemidaMgr::StopThread() {
|
|
}
|