From 6cb2d2461f869d5c9d986cccec5edf1021878df2 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Tue, 29 Apr 2014 17:37:15 +0200 Subject: Moved the rest of the Crypto objects into their own respective files. --- Tools/ProtoProxy/CMakeLists.txt | 6 ++++-- Tools/ProtoProxy/Connection.cpp | 4 ++-- Tools/ProtoProxy/Connection.h | 10 ++++++---- Tools/ProtoProxy/Globals.h | 6 ------ 4 files changed, 12 insertions(+), 14 deletions(-) (limited to 'Tools/ProtoProxy') diff --git a/Tools/ProtoProxy/CMakeLists.txt b/Tools/ProtoProxy/CMakeLists.txt index a2241f355..a136c95df 100644 --- a/Tools/ProtoProxy/CMakeLists.txt +++ b/Tools/ProtoProxy/CMakeLists.txt @@ -36,7 +36,8 @@ set(SHARED_SRC ../../src/StringUtils.cpp ../../src/Log.cpp ../../src/MCLogger.cpp - ../../src/Crypto.cpp + ../../src/PolarSSL++/AesCfb128Decryptor.cpp + ../../src/PolarSSL++/AesCfb128Encryptor.cpp ../../src/PolarSSL++/CtrDrbgContext.cpp ../../src/PolarSSL++/EntropyContext.cpp ../../src/PolarSSL++/PublicKey.cpp @@ -47,7 +48,8 @@ set(SHARED_HDR ../../src/StringUtils.h ../../src/Log.h ../../src/MCLogger.h - ../../src/Crypto.h + ../../src/PolarSSL++/AesCfb128Decryptor.h + ../../src/PolarSSL++/AesCfb128Encryptor.h ../../src/PolarSSL++/CtrDrbgContext.h ../../src/PolarSSL++/EntropyContext.h ../../src/PolarSSL++/PublicKey.h diff --git a/Tools/ProtoProxy/Connection.cpp b/Tools/ProtoProxy/Connection.cpp index fcbd9190c..26aed2206 100644 --- a/Tools/ProtoProxy/Connection.cpp +++ b/Tools/ProtoProxy/Connection.cpp @@ -472,7 +472,7 @@ bool cConnection::SendData(SOCKET a_Socket, cByteBuffer & a_Data, const char * a -bool cConnection::SendEncryptedData(SOCKET a_Socket, cAESCFBEncryptor & a_Encryptor, const char * a_Data, size_t a_Size, const char * a_Peer) +bool cConnection::SendEncryptedData(SOCKET a_Socket, cAesCfb128Encryptor & a_Encryptor, const char * a_Data, size_t a_Size, const char * a_Peer) { DataLog(a_Data, a_Size, "Encrypting %d bytes to %s", a_Size, a_Peer); const Byte * Data = (const Byte *)a_Data; @@ -496,7 +496,7 @@ bool cConnection::SendEncryptedData(SOCKET a_Socket, cAESCFBEncryptor & a_Encryp -bool cConnection::SendEncryptedData(SOCKET a_Socket, cAESCFBEncryptor & a_Encryptor, cByteBuffer & a_Data, const char * a_Peer) +bool cConnection::SendEncryptedData(SOCKET a_Socket, cAesCfb128Encryptor & a_Encryptor, cByteBuffer & a_Data, const char * a_Peer) { AString All; a_Data.ReadAll(All); diff --git a/Tools/ProtoProxy/Connection.h b/Tools/ProtoProxy/Connection.h index 9e04994b7..1fc9536de 100644 --- a/Tools/ProtoProxy/Connection.h +++ b/Tools/ProtoProxy/Connection.h @@ -11,6 +11,8 @@ #include "ByteBuffer.h" #include "OSSupport/Timer.h" +#include "PolarSSL++/AesCfb128Decryptor.h" +#include "PolarSSL++/AesCfb128Encryptor.h" @@ -66,8 +68,8 @@ protected: cByteBuffer m_ClientBuffer; cByteBuffer m_ServerBuffer; - cAESCFBDecryptor m_ServerDecryptor; - cAESCFBEncryptor m_ServerEncryptor; + cAesCfb128Decryptor m_ServerDecryptor; + cAesCfb128Encryptor m_ServerEncryptor; AString m_ServerEncryptionBuffer; // Buffer for the data to be sent to the server once encryption is established @@ -109,10 +111,10 @@ protected: bool SendData(SOCKET a_Socket, cByteBuffer & a_Data, const char * a_Peer); /// Sends data to the specfied socket, after encrypting it using a_Encryptor. If sending fails, prints a fail message using a_Peer and returns false - bool SendEncryptedData(SOCKET a_Socket, cAESCFBEncryptor & a_Encryptor, const char * a_Data, size_t a_Size, const char * a_Peer); + bool SendEncryptedData(SOCKET a_Socket, cAesCfb128Encryptor & a_Encryptor, const char * a_Data, size_t a_Size, const char * a_Peer); /// Sends data to the specfied socket, after encrypting it using a_Encryptor. If sending fails, prints a fail message using a_Peer and returns false - bool SendEncryptedData(SOCKET a_Socket, cAESCFBEncryptor & a_Encryptor, cByteBuffer & a_Data, const char * a_Peer); + bool SendEncryptedData(SOCKET a_Socket, cAesCfb128Encryptor & a_Encryptor, cByteBuffer & a_Data, const char * a_Peer); /// Decodes packets coming from the client, sends appropriate counterparts to the server; returns false if the connection is to be dropped bool DecodeClientsPackets(const char * a_Data, int a_Size); diff --git a/Tools/ProtoProxy/Globals.h b/Tools/ProtoProxy/Globals.h index 186efa611..54e7e9251 100644 --- a/Tools/ProtoProxy/Globals.h +++ b/Tools/ProtoProxy/Globals.h @@ -246,12 +246,6 @@ public: -#include "../../src/Crypto.h" - - - - - #define LOGERROR printf #define LOGINFO printf #define LOGWARNING printf -- cgit v1.2.3