fixed: crypto++ compile errors, linux compiler syntax bugs, and code style (spaces -> tabs)

This commit is contained in:
Nick Bolton 2013-04-11 00:30:41 +00:00
parent 650da22c33
commit c0dcdd52e7
10 changed files with 99 additions and 77 deletions

View File

@ -57,7 +57,7 @@ public:
//@}
#ifdef TEST_ENV
void handleDataForTest() { handleData(NULL, NULL); }
void handleDataForTest() { handleData(CEvent(), NULL); }
#endif
protected:

View File

@ -16,6 +16,7 @@
*/
#include "CCryptoMode.h"
#include "XSynergy.h"
using namespace CryptoPP;
@ -46,7 +47,7 @@ CCryptoMode::CCryptoMode(ECryptoMode mode, bool encryption) :
break;
default:
throw std::exception("crypto mode not set");
throw XBadCryptoMode();
}
}
else {
@ -71,7 +72,7 @@ CCryptoMode::CCryptoMode(ECryptoMode mode, bool encryption) :
break;
default:
throw std::exception("crypto mode not set");
throw XBadCryptoMode();
}
}
}

View File

@ -50,7 +50,7 @@ private:
typedef CryptoPP::CTR_Mode<CryptoPP::AES>::Decryption CCtrModeDec;
typedef CryptoPP::GCM<CryptoPP::AES>::Decryption CGcmModeDec;
static CCryptoMode::ECryptoMode parseMode(CString& mode);
static ECryptoMode parseMode(CString& mode);
ECryptoMode m_mode;
void* m_crypto;

View File

@ -16,6 +16,7 @@
*/
#include "CCryptoOptions.h"
#include "XSynergy.h"
CCryptoOptions::CCryptoOptions(
const CString& modeString,
@ -48,6 +49,6 @@ CCryptoOptions::parseMode(CString modeString)
return kGcm;
}
else {
throw std::exception("invalid crypto mode");
throw XBadCryptoMode();
}
}

View File

@ -17,9 +17,10 @@
#include "CCryptoStream.h"
#include "CLog.h"
#include "CCryptoOptions.h"
#include <sstream>
#include <string>
#include "CCryptoOptions.h"
#include <stdio.h>
using namespace CryptoPP;
using namespace synergy::crypto;

View File

@ -20,9 +20,10 @@
#include "BasicTypes.h"
#include "CStreamFilter.h"
#include "CCryptoMode.h"
#include "CCryptoOptions.h"
#include <cryptopp562/osrng.h>
#include "cryptopp562/sha.h"
#include <cryptopp562/sha.h>
class CCryptoOptions;
#define CRYPTO_IV_SIZE CryptoPP::AES::BLOCKSIZE

View File

@ -29,6 +29,15 @@ XBadClient::getWhat() const throw()
return "XBadClient";
}
//
// XBadCryptoMode
//
CString
XBadCryptoMode::getWhat() const throw()
{
return "XBadCryptoMode";
}
//
// XIncompatibleClient

View File

@ -30,6 +30,12 @@ Thrown when the client fails to follow the protocol.
*/
XBASE_SUBCLASS_WHAT(XBadClient, XSynergy);
//! Bad crypto mode
/*!
Thrown when the user enters an invalid crypto mode.
*/
XBASE_SUBCLASS_WHAT(XBadCryptoMode, XSynergy);
//! Incompatible client exception
/*!
Thrown when a client attempting to connect has an incompatible version.

View File

@ -20,6 +20,7 @@
#include "CMockStream.h"
#include "CMockEventQueue.h"
#include "CPacketStreamFilter.h"
#include "CCryptoOptions.h"
using ::testing::_;
using ::testing::Invoke;

View File

@ -31,7 +31,7 @@ file(GLOB cpp_ignore
${cpp_dir}/algebra.cpp)
list(REMOVE_ITEM cpp_src ${cpp_ignore})
# 64-bit windows - compile asm file.
# if 64-bit windows, compile asm file.
if (CMAKE_CL_64)
list(APPEND cpp_src ${cpp_dir}/x64dll.asm ${cpp_dir}/x64masm.asm)
@ -46,6 +46,8 @@ if(CMAKE_CL_64)
"${CMAKE_CURRENT_SOURCE_DIR}/${cpp_dir}/x64masm.asm"
MAIN_DEPENDENCY ${cpp_dir}/x64masm.asm
VERBATIM)
else()
add_definitions(-DCRYPTOPP_DISABLE_ASM)
endif()
if (APPLE)