summaryrefslogtreecommitdiffstats
path: root/source/Protocol132.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-09-04 12:17:27 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-09-04 12:17:27 +0200
commit49f682883437d85ae2a59eeec221912df698c7b1 (patch)
treece61dc8cb31b62978204b8d42ee7e5d6573d5cb3 /source/Protocol132.cpp
parentProtocol proxy now decrypts the data (but doesn't understand the packets yet) (diff)
downloadcuberite-49f682883437d85ae2a59eeec221912df698c7b1.tar
cuberite-49f682883437d85ae2a59eeec221912df698c7b1.tar.gz
cuberite-49f682883437d85ae2a59eeec221912df698c7b1.tar.bz2
cuberite-49f682883437d85ae2a59eeec221912df698c7b1.tar.lz
cuberite-49f682883437d85ae2a59eeec221912df698c7b1.tar.xz
cuberite-49f682883437d85ae2a59eeec221912df698c7b1.tar.zst
cuberite-49f682883437d85ae2a59eeec221912df698c7b1.zip
Diffstat (limited to 'source/Protocol132.cpp')
-rw-r--r--source/Protocol132.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/source/Protocol132.cpp b/source/Protocol132.cpp
index 43aedc934..2a0b7a605 100644
--- a/source/Protocol132.cpp
+++ b/source/Protocol132.cpp
@@ -8,7 +8,7 @@
#include "cRoot.h"
#include "cServer.h"
#include "cClientHandle.h"
-#include "CryptoPP/osrng.h"
+#include "CryptoPP/randpool.h"
#include "cItem.h"
#include "ChunkDataSerializer.h"
#include "cPlayer.h"
@@ -568,7 +568,7 @@ void cProtocol132::SendEncryptionKeyRequest(const AString & a_Key)
WriteShort((short)a_Key.size());
SendData(a_Key.data(), a_Key.size());
WriteShort(4);
- WriteInt((int)this); // Using 'this' as the cryptographic nonce, so that we don't have to generate one each time :)
+ WriteInt((int)(intptr_t)this); // Using 'this' as the cryptographic nonce, so that we don't have to generate one each time :)
Flush();
}
@@ -580,7 +580,9 @@ void cProtocol132::HandleEncryptionKeyResponse(const AString & a_EncKey, const A
{
// Decrypt EncNonce using privkey
RSAES<PKCS1v15>::Decryptor rsaDecryptor(cRoot::Get()->GetServer()->GetPrivateKey());
- AutoSeededRandomPool rng;
+ time_t CurTime = time(NULL);
+ CryptoPP::RandomPool rng;
+ rng.Put((const byte *)&CurTime, sizeof(CurTime));
byte DecryptedNonce[MAX_ENC_LEN];
DecodingResult res = rsaDecryptor.Decrypt(rng, (const byte *)a_EncNonce.data(), a_EncNonce.size(), DecryptedNonce);
if (!res.isValidCoding || (res.messageLength != 4))