mirror of
https://github.com/debauchee/barrier.git
synced 2025-06-16 17:51:42 +02:00
sending IV to client before DKDN, DKUP and DKRP (the most sensitive messages). unit tests to support changes. made crypto stream tests a bit less spammy by using NiceMock.
This commit is contained in:
parent
23998fc06c
commit
7010de9cc4
37 changed files with 490 additions and 227 deletions
|
@ -24,13 +24,14 @@
|
|||
#include <cstring>
|
||||
#include <memory>
|
||||
#include "CServer.h"
|
||||
#include "CCryptoStream.h"
|
||||
|
||||
//
|
||||
// CClientProxy1_4
|
||||
//
|
||||
|
||||
CClientProxy1_4::CClientProxy1_4(const CString& name, synergy::IStream* stream, CServer* server) :
|
||||
CClientProxy1_3(name, stream), m_server(server)
|
||||
CClientProxy1_4::CClientProxy1_4(const CString& name, synergy::IStream* stream, CServer* server, IEventQueue* eventQueue) :
|
||||
CClientProxy1_3(name, stream, eventQueue), m_server(server)
|
||||
{
|
||||
assert(m_server != NULL);
|
||||
}
|
||||
|
@ -67,6 +68,43 @@ CClientProxy1_4::gameDeviceTimingReq()
|
|||
CProtocolUtil::writef(getStream(), kMsgCGameTimingReq);
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_4::keyDown(KeyID key, KeyModifierMask mask, KeyButton button)
|
||||
{
|
||||
cryptoIv();
|
||||
CClientProxy1_3::keyDown(key, mask, button);
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_4::keyRepeat(KeyID key, KeyModifierMask mask, SInt32 count, KeyButton button)
|
||||
{
|
||||
cryptoIv();
|
||||
CClientProxy1_3::keyRepeat(key, mask, count, button);
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_4::keyUp(KeyID key, KeyModifierMask mask, KeyButton button)
|
||||
{
|
||||
cryptoIv();
|
||||
CClientProxy1_3::keyUp(key, mask, button);
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_4::cryptoIv()
|
||||
{
|
||||
CCryptoStream* cryptoStream = dynamic_cast<CCryptoStream*>(getStream());
|
||||
if (cryptoStream == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
byte iv[CRYPTO_IV_SIZE];
|
||||
cryptoStream->newIv(iv);
|
||||
CString data(reinterpret_cast<const char*>(iv), CRYPTO_IV_SIZE);
|
||||
|
||||
LOG((CLOG_DEBUG2 "send crypto iv change to \"%s\"", getName().c_str()));
|
||||
CProtocolUtil::writef(getStream(), kMsgDCryptoIv, &data);
|
||||
}
|
||||
|
||||
bool
|
||||
CClientProxy1_4::parseMessage(const UInt8* code)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue