Core/Battle.net: Decrypt remainder of the packet that arrives together with EnableEncryption

This commit is contained in:
Shauren
2014-12-20 00:25:11 +01:00
parent 9f0051c4e5
commit c3e959b9db
4 changed files with 6 additions and 2 deletions
@@ -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
+2 -1
View File
@@ -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*/)
+1 -1
View File
@@ -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);