Files
WoWee/include/auth/integrity.hpp
Kelsi 568b03ea76 fix: harden world login pipeline and build-aware integrity hash
Login-critical opcodes (AUTH_CHALLENGE, AUTH_RESPONSE, CHAR_ENUM, etc.)
now fall back to hardcoded wire values when the opcode table fails to
load, preventing the "Unhandled world opcode: 0x1ec" symptom that
blocked character list retrieval.

OpcodeTable::loadFromJson() no longer wipes the working table on
failure — it loads into temporaries and only swaps on success.

Integrity hash now takes clientBuild: Classic-era DLLs (fmod.dll,
ijl15.dll, dbghelp.dll, unicows.dll) are only required for builds
<=6005 or Turtle; TBC/WotLK clients hash only the .exe.
2026-07-09 22:06:05 -07:00

39 lines
1.6 KiB
C++

#pragma once
#include <array>
#include <cstdint>
#include <string>
#include <vector>
namespace wowee {
namespace auth {
// Computes the LOGON_PROOF "CRC hash" / integrity hash for the legacy WoW login protocol.
//
// Algorithm (per WoWDev/gtker docs):
// checksum = HMAC_SHA1(checksumSalt, concatenated_file_bytes)
// crc_hash = SHA1(clientPublicKey || checksum)
//
// clientPublicKey is the 32-byte A as sent on the wire.
//
// Returns false if any file is missing/unreadable.
bool computeIntegrityHashWin32(const std::array<uint8_t, 16>& checksumSalt,
const std::vector<uint8_t>& clientPublicKeyA,
const std::string& miscDir,
std::array<uint8_t, 20>& outHash,
std::string& outError);
// Same as computeIntegrityHashWin32, but allows selecting the EXE filename used in the file set.
// clientBuild controls which companion DLLs are included: Classic (<=6005)
// needs fmod/ijl15/dbghelp/unicows; TBC/WotLK clients did not ship those.
bool computeIntegrityHashWin32WithExe(const std::array<uint8_t, 16>& checksumSalt,
const std::vector<uint8_t>& clientPublicKeyA,
const std::string& miscDir,
const std::string& exeName,
uint16_t clientBuild,
std::array<uint8_t, 20>& outHash,
std::string& outError);
} // namespace auth
} // namespace wowee