Core/Battle.net: Decrypt remainder of the packet that arrives together with EnableEncryption
This commit is contained in:
@@ -217,6 +217,7 @@ namespace Battlenet
|
||||
uint8* GetBuffer() { return _buffer.data(); }
|
||||
uint8 const* GetBuffer() const { return _buffer.data(); }
|
||||
|
||||
uint32 GetReadPos() const { return _readPos; }
|
||||
size_t GetSize() const { return ((_writePos + 7) & ~7) / 8; }
|
||||
|
||||
// These methods are meant to only be used when their corresponding actions in the client ignore the value completely
|
||||
|
||||
@@ -63,6 +63,8 @@ namespace Battlenet
|
||||
void Read() override { }
|
||||
std::string ToString() const override;
|
||||
void CallHandler(Session* session) override;
|
||||
uint8* GetRemainingData() { return _stream.GetBuffer() + (((_stream.GetReadPos() + 7) & ~7) / 8); }
|
||||
size_t GetRemainingSize() { return _stream.GetSize() - (((_stream.GetReadPos() + 7) & ~7) / 8); }
|
||||
};
|
||||
|
||||
class LogoutRequest final : public ClientPacket
|
||||
|
||||
@@ -393,9 +393,10 @@ void Battlenet::Session::HandlePing(Connection::Ping const& /*ping*/)
|
||||
AsyncWrite(new Connection::Pong());
|
||||
}
|
||||
|
||||
void Battlenet::Session::HandleEnableEncryption(Connection::EnableEncryption const& /*enableEncryption*/)
|
||||
void Battlenet::Session::HandleEnableEncryption(Connection::EnableEncryption& enableEncryption)
|
||||
{
|
||||
_crypt.Init(&K);
|
||||
_crypt.DecryptRecv(enableEncryption.GetRemainingData(), enableEncryption.GetRemainingSize());
|
||||
}
|
||||
|
||||
void Battlenet::Session::HandleLogoutRequest(Connection::LogoutRequest const& /*logoutRequest*/)
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace Battlenet
|
||||
|
||||
// Connection
|
||||
void HandlePing(Connection::Ping const& ping);
|
||||
void HandleEnableEncryption(Connection::EnableEncryption const& enableEncryption);
|
||||
void HandleEnableEncryption(Connection::EnableEncryption& enableEncryption);
|
||||
void HandleLogoutRequest(Connection::LogoutRequest const& logoutRequest);
|
||||
void HandleConnectionClosing(Connection::ConnectionClosing const& connectionClosing);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user