diff --git a/CMakeLists.txt b/CMakeLists.txt
index 82c2f925..e55b4a17 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -319,7 +319,6 @@ else() # not-unix
endif()
add_subdirectory(src)
-add_subdirectory(ext)
if (WIN32)
# TODO: consider using /analyze to uncover potential bugs in the source code.
diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt
deleted file mode 100644
index d7f0ca2b..00000000
--- a/ext/CMakeLists.txt
+++ /dev/null
@@ -1,96 +0,0 @@
-# synergy -- mouse and keyboard sharing utility
-# Copyright (C) 2013 Synergy Si Ltd.
-#
-# This package is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# found in the file COPYING that should have accompanied this file.
-#
-# This package is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see .
-
-set(cryptopp_dir cryptopp562)
-
-# only compile the crypto++ files we need.
-set(cryptopp_src
- ${cryptopp_dir}/3way.cpp
- ${cryptopp_dir}/algparam.cpp
- ${cryptopp_dir}/asn.cpp
- ${cryptopp_dir}/authenc.cpp
- ${cryptopp_dir}/basecode.cpp
- ${cryptopp_dir}/cpu.cpp
- ${cryptopp_dir}/cryptlib.cpp
- ${cryptopp_dir}/des.cpp
- ${cryptopp_dir}/dessp.cpp
- ${cryptopp_dir}/dll.cpp
- ${cryptopp_dir}/ec2n.cpp
- ${cryptopp_dir}/ecp.cpp
- ${cryptopp_dir}/filters.cpp
- ${cryptopp_dir}/fips140.cpp
- ${cryptopp_dir}/gcm.cpp
- ${cryptopp_dir}/gf2n.cpp
- ${cryptopp_dir}/gfpcrypt.cpp
- ${cryptopp_dir}/hex.cpp
- ${cryptopp_dir}/hmac.cpp
- ${cryptopp_dir}/hrtimer.cpp
- ${cryptopp_dir}/integer.cpp
- ${cryptopp_dir}/iterhash.cpp
- ${cryptopp_dir}/misc.cpp
- ${cryptopp_dir}/modes.cpp
- ${cryptopp_dir}/mqueue.cpp
- ${cryptopp_dir}/nbtheory.cpp
- ${cryptopp_dir}/oaep.cpp
- ${cryptopp_dir}/osrng.cpp
- ${cryptopp_dir}/pubkey.cpp
- ${cryptopp_dir}/queue.cpp
- ${cryptopp_dir}/randpool.cpp
- ${cryptopp_dir}/rdtables.cpp
- ${cryptopp_dir}/rijndael.cpp
- ${cryptopp_dir}/rng.cpp
- ${cryptopp_dir}/sha.cpp
-)
-
-# if 64-bit windows, compile asm file.
-if (CMAKE_CL_64)
- list(APPEND cryptopp_src ${cryptopp_dir}/x64dll.asm ${cryptopp_dir}/x64masm.asm)
-
- add_custom_command(OUTPUT $(IntDir)x64dll.obj
- COMMAND ml64.exe /c /nologo /Fo$(IntDir)x64dll.obj /Zi
- "${CMAKE_CURRENT_SOURCE_DIR}/${cryptopp_dir}/x64dll.asm"
- MAIN_DEPENDENCY ${cryptopp_dir}/x64dll.asm
- VERBATIM)
-
- add_custom_command(OUTPUT $(IntDir)x64masm.obj
- COMMAND ml64.exe /c /nologo /Fo$(IntDir)x64masm.obj /Zi
- "${CMAKE_CURRENT_SOURCE_DIR}/${cryptopp_dir}/x64masm.asm"
- MAIN_DEPENDENCY ${cryptopp_dir}/x64masm.asm
- VERBATIM)
-endif()
-
-if (UNIX)
- add_definitions(-DCRYPTOPP_DISABLE_ASM)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O2 -pipe")
-
- if (APPLE)
- if (DARWIN_VERSION GREATER 10)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-tautological-compare")
- endif()
- else()
- set(CRYPTOPP_ARCH "native")
- if ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "^arm.*")
- set(CRYPTOPP_ARCH "armv6zk")
- endif()
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=${CRYPTOPP_ARCH}")
- endif()
-endif()
-
-add_library(cryptopp STATIC ${cryptopp_src})
-
-if (UNIX)
- # ignore warnings in crypto++
- set_target_properties(cryptopp PROPERTIES COMPILE_FLAGS "-w")
-endif()
diff --git a/ext/cryptopp562.zip b/ext/cryptopp562.zip
deleted file mode 100644
index ab4fd0c7..00000000
Binary files a/ext/cryptopp562.zip and /dev/null differ
diff --git a/ext/toolchain/commands1.py b/ext/toolchain/commands1.py
index d0b0960a..d4372cda 100644
--- a/ext/toolchain/commands1.py
+++ b/ext/toolchain/commands1.py
@@ -247,9 +247,6 @@ class InternalCommands:
# by default, unknown
macIdentity = None
- # cryptoPP dir with version number
- cryptoPPDir = 'cryptopp562'
-
# gtest dir with version number
gtestDir = 'gtest-1.6.0'
@@ -320,22 +317,6 @@ class InternalCommands:
for target in targets:
self.configure(target)
- def checkCryptoPP(self):
-
- dir = self.extDir + '/' + self.cryptoPPDir
- if (os.path.isdir(dir)):
- return
-
- zipFilename = dir + '.zip'
- if (not os.path.exists(zipFilename)):
- raise Exception('Crypto++ zip not found at: ' + zipFilename)
-
- if not os.path.exists(dir):
- os.mkdir(dir)
-
- zip = zipfile.ZipFile(zipFilename)
- self.zipExtractAll(zip, dir)
-
def checkGTest(self):
dir = self.extDir + '/' + self.gtestDir
@@ -464,8 +445,6 @@ class InternalCommands:
# if not visual studio, use parent dir
sourceDir = generator.getSourceDir()
- # ensure that the cryptopp source exists
- self.checkCryptoPP()
self.checkGTest()
self.checkGMock()
diff --git a/src/cmd/synergyc/CMakeLists.txt b/src/cmd/synergyc/CMakeLists.txt
index b48a0fbd..c7be50b5 100644
--- a/src/cmd/synergyc/CMakeLists.txt
+++ b/src/cmd/synergyc/CMakeLists.txt
@@ -58,7 +58,7 @@ endif()
add_executable(synergyc ${sources})
target_link_libraries(synergyc
- arch base client common io mt net ipc platform server synergy cryptopp ${libs})
+ arch base client common io mt net ipc platform server synergy ${libs})
if (CONF_CPACK)
install(TARGETS
diff --git a/src/cmd/synergyd/CMakeLists.txt b/src/cmd/synergyd/CMakeLists.txt
index ad9ba5ef..d4065594 100644
--- a/src/cmd/synergyd/CMakeLists.txt
+++ b/src/cmd/synergyd/CMakeLists.txt
@@ -35,7 +35,7 @@ else()
endif()
target_link_libraries(synergyd
- arch base common io ipc mt net platform synergy cryptopp ${libs})
+ arch base common io ipc mt net platform synergy ${libs})
if (CONF_CPACK)
install(TARGETS
diff --git a/src/cmd/synergyp/CMakeLists.txt b/src/cmd/synergyp/CMakeLists.txt
index 7e0ee20a..0582367c 100644
--- a/src/cmd/synergyp/CMakeLists.txt
+++ b/src/cmd/synergyp/CMakeLists.txt
@@ -63,7 +63,7 @@ else()
endif()
target_link_libraries(synergyp
- arch base client common io mt net ipc platform server synergy client cryptopp ${libs})
+ arch base client common io mt net ipc platform server synergy client ${libs})
if (CONF_CPACK)
install(TARGETS
diff --git a/src/cmd/synergys/CMakeLists.txt b/src/cmd/synergys/CMakeLists.txt
index bd79d1fd..76d03325 100644
--- a/src/cmd/synergys/CMakeLists.txt
+++ b/src/cmd/synergys/CMakeLists.txt
@@ -58,7 +58,7 @@ endif()
add_executable(synergys ${sources})
target_link_libraries(synergys
- arch base client common io mt net ipc platform server synergy cryptopp ${libs})
+ arch base client common io mt net ipc platform server synergy ${libs})
if (CONF_CPACK)
install(TARGETS
diff --git a/src/cmd/syntool/CMakeLists.txt b/src/cmd/syntool/CMakeLists.txt
index 1847c133..c65a28ed 100644
--- a/src/cmd/syntool/CMakeLists.txt
+++ b/src/cmd/syntool/CMakeLists.txt
@@ -29,7 +29,7 @@ endif()
add_executable(syntool ${sources})
target_link_libraries(syntool
- synergy arch base client common io ipc mt net platform server cryptopp ${libs})
+ synergy arch base client common io ipc mt net platform server ${libs})
if (CONF_CPACK)
install(TARGETS
diff --git a/src/gui/res/SettingsDialogBase.ui b/src/gui/res/SettingsDialogBase.ui
index d45b69bc..9e3f7757 100644
--- a/src/gui/res/SettingsDialogBase.ui
+++ b/src/gui/res/SettingsDialogBase.ui
@@ -1,353 +1,326 @@
-
-
- SettingsDialogBase
-
-
-
- 0
- 0
- 368
- 354
-
-
-
- Settings
-
-
- -
-
-
- &Miscellaneous
-
-
-
-
-
-
-
- 75
- 0
-
-
-
- Sc&reen name:
-
-
- m_pLineEditScreenName
-
-
-
- -
-
-
- true
-
-
-
- -
-
-
- P&ort:
-
-
- m_pSpinBoxPort
-
-
-
- -
-
-
- true
-
-
-
- 0
- 0
-
-
-
- 65535
-
-
- 24800
-
-
-
- -
-
-
- &Interface:
-
-
- m_pLineEditInterface
-
-
-
- -
-
-
- true
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 75
- 0
-
-
-
- &Language:
-
-
- m_pComboLanguage
-
-
-
- -
-
-
- -
-
-
- Elevate mode
-
-
-
-
-
-
- -
-
-
- true
-
-
-
- 0
- 0
-
-
-
- &Encryption
-
-
-
- QFormLayout::AllNonFixedFieldsGrow
-
-
-
-
-
-
- 75
- 0
-
-
-
- Pass&word:
-
-
- m_pLineEditCryptoPass
-
-
-
- -
-
-
- false
-
-
- QLineEdit::Password
-
-
-
- -
-
-
- Enable
-
-
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Logging
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
-
-
- false
-
-
-
-
-
-
-
- 75
- 0
-
-
-
- &Logging level:
-
-
- m_pComboLogLevel
-
-
-
- -
-
-
-
-
- Error
-
-
- -
-
- Warning
-
-
- -
-
- Note
-
-
- -
-
- Info
-
-
- -
-
- Debug
-
-
- -
-
- Debug1
-
-
- -
-
- Debug2
-
-
-
-
- -
-
-
- Log to file:
-
-
-
- -
-
-
- false
-
-
-
- -
-
-
- false
-
-
- Browse...
-
-
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QDialogButtonBox::Cancel|QDialogButtonBox::Ok
-
-
-
-
-
-
- m_pComboLanguage
- m_pLineEditScreenName
- m_pSpinBoxPort
- m_pLineEditInterface
- m_pLineEditCryptoPass
- m_pComboLogLevel
- m_pCheckBoxLogToFile
- m_pLineEditLogFilename
- m_pButtonBrowseLog
- buttonBox
-
-
-
-
- buttonBox
- accepted()
- SettingsDialogBase
- accept()
-
-
- 266
- 340
-
-
- 157
- 274
-
-
-
-
- buttonBox
- rejected()
- SettingsDialogBase
- reject()
-
-
- 334
- 340
-
-
- 286
- 274
-
-
-
-
-
+
+
+ SettingsDialogBase
+
+
+
+ 0
+ 0
+ 368
+ 377
+
+
+
+ Settings
+
+
+ -
+
+
+ &Miscellaneous
+
+
+
-
+
+
+
+ 75
+ 0
+
+
+
+ Sc&reen name:
+
+
+ m_pLineEditScreenName
+
+
+
+ -
+
+
+ true
+
+
+
+ -
+
+
+ P&ort:
+
+
+ m_pSpinBoxPort
+
+
+
+ -
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+ 65535
+
+
+ 24800
+
+
+
+ -
+
+
+ &Interface:
+
+
+ m_pLineEditInterface
+
+
+
+ -
+
+
+ true
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 75
+ 0
+
+
+
+ &Language:
+
+
+ m_pComboLanguage
+
+
+
+ -
+
+
+ -
+
+
+ Elevate mode
+
+
+
+
+
+
+ -
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+ &Encryption
+
+
+
+ QFormLayout::AllNonFixedFieldsGrow
+
+
-
+
+
+ Enable
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Logging
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+
+
+ false
+
+
+
-
+
+
+
+ 75
+ 0
+
+
+
+ &Logging level:
+
+
+ m_pComboLogLevel
+
+
+
+ -
+
+
-
+
+ Error
+
+
+ -
+
+ Warning
+
+
+ -
+
+ Note
+
+
+ -
+
+ Info
+
+
+ -
+
+ Debug
+
+
+ -
+
+ Debug1
+
+
+ -
+
+ Debug2
+
+
+
+
+ -
+
+
+ Log to file:
+
+
+
+ -
+
+
+ false
+
+
+
+ -
+
+
+ false
+
+
+ Browse...
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+
+
+
+ m_pComboLanguage
+ m_pLineEditScreenName
+ m_pSpinBoxPort
+ m_pLineEditInterface
+ m_pComboLogLevel
+ m_pCheckBoxLogToFile
+ m_pLineEditLogFilename
+ m_pButtonBrowseLog
+ buttonBox
+
+
+
+
+ buttonBox
+ accepted()
+ SettingsDialogBase
+ accept()
+
+
+ 266
+ 340
+
+
+ 157
+ 274
+
+
+
+
+ buttonBox
+ rejected()
+ SettingsDialogBase
+ reject()
+
+
+ 334
+ 340
+
+
+ 286
+ 274
+
+
+
+
+
diff --git a/src/gui/src/AppConfig.cpp b/src/gui/src/AppConfig.cpp
index a3014cf2..7cb04636 100644
--- a/src/gui/src/AppConfig.cpp
+++ b/src/gui/src/AppConfig.cpp
@@ -53,7 +53,6 @@ AppConfig::AppConfig(QSettings* settings) :
m_Interface(),
m_LogLevel(0),
m_WizardLastRun(0),
- m_CryptoPass(),
m_ProcessMode(DEFAULT_PROCESS_MODE),
m_AutoConfig(true),
m_ElevateMode(false),
@@ -121,8 +120,6 @@ void AppConfig::loadSettings()
m_LogToFile = settings().value("logToFile", false).toBool();
m_LogFilename = settings().value("logFilename", synergyLogDir() + "synergy.log").toString();
m_WizardLastRun = settings().value("wizardLastRun", 0).toInt();
- m_CryptoPass = settings().value("cryptoPass", "").toString();
- m_CryptoEnabled = settings().value("cryptoEnabled", false).toBool();
m_Language = settings().value("language", QLocale::system().name()).toString();
m_StartedBefore = settings().value("startedBefore", false).toBool();
m_AutoConfig = settings().value("autoConfig", true).toBool();
@@ -142,8 +139,6 @@ void AppConfig::saveSettings()
settings().setValue("logToFile", m_LogToFile);
settings().setValue("logFilename", m_LogFilename);
settings().setValue("wizardLastRun", kWizardVersion);
- settings().setValue("cryptoPass", m_CryptoPass);
- settings().setValue("cryptoEnabled", m_CryptoEnabled);
settings().setValue("language", m_Language);
settings().setValue("startedBefore", m_StartedBefore);
settings().setValue("autoConfig", m_AutoConfig);
@@ -154,22 +149,6 @@ void AppConfig::saveSettings()
settings().setValue("userToken", m_UserToken);
}
-void AppConfig::setCryptoPass(const QString &s)
-{
- // clear field to user doesn't get confused.
- if (s.isEmpty())
- {
- m_CryptoPass.clear();
- return;
- }
-
- // only hash if password changes -- don't re-hash the hash.
- if (m_CryptoPass != s)
- {
- m_CryptoPass = hash(s);
- }
-}
-
void AppConfig::setAutoConfig(bool autoConfig)
{
m_AutoConfig = autoConfig;
diff --git a/src/gui/src/AppConfig.h b/src/gui/src/AppConfig.h
index 5a079ce4..91f9a512 100644
--- a/src/gui/src/AppConfig.h
+++ b/src/gui/src/AppConfig.h
@@ -61,9 +61,6 @@ class AppConfig
const QString& logFilename() const { return m_LogFilename; }
const QString logFilenameCmd() const;
QString logLevelText() const;
- const QString& cryptoPass() const { return m_CryptoPass; }
- bool cryptoEnabled() const { return m_CryptoEnabled; }
- QString cryptoModeString() const;
ProcessMode processMode() const { return m_ProcessMode; }
bool wizardShouldRun() const { return m_WizardLastRun < kWizardVersion; }
const QString& language() const { return m_Language; }
@@ -96,7 +93,6 @@ class AppConfig
void setLogLevel(int i) { m_LogLevel = i; }
void setLogToFile(bool b) { m_LogToFile = b; }
void setLogFilename(const QString& s) { m_LogFilename = s; }
- void setCryptoEnabled(bool b) { m_CryptoEnabled = b; }
void setWizardHasRun() { m_WizardLastRun = kWizardVersion; }
void setLanguage(const QString language) { m_Language = language; }
void setStartedBefore(bool b) { m_StartedBefore = b; }
@@ -105,8 +101,6 @@ class AppConfig
void loadSettings();
void saveSettings();
- void setCryptoPass(const QString& s);
-
private:
QSettings* m_pSettings;
QString m_ScreenName;
@@ -116,8 +110,6 @@ class AppConfig
bool m_LogToFile;
QString m_LogFilename;
int m_WizardLastRun;
- bool m_CryptoEnabled;
- QString m_CryptoPass;
ProcessMode m_ProcessMode;
QString m_Language;
bool m_StartedBefore;
diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp
index eebd753f..d65f0ded 100644
--- a/src/gui/src/MainWindow.cpp
+++ b/src/gui/src/MainWindow.cpp
@@ -418,11 +418,6 @@ void MainWindow::startSynergy()
args << "--name" << getScreenName();
- if (appConfig().cryptoEnabled())
- {
- args << "--crypto-pass" << appConfig().cryptoPass();
- }
-
if (desktopMode)
{
setSynergyProcess(new QProcess(this));
diff --git a/src/gui/src/SettingsDialog.cpp b/src/gui/src/SettingsDialog.cpp
index 1fa18e1c..8a99e96d 100644
--- a/src/gui/src/SettingsDialog.cpp
+++ b/src/gui/src/SettingsDialog.cpp
@@ -43,12 +43,7 @@ SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
m_pComboLogLevel->setCurrentIndex(appConfig().logLevel());
m_pCheckBoxLogToFile->setChecked(appConfig().logToFile());
m_pLineEditLogFilename->setText(appConfig().logFilename());
- m_pCheckBoxEnableCrypto->setChecked(appConfig().cryptoEnabled());
setIndexFromItemData(m_pComboLanguage, appConfig().language());
- if (appConfig().cryptoEnabled())
- {
- m_pLineEditCryptoPass->setText(appConfig().cryptoPass());
- }
#if defined(Q_OS_WIN)
m_SuppressElevateWarning = true;
@@ -62,26 +57,12 @@ SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
void SettingsDialog::accept()
{
- const QString& cryptoPass = m_pLineEditCryptoPass->text();
- bool cryptoEnabled = m_pCheckBoxEnableCrypto->isChecked();
- if (cryptoEnabled && cryptoPass.isEmpty())
- {
- QMessageBox message;
- message.setWindowTitle("Settings");
- message.setIcon(QMessageBox::Information);
- message.setText(tr("Encryption password must not be empty."));
- message.exec();
- return;
- }
-
appConfig().setScreenName(m_pLineEditScreenName->text());
appConfig().setPort(m_pSpinBoxPort->value());
appConfig().setInterface(m_pLineEditInterface->text());
appConfig().setLogLevel(m_pComboLogLevel->currentIndex());
appConfig().setLogToFile(m_pCheckBoxLogToFile->isChecked());
appConfig().setLogFilename(m_pLineEditLogFilename->text());
- appConfig().setCryptoEnabled(cryptoEnabled);
- appConfig().setCryptoPass(cryptoPass);
appConfig().setLanguage(m_pComboLanguage->itemData(m_pComboLanguage->currentIndex()).toString());
appConfig().setElevateMode(m_pCheckBoxElevateMode->isChecked());
appConfig().saveSettings();
@@ -141,13 +122,6 @@ void SettingsDialog::on_m_pButtonBrowseLog_clicked()
void SettingsDialog::on_m_pCheckBoxEnableCrypto_stateChanged(int )
{
- bool cryptoEnabled = m_pCheckBoxEnableCrypto->isChecked();
- m_pLineEditCryptoPass->setEnabled(cryptoEnabled);
-
- if (!cryptoEnabled)
- {
- m_pLineEditCryptoPass->clear();
- }
}
void SettingsDialog::on_m_pComboLanguage_currentIndexChanged(int index)
diff --git a/src/lib/client/Client.cpp b/src/lib/client/Client.cpp
index 8b7d5b69..59fae82c 100644
--- a/src/lib/client/Client.cpp
+++ b/src/lib/client/Client.cpp
@@ -30,7 +30,6 @@
#include "synergy/FileChunker.h"
#include "synergy/IPlatformScreen.h"
#include "mt/Thread.h"
-#include "io/CryptoStream.h"
#include "net/TCPSocket.h"
#include "net/IDataSocket.h"
#include "net/ISocketFactory.h"
@@ -61,7 +60,6 @@ Client::Client(
const String& name, const NetworkAddress& address,
ISocketFactory* socketFactory,
synergy::Screen* screen,
- const CryptoOptions& crypto,
bool enableDragDrop) :
m_mock(false),
m_name(name),
@@ -76,8 +74,6 @@ Client::Client(
m_suspended(false),
m_connectOnResume(false),
m_events(events),
- m_cryptoStream(NULL),
- m_crypto(crypto),
m_sendFileThread(NULL),
m_writeToDropDirThread(NULL),
m_enableDragDrop(enableDragDrop),
@@ -165,12 +161,6 @@ Client::connect()
bool adopt = !m_useSecureNetwork;
m_stream = new PacketStreamFilter(m_events, m_stream, adopt);
- if (m_crypto.m_mode != kDisabled) {
- m_cryptoStream = new CryptoStream(
- m_events, m_stream, m_crypto, true);
- m_stream = m_cryptoStream;
- }
-
// connect
LOG((CLOG_DEBUG1 "connecting to server"));
setupConnecting();
@@ -211,14 +201,6 @@ Client::handshakeComplete()
sendEvent(m_events->forClient().connected(), NULL);
}
-void
-Client::setDecryptIv(const UInt8* iv)
-{
- if (m_cryptoStream != NULL) {
- m_cryptoStream->setDecryptIv(iv);
- }
-}
-
bool
Client::isConnected() const
{
diff --git a/src/lib/client/Client.h b/src/lib/client/Client.h
index be32999f..786f301c 100644
--- a/src/lib/client/Client.h
+++ b/src/lib/client/Client.h
@@ -24,7 +24,6 @@
#include "synergy/DragInformation.h"
#include "synergy/INode.h"
#include "net/NetworkAddress.h"
-#include "io/CryptoOptions.h"
#include "base/EventTypes.h"
class EventQueueTimer;
@@ -34,7 +33,6 @@ class IDataSocket;
class ISocketFactory;
namespace synergy { class IStream; }
class IEventQueue;
-class CryptoStream;
class Thread;
class TCPSocket;
@@ -61,7 +59,6 @@ public:
const String& name, const NetworkAddress& address,
ISocketFactory* socketFactory,
synergy::Screen* screen,
- const CryptoOptions& crypto,
bool enableDragDrop);
~Client();
@@ -91,9 +88,6 @@ public:
*/
virtual void handshakeComplete();
- //! Set crypto IV for decryption
- virtual void setDecryptIv(const UInt8* iv);
-
//! Clears the file buffer
void clearReceivedFileData();
@@ -223,8 +217,6 @@ private:
IClipboard::Time m_timeClipboard[kClipboardEnd];
String m_dataClipboard[kClipboardEnd];
IEventQueue* m_events;
- CryptoStream* m_cryptoStream;
- CryptoOptions m_crypto;
std::size_t m_expectedFileSize;
String m_receivedFileData;
DragFileList m_dragFileList;
diff --git a/src/lib/client/ServerProxy.cpp b/src/lib/client/ServerProxy.cpp
index 3fe493c0..b6632cf0 100644
--- a/src/lib/client/ServerProxy.cpp
+++ b/src/lib/client/ServerProxy.cpp
@@ -24,7 +24,6 @@
#include "synergy/option_types.h"
#include "synergy/protocol_types.h"
#include "io/IStream.h"
-#include "io/CryptoStream.h"
#include "base/Log.h"
#include "base/IEventQueue.h"
#include "base/TMethodEventJob.h"
@@ -295,10 +294,6 @@ ServerProxy::parseMessage(const UInt8* code)
setOptions();
}
- else if (memcmp(code, kMsgDCryptoIv, 4) == 0) {
- cryptoIv();
- }
-
else if (memcmp(code, kMsgDFileTransfer, 4) == 0) {
fileChunkReceived();
}
@@ -763,18 +758,6 @@ ServerProxy::mouseWheel()
m_client->mouseWheel(xDelta, yDelta);
}
-void
-ServerProxy::cryptoIv()
-{
- // parse
- String s;
- ProtocolUtil::readf(m_stream, kMsgDCryptoIv + 4, &s);
- LOG((CLOG_DEBUG2 "recv crypto iv size=%i", s.size()));
-
- // forward
- m_client->setDecryptIv(reinterpret_cast(s.c_str()));
-}
-
void
ServerProxy::screensaver()
{
diff --git a/src/lib/client/ServerProxy.h b/src/lib/client/ServerProxy.h
index 5efbce95..5f2b357f 100644
--- a/src/lib/client/ServerProxy.h
+++ b/src/lib/client/ServerProxy.h
@@ -99,7 +99,6 @@ private:
void mouseMove();
void mouseRelativeMove();
void mouseWheel();
- void cryptoIv();
void screensaver();
void resetOptions();
void setOptions();
diff --git a/src/lib/io/CMakeLists.txt b/src/lib/io/CMakeLists.txt
index f4b770b8..3a619061 100644
--- a/src/lib/io/CMakeLists.txt
+++ b/src/lib/io/CMakeLists.txt
@@ -23,7 +23,6 @@ endif()
include_directories(
../
- ../../../ext
)
if (UNIX)
@@ -33,7 +32,3 @@ if (UNIX)
endif()
add_library(io STATIC ${sources})
-
-if (UNIX)
- target_link_libraries(io cryptopp)
-endif()
diff --git a/src/lib/io/CryptoMode.cpp b/src/lib/io/CryptoMode.cpp
deleted file mode 100644
index 3736597b..00000000
--- a/src/lib/io/CryptoMode.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
-* synergy -- mouse and keyboard sharing utility
-* Copyright (C) 2013 Synergy Si Ltd.
-*
-* This package is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License
-* found in the file COPYING that should have accompanied this file.
-*
-* This package is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see .
-*/
-
-#include "io/CryptoMode.h"
-
-#include "io/XIO.h"
-
-using namespace CryptoPP;
-
-CryptoMode::CryptoMode(ECryptoMode mode, bool encryption) :
- m_mode(mode),
- m_crypto(NULL),
- m_encryption(encryption)
-{
- if (m_encryption) {
- switch (m_mode) {
- case kCfb:
- m_crypto = new CfbModeEnc;
- break;
-
- case kDisabled:
- break;
-
- default:
- throw XIOBadCryptoMode();
- }
- }
- else {
- switch (m_mode) {
- case kCfb:
- m_crypto = new CfbModeDec;
- break;
-
- case kDisabled:
- break;
-
- default:
- throw XIOBadCryptoMode();
- }
- }
-}
-
-CryptoMode::~CryptoMode()
-{
- if (m_crypto == NULL) {
- return;
- }
-
- if (m_encryption) {
- delete reinterpret_cast(m_crypto);
- }
- else {
- delete reinterpret_cast(m_crypto);
- }
-}
-
-void
-CryptoMode::processData(byte* out, const byte* in, size_t length)
-{
- if (m_crypto == NULL) {
- return;
- }
-
- if (m_encryption) {
- reinterpret_cast(m_crypto)->ProcessData(out, in, length);
- }
- else {
- reinterpret_cast(m_crypto)->ProcessData(out, in, length);
- }
-}
-
-
-void
-CryptoMode::setKeyWithIv(const byte* key, size_t length, const byte* iv)
-{
- if (m_crypto == NULL) {
- return;
- }
-
- if (m_encryption) {
- reinterpret_cast(m_crypto)->SetKeyWithIV(key, length, iv);
- }
- else {
- reinterpret_cast(m_crypto)->SetKeyWithIV(key, length, iv);
- }
-}
diff --git a/src/lib/io/CryptoMode.h b/src/lib/io/CryptoMode.h
deleted file mode 100644
index 5262834f..00000000
--- a/src/lib/io/CryptoMode.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * synergy -- mouse and keyboard sharing utility
- * Copyright (C) 2013 Synergy Si Ltd.
- *
- * This package is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * found in the file COPYING that should have accompanied this file.
- *
- * This package is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#pragma once
-
-#include "io/ECryptoMode.h"
-
-#include "io/CryptoMode_cryptopp.h"
-#include "base/String.h"
-
-//! Encapsulation of modes
-/*!
-Polymorphism is tricky in Crypto++, so we encapsulate all crypto modes
-and switch based on an enum for ctor, dtor and all functions.
-*/
-class CryptoMode {
-public:
- CryptoMode(ECryptoMode mode, bool encryption = true);
- ~CryptoMode();
-
- //! Encrypt or decrypt data
- void processData(byte* out, const byte* in, size_t length);
-
- //! Variable length key and initialization vector
- void setKeyWithIv(const byte* key, size_t length, const byte* iv);
-
-private:
- typedef CryptoPP::OFB_Mode::Encryption OfbModeEnc;
- typedef CryptoPP::CFB_Mode::Encryption CfbModeEnc;
- typedef CryptoPP::CTR_Mode::Encryption CtrModeEnc;
- typedef CryptoPP::GCM::Encryption GcmModeEnc;
-
- typedef CryptoPP::OFB_Mode::Decryption OfbModeDec;
- typedef CryptoPP::CFB_Mode::Decryption CfbModeDec;
- typedef CryptoPP::CTR_Mode::Decryption CtrModeDec;
- typedef CryptoPP::GCM::Decryption GcmModeDec;
-
- static ECryptoMode parseMode(String& mode);
-
- ECryptoMode m_mode;
- void* m_crypto;
- bool m_encryption;
-};
diff --git a/src/lib/io/CryptoMode_cryptopp.h b/src/lib/io/CryptoMode_cryptopp.h
deleted file mode 100644
index 57ebba17..00000000
--- a/src/lib/io/CryptoMode_cryptopp.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * synergy -- mouse and keyboard sharing utility
- * Copyright (C) 2014 Synergy Si Ltd.
- *
- * This package is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * found in the file COPYING that should have accompanied this file.
- *
- * This package is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#pragma once
-
-// HACK: gcc on osx106 doesn't give you an easy way to hide warnings
-// from included headers, so use the system_header pragma. the downside
-// is that everything in the header file following this also has warnings
-// ignored, so we need to put it in a separate header file (this file).
-#if __APPLE__
-# pragma GCC system_header
-#endif
-
-#include
-#include
-#include
diff --git a/src/lib/io/CryptoOptions.cpp b/src/lib/io/CryptoOptions.cpp
deleted file mode 100644
index 70ea382e..00000000
--- a/src/lib/io/CryptoOptions.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * synergy -- mouse and keyboard sharing utility
- * Copyright (C) 2013 Synergy Si Ltd.
- *
- * This package is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * found in the file COPYING that should have accompanied this file.
- *
- * This package is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#include "io/CryptoOptions.h"
-#include "io/XIO.h"
-
-CryptoOptions::CryptoOptions(
- const String& modeString,
- const String& pass) :
- m_pass(pass),
- m_mode(parseMode(modeString))
-{
-}
-
-void
-CryptoOptions::setMode(String modeString)
-{
- m_modeString = modeString;
- m_mode = parseMode(modeString);
-}
-
-ECryptoMode
-CryptoOptions::parseMode(String modeString)
-{
- if (modeString == "cfb") {
- return kCfb;
- }
- else {
- throw XIOBadCryptoMode();
- }
-}
diff --git a/src/lib/io/CryptoOptions.h b/src/lib/io/CryptoOptions.h
deleted file mode 100644
index 74157fb8..00000000
--- a/src/lib/io/CryptoOptions.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * synergy -- mouse and keyboard sharing utility
- * Copyright (C) 2013 Synergy Si Ltd.
- *
- * This package is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * found in the file COPYING that should have accompanied this file.
- *
- * This package is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#pragma once
-
-#include "base/String.h"
-#include "io/ECryptoMode.h"
-
-//! Encapsulates basic crypto options
-class CryptoOptions {
-public:
- CryptoOptions() : m_mode(kDisabled) { }
- CryptoOptions(const String& modeString, const String& pass);
-
- //! Return enum for mode string
- static ECryptoMode parseMode(String modeString);
-
- //! Parse and set mode string
- void setMode(String modeString);
-
- String m_pass;
- ECryptoMode m_mode;
- String m_modeString;
-};
diff --git a/src/lib/io/CryptoStream.cpp b/src/lib/io/CryptoStream.cpp
deleted file mode 100644
index 64321ea0..00000000
--- a/src/lib/io/CryptoStream.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * synergy -- mouse and keyboard sharing utility
- * Copyright (C) 2013 Synergy Si Ltd.
- *
- * This package is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * found in the file COPYING that should have accompanied this file.
- *
- * This package is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#include "io/CryptoStream.h"
-
-#include "io/CryptoOptions.h"
-#include "base/Log.h"
-
-#include
-#include
-#include
-
-using namespace CryptoPP;
-using namespace synergy::crypto;
-
-CryptoStream::CryptoStream(
- IEventQueue* events,
- synergy::IStream* stream,
- const CryptoOptions& options,
- bool adoptStream) :
- StreamFilter(events, stream, adoptStream),
- m_key(NULL),
- m_encryption(options.m_mode, true),
- m_decryption(options.m_mode, false)
-{
- LOG((CLOG_INFO "crypto mode: %s", options.m_modeString.c_str()));
-
- m_key = new byte[kKeyLength];
- if (!options.m_pass.empty()) {
- createKey(m_key, options.m_pass, kKeyLength, static_cast(options.m_pass.length()));
-
- byte iv[CRYPTO_IV_SIZE];
- createKey(iv, options.m_pass, CRYPTO_IV_SIZE, static_cast(options.m_pass.length()) * 2);
- setEncryptIv(iv);
- setDecryptIv(iv);
- }
-}
-
-CryptoStream::~CryptoStream()
-{
- delete[] m_key;
-}
-
-UInt32
-CryptoStream::read(void* out, UInt32 n)
-{
- assert(m_key != NULL);
- LOG((CLOG_DEBUG4 "crypto: read %i (decrypt)", n));
-
- byte* cypher = new byte[n];
- size_t result = getStream()->read(cypher, n);
- if (result == 0) {
- // nothing to read.
- return 0;
- }
-
- if (result != n) {
- LOG((CLOG_ERR "crypto: decrypt failed, only %i of %i bytes", result, n));
- return 0;
- }
-
- logBuffer("cypher", cypher, n);
- m_decryption.processData(static_cast(out), cypher, n);
- logBuffer("plaintext", static_cast(out), n);
- delete[] cypher;
- return static_cast(result);
-}
-
-void
-CryptoStream::write(const void* in, UInt32 n)
-{
- assert(m_key != NULL);
- LOG((CLOG_DEBUG4 "crypto: write %i (encrypt)", n));
-
- logBuffer("plaintext", static_cast(const_cast(in)), n);
- byte* cypher = new byte[n];
- m_encryption.processData(cypher, static_cast(in), n);
- logBuffer("cypher", cypher, n);
- getStream()->write(cypher, n);
- delete[] cypher;
-}
-
-void
-CryptoStream::createKey(byte* out, const String& password, UInt8 keyLength, UInt8 hashCount)
-{
- assert(keyLength <= SHA256::DIGESTSIZE);
-
- byte temp[SHA256::DIGESTSIZE];
- byte* in = reinterpret_cast(const_cast(password.c_str()));
- SHA256().CalculateDigest(temp, in, password.length());
-
- byte* tempKey = new byte[SHA256::DIGESTSIZE];
- for (int i = 0; i < hashCount; ++i) {
- memcpy(tempKey, temp, SHA256::DIGESTSIZE);
- SHA256().CalculateDigest(temp, tempKey, SHA256::DIGESTSIZE);
- }
- delete[] tempKey;
-
- memcpy(out, temp, keyLength);
-}
-
-void
-CryptoStream::setEncryptIv(const byte* iv)
-{
- assert(m_key != NULL);
- logBuffer("encrypt iv", iv, CRYPTO_IV_SIZE);
- m_encryption.setKeyWithIv(m_key, kKeyLength, iv);
-}
-
-void
-CryptoStream::setDecryptIv(const byte* iv)
-{
- assert(m_key != NULL);
- logBuffer("decrypt iv", iv, CRYPTO_IV_SIZE);
- m_decryption.setKeyWithIv(m_key, kKeyLength, iv);
-}
-
-void
-CryptoStream::newIv(byte* out)
-{
- m_autoSeedRandomPool.GenerateBlock(out, CRYPTO_IV_SIZE);
-}
-
-void
-CryptoStream::logBuffer(const char* name, const byte* buf, int length)
-{
- if (CLOG->getFilter() < kDEBUG4) {
- return;
- }
-
- std::stringstream ss;
- ss << "crypto: " << name << ":";
-
- char buffer[4];
- for (int i = 0; i < length; i++) {
- sprintf(buffer, " %02X", buf[i]);
- ss << buffer;
- }
-
- LOG((CLOG_DEBUG4 "%s", ss.str().c_str()));
-}
diff --git a/src/lib/io/CryptoStream.h b/src/lib/io/CryptoStream.h
deleted file mode 100644
index 48d4a1fb..00000000
--- a/src/lib/io/CryptoStream.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * synergy -- mouse and keyboard sharing utility
- * Copyright (C) 2013 Synergy Si Ltd.
- *
- * This package is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * found in the file COPYING that should have accompanied this file.
- *
- * This package is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#pragma once
-
-#include "io/StreamFilter.h"
-#include "io/CryptoMode.h"
-#include "io/CryptoStream_cryptopp.h"
-#include "base/EventTypes.h"
-
-class CryptoOptions;
-
-#define CRYPTO_IV_SIZE CryptoPP::AES::BLOCKSIZE
-
-//! Bidirectional encrypted stream
-/*!
-Encrypts (on write) and decrypts (on read) to and from an underlying stream.
-*/
-class CryptoStream : public StreamFilter {
-public:
- CryptoStream(IEventQueue* events, synergy::IStream* stream, const CryptoOptions& options, bool adoptStream = true);
- virtual ~CryptoStream();
-
- //! @name manipulators
- //@{
-
- //! Read from stream
- /*!
- Read up to \p n bytes into \p buffer to the stream using encryption.
- Returns the number of bytes read by the underlying stream.
- */
- virtual UInt32 read(void* out, UInt32 n);
-
- //! Write to stream
- /*!
- Write \c n bytes from \c buffer to the stream using encryption.
- */
- virtual void write(const void* in, UInt32 n);
-
- //! Set the IV for encryption
- void setEncryptIv(const byte* iv);
-
- //! Set the IV for decryption
- void setDecryptIv(const byte* iv);
-
- //! Get a new IV
- /*!
- Writes a new IV to the \c out buffer, and also uses the IV for further
- crypto.
- */
- void newIv(byte* out);
-
- //! Creates a key from a password
- static void createKey(byte* out, const String& password, UInt8 keyLength, UInt8 hashCount);
-
-private:
- void logBuffer(const char* name, const byte* buf, int length);
-
- byte* m_key;
- CryptoMode m_encryption;
- CryptoMode m_decryption;
- CryptoPP::AutoSeededRandomPool m_autoSeedRandomPool;
-};
-
-namespace synergy {
-namespace crypto {
-
-const UInt32 kKeyLength = 32;
-
-}
-}
diff --git a/src/lib/io/CryptoStream_cryptopp.h b/src/lib/io/CryptoStream_cryptopp.h
deleted file mode 100644
index 2678f9fc..00000000
--- a/src/lib/io/CryptoStream_cryptopp.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * synergy -- mouse and keyboard sharing utility
- * Copyright (C) 2014 Synergy Si Ltd.
- *
- * This package is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * found in the file COPYING that should have accompanied this file.
- *
- * This package is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#pragma once
-
-// HACK: gcc on osx106 doesn't give you an easy way to hide warnings
-// from included headers, so use the system_header pragma. the downside
-// is that everything in the header file following this also has warnings
-// ignored, so we need to put it in a separate header file (this file).
-#if __APPLE__
-# pragma GCC system_header
-#endif
-
-#include
-#include
diff --git a/src/lib/io/ECryptoMode.h b/src/lib/io/ECryptoMode.h
deleted file mode 100644
index 1b33457c..00000000
--- a/src/lib/io/ECryptoMode.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
-* synergy -- mouse and keyboard sharing utility
-* Copyright (C) 2013 Synergy Si Ltd.
-*
-* This package is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License
-* found in the file COPYING that should have accompanied this file.
-*
-* This package is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see .
-*/
-
-#pragma once
-
-enum ECryptoMode {
- kDisabled,
- kCfb,
- kNumOfModes
-};
diff --git a/src/lib/io/XIO.cpp b/src/lib/io/XIO.cpp
index 3ab39627..ef6e4090 100644
--- a/src/lib/io/XIO.cpp
+++ b/src/lib/io/XIO.cpp
@@ -49,13 +49,3 @@ XIOWouldBlock::getWhat() const throw()
{
return format("XIOWouldBlock", "stream operation would block");
}
-
-
-//
-// XBadCryptoMode
-//
-String
-XIOBadCryptoMode::getWhat() const throw()
-{
- return "XBadCryptoMode";
-}
diff --git a/src/lib/io/XIO.h b/src/lib/io/XIO.h
index e4470ebd..2e3976fd 100644
--- a/src/lib/io/XIO.h
+++ b/src/lib/io/XIO.h
@@ -47,9 +47,3 @@ XBASE_SUBCLASS_WHAT(XIOEndOfStream, XIO);
Thrown if an operation on a stream would block.
*/
XBASE_SUBCLASS_WHAT(XIOWouldBlock, XIO);
-
-//! I/O bad crypto mode exception
-/*!
-Thrown when the user enters an invalid crypto mode.
-*/
-XBASE_SUBCLASS_WHAT(XIOBadCryptoMode, XIO);
diff --git a/src/lib/plugin/ns/CMakeLists.txt b/src/lib/plugin/ns/CMakeLists.txt
index 4884d5a7..06cd7d85 100644
--- a/src/lib/plugin/ns/CMakeLists.txt
+++ b/src/lib/plugin/ns/CMakeLists.txt
@@ -55,7 +55,7 @@ if (UNIX)
endif()
target_link_libraries(ns
- arch base client common io mt net ipc platform server synergy cryptopp ${libs} ${OPENSSL_LIBS})
+ arch base client common io mt net ipc platform server synergy ${libs} ${OPENSSL_LIBS})
if (WIN32)
add_custom_command(
diff --git a/src/lib/server/ClientListener.cpp b/src/lib/server/ClientListener.cpp
index 946c7705..12018bc0 100644
--- a/src/lib/server/ClientListener.cpp
+++ b/src/lib/server/ClientListener.cpp
@@ -25,8 +25,6 @@
#include "net/IListenSocket.h"
#include "net/ISocketFactory.h"
#include "net/XSocket.h"
-#include "io/CryptoStream.h"
-#include "io/CryptoOptions.h"
#include "base/Log.h"
#include "base/IEventQueue.h"
#include "base/TMethodEventJob.h"
@@ -43,11 +41,9 @@ static const char s_networkSecurity[] = { "libns" };
ClientListener::ClientListener(const NetworkAddress& address,
ISocketFactory* socketFactory,
- const CryptoOptions& crypto,
IEventQueue* events) :
m_socketFactory(socketFactory),
m_server(NULL),
- m_crypto(crypto),
m_events(events)
{
assert(m_socketFactory != NULL);
@@ -149,12 +145,6 @@ ClientListener::handleClientConnecting(const Event&, void*)
// filter socket messages, including a packetizing filter
bool adopt = !m_useSecureNetwork;
stream = new PacketStreamFilter(m_events, stream, adopt);
-
- if (m_crypto.m_mode != kDisabled) {
- CryptoStream* cryptoStream = new CryptoStream(
- m_events, stream, m_crypto, true);
- stream = cryptoStream;
- }
assert(m_server != NULL);
diff --git a/src/lib/server/ClientListener.h b/src/lib/server/ClientListener.h
index b92887aa..a9cf0109 100644
--- a/src/lib/server/ClientListener.h
+++ b/src/lib/server/ClientListener.h
@@ -19,7 +19,6 @@
#pragma once
#include "server/Config.h"
-#include "io/CryptoOptions.h"
#include "base/EventTypes.h"
#include "base/Event.h"
#include "common/stddeque.h"
@@ -38,7 +37,6 @@ public:
// The factories are adopted.
ClientListener(const NetworkAddress&,
ISocketFactory*,
- const CryptoOptions& crypto,
IEventQueue* events);
~ClientListener();
@@ -84,7 +82,6 @@ private:
NewClients m_newClients;
WaitingClients m_waitingClients;
Server* m_server;
- CryptoOptions m_crypto;
IEventQueue* m_events;
bool m_useSecureNetwork;
};
diff --git a/src/lib/server/ClientProxy.h b/src/lib/server/ClientProxy.h
index 1cadad25..a603d719 100644
--- a/src/lib/server/ClientProxy.h
+++ b/src/lib/server/ClientProxy.h
@@ -49,8 +49,7 @@ public:
//! Get stream
/*!
- Returns a crypto stream if the user has this enabled,
- otherwise returns the original stream passed to the c'tor.
+ Returns the original stream passed to the c'tor.
*/
synergy::IStream* getStream() const;
diff --git a/src/lib/server/ClientProxy1_4.cpp b/src/lib/server/ClientProxy1_4.cpp
index 1e0095e2..ba6c35b7 100644
--- a/src/lib/server/ClientProxy1_4.cpp
+++ b/src/lib/server/ClientProxy1_4.cpp
@@ -20,7 +20,6 @@
#include "server/Server.h"
#include "synergy/ProtocolUtil.h"
-#include "io/CryptoStream.h"
#include "base/Log.h"
#include "base/IEventQueue.h"
#include "base/TMethodEventJob.h"
@@ -45,47 +44,23 @@ ClientProxy1_4::~ClientProxy1_4()
void
ClientProxy1_4::keyDown(KeyID key, KeyModifierMask mask, KeyButton button)
{
- cryptoIv();
ClientProxy1_3::keyDown(key, mask, button);
}
void
ClientProxy1_4::keyRepeat(KeyID key, KeyModifierMask mask, SInt32 count, KeyButton button)
{
- cryptoIv();
ClientProxy1_3::keyRepeat(key, mask, count, button);
}
void
ClientProxy1_4::keyUp(KeyID key, KeyModifierMask mask, KeyButton button)
{
- cryptoIv();
ClientProxy1_3::keyUp(key, mask, button);
}
void
ClientProxy1_4::keepAlive()
{
- cryptoIv();
ClientProxy1_3::keepAlive();
}
-
-void
-ClientProxy1_4::cryptoIv()
-{
- CryptoStream* cryptoStream = dynamic_cast(getStream());
- if (cryptoStream == NULL) {
- return;
- }
-
- byte iv[CRYPTO_IV_SIZE];
- cryptoStream->newIv(iv);
- String data(reinterpret_cast(iv), CRYPTO_IV_SIZE);
-
- LOG((CLOG_DEBUG2 "send crypto iv change to \"%s\"", getName().c_str()));
- ProtocolUtil::writef(getStream(), kMsgDCryptoIv, &data);
-
- // change IV only after we've sent the current IV, otherwise
- // the client won't be able to decrypt the new IV.
- cryptoStream->setEncryptIv(iv);
-}
diff --git a/src/lib/server/ClientProxy1_4.h b/src/lib/server/ClientProxy1_4.h
index 621f6ed1..7f2828df 100644
--- a/src/lib/server/ClientProxy1_4.h
+++ b/src/lib/server/ClientProxy1_4.h
@@ -42,8 +42,5 @@ public:
virtual void keyUp(KeyID key, KeyModifierMask mask, KeyButton button);
virtual void keepAlive();
- //! Send IV to make
- void cryptoIv();
-
Server* m_server;
};
diff --git a/src/lib/synergy/App.h b/src/lib/synergy/App.h
index 75d32597..3f886a59 100644
--- a/src/lib/synergy/App.h
+++ b/src/lib/synergy/App.h
@@ -163,7 +163,6 @@ private:
"* --restart restart the server automatically if it fails.\n" \
" -l --log write log messages to file.\n" \
" --no-tray disable the system tray icon.\n" \
- " --crypto-pass enable encryption, using the given password.\n" \
" --enable-drag-drop enable file drag & drop.\n"
#define HELP_COMMON_INFO_2 \
diff --git a/src/lib/synergy/ArgParser.cpp b/src/lib/synergy/ArgParser.cpp
index 6f0307a9..77d301cd 100644
--- a/src/lib/synergy/ArgParser.cpp
+++ b/src/lib/synergy/ArgParser.cpp
@@ -245,10 +245,6 @@ ArgParser::parseGenericArgs(int argc, const char* const* argv, int& i)
else if (isArg(i, argc, argv, NULL, "--client")) {
// HACK: stop error happening when using portable (synergyp)
}
- else if (isArg(i, argc, argv, NULL, "--crypto-pass")) {
- argsBase().m_crypto.m_pass = argv[++i];
- argsBase().m_crypto.setMode("cfb");
- }
else if (isArg(i, argc, argv, NULL, "--enable-drag-drop")) {
bool useDragDrop = true;
diff --git a/src/lib/synergy/ArgsBase.h b/src/lib/synergy/ArgsBase.h
index 5aedbdf0..b8d2bd83 100644
--- a/src/lib/synergy/ArgsBase.h
+++ b/src/lib/synergy/ArgsBase.h
@@ -19,7 +19,6 @@
#pragma once
#include "base/String.h"
-#include "io/CryptoOptions.h"
class ArgsBase {
public:
@@ -36,7 +35,6 @@ public:
String m_name;
bool m_disableTray;
bool m_enableIpc;
- CryptoOptions m_crypto;
bool m_enableDragDrop;
#if SYSAPI_WIN32
bool m_debugServiceWait;
diff --git a/src/lib/synergy/ClientApp.cpp b/src/lib/synergy/ClientApp.cpp
index a6b297ac..0297a58d 100644
--- a/src/lib/synergy/ClientApp.cpp
+++ b/src/lib/synergy/ClientApp.cpp
@@ -334,7 +334,7 @@ ClientApp::handleClientDisconnected(const Event&, void*)
Client*
ClientApp::openClient(const String& name, const NetworkAddress& address,
- synergy::Screen* screen, const CryptoOptions& crypto)
+ synergy::Screen* screen)
{
Client* client = new Client(
m_events,
@@ -342,7 +342,6 @@ ClientApp::openClient(const String& name, const NetworkAddress& address,
address,
new TCPSocketFactory(m_events, getSocketMultiplexer()),
screen,
- crypto,
args().m_enableDragDrop);
try {
@@ -401,7 +400,7 @@ ClientApp::startClient()
if (m_clientScreen == NULL) {
clientScreen = openClientScreen();
m_client = openClient(args().m_name,
- *m_serverAddress, clientScreen, args().m_crypto);
+ *m_serverAddress, clientScreen);
m_clientScreen = clientScreen;
LOG((CLOG_NOTE "started client"));
}
diff --git a/src/lib/synergy/ClientApp.h b/src/lib/synergy/ClientApp.h
index 4a172f3b..67b40610 100644
--- a/src/lib/synergy/ClientApp.h
+++ b/src/lib/synergy/ClientApp.h
@@ -26,7 +26,6 @@ class Client;
class NetworkAddress;
class Thread;
class ClientArgs;
-class CryptoOptions;
class ClientApp : public App {
public:
@@ -66,7 +65,7 @@ public:
void handleClientFailed(const Event& e, void*);
void handleClientDisconnected(const Event&, void*);
Client* openClient(const String& name, const NetworkAddress& address,
- synergy::Screen* screen, const CryptoOptions& crypto);
+ synergy::Screen* screen);
void closeClient(Client* client);
bool startClient();
void stopClient();
diff --git a/src/lib/synergy/ServerApp.cpp b/src/lib/synergy/ServerApp.cpp
index bd1be71a..7127c273 100644
--- a/src/lib/synergy/ServerApp.cpp
+++ b/src/lib/synergy/ServerApp.cpp
@@ -632,9 +632,7 @@ ServerApp::openClientListener(const NetworkAddress& address)
{
ClientListener* listen = new ClientListener(
address,
- new TCPSocketFactory(m_events, getSocketMultiplexer()),
- args().m_crypto,
- m_events);
+ new TCPSocketFactory(m_events, getSocketMultiplexer()), m_events);
m_events->adoptHandler(
m_events->forClientListener().connected(), listen,
diff --git a/src/lib/synergy/protocol_types.cpp b/src/lib/synergy/protocol_types.cpp
index a61eb0e8..1a7493fe 100644
--- a/src/lib/synergy/protocol_types.cpp
+++ b/src/lib/synergy/protocol_types.cpp
@@ -44,7 +44,6 @@ const char* kMsgDMouseWheel1_0 = "DMWM%2i";
const char* kMsgDClipboard = "DCLP%1i%4i%s";
const char* kMsgDInfo = "DINF%2i%2i%2i%2i%2i%2i%2i";
const char* kMsgDSetOptions = "DSOP%4I";
-const char* kMsgDCryptoIv = "DCIV%s";
const char* kMsgDFileTransfer = "DFTR%1i%s";
const char* kMsgDDragInfo = "DDRG%2i%s";
const char* kMsgQInfo = "QINF";
diff --git a/src/lib/synergy/protocol_types.h b/src/lib/synergy/protocol_types.h
index 811c309b..8d3a128f 100644
--- a/src/lib/synergy/protocol_types.h
+++ b/src/lib/synergy/protocol_types.h
@@ -27,6 +27,7 @@
// 1.3: adds keep alive and deprecates heartbeats,
// adds horizontal mouse scrolling
// 1.4: adds crypto support
+// 1.5: adds file transfer and removes home brew crypto
// NOTE: with new version, synergy minor version should increment
static const SInt16 kProtocolMajorVersion = 1;
static const SInt16 kProtocolMinorVersion = 5;
@@ -251,11 +252,6 @@ extern const char* kMsgDInfo;
// pairs.
extern const char* kMsgDSetOptions;
-// crypto iv: primary -> secondary
-// sends a new iv (initialization vector) to the client for the
-// cryptography stream.
-extern const char* kMsgDCryptoIv;
-
// file data: primary <-> secondary
// transfer file data. A mark is used in the first byte.
// 0 means the content followed is the file size.
diff --git a/src/lib/synwinhk/synwinhk.cpp b/src/lib/synwinhk/synwinhk.cpp
index 8aa3707b..d19ab993 100644
--- a/src/lib/synwinhk/synwinhk.cpp
+++ b/src/lib/synwinhk/synwinhk.cpp
@@ -236,7 +236,7 @@ static
bool
doKeyboardHookHandler(WPARAM wParam, LPARAM lParam)
{
- DWORD vkCode = wParam;
+ DWORD vkCode = static_cast(wParam);
bool kf_up = (lParam & (KF_UP << 16)) != 0;
// check for special events indicating if we should start or stop
diff --git a/src/test/integtests/CMakeLists.txt b/src/test/integtests/CMakeLists.txt
index b00f2621..3a4e6ad9 100644
--- a/src/test/integtests/CMakeLists.txt
+++ b/src/test/integtests/CMakeLists.txt
@@ -68,4 +68,4 @@ endif()
add_executable(integtests ${sources})
target_link_libraries(integtests
- arch base client common io ipc mt net platform server synergy gtest gmock cryptopp ${libs})
+ arch base client common io ipc mt net platform server synergy gtest gmock ${libs})
diff --git a/src/test/integtests/net/NetworkTests.cpp b/src/test/integtests/net/NetworkTests.cpp
index 74349718..11455d6c 100644
--- a/src/test/integtests/net/NetworkTests.cpp
+++ b/src/test/integtests/net/NetworkTests.cpp
@@ -32,7 +32,6 @@
#include "net/SocketMultiplexer.h"
#include "net/NetworkAddress.h"
#include "net/TCPSocketFactory.h"
-#include "io/CryptoOptions.h"
#include "mt/Thread.h"
#include "base/TMethodEventJob.h"
#include "base/TMethodJob.h"
@@ -109,14 +108,13 @@ TEST_F(NetworkTests, sendToClient_mockData)
{
// server and client
NetworkAddress serverAddress(TEST_HOST, TEST_PORT);
- CryptoOptions cryptoOptions;
-
+
serverAddress.resolve();
// server
SocketMultiplexer serverSocketMultiplexer;
TCPSocketFactory* serverSocketFactory = new TCPSocketFactory(&m_events, &serverSocketMultiplexer);
- ClientListener listener(serverAddress, serverSocketFactory, cryptoOptions, &m_events);
+ ClientListener listener(serverAddress, serverSocketFactory, &m_events);
NiceMock serverScreen;
NiceMock primaryClient;
NiceMock serverConfig;
@@ -142,7 +140,7 @@ TEST_F(NetworkTests, sendToClient_mockData)
ON_CALL(clientScreen, getShape(_, _, _, _)).WillByDefault(Invoke(getScreenShape));
ON_CALL(clientScreen, getCursorPos(_, _)).WillByDefault(Invoke(getCursorPos));
- Client client(&m_events, "stub", serverAddress, clientSocketFactory, &clientScreen, cryptoOptions, true);
+ Client client(&m_events, "stub", serverAddress, clientSocketFactory, &clientScreen, true);
m_events.adoptHandler(
m_events.forIScreen().fileRecieveCompleted(), &client,
@@ -162,14 +160,13 @@ TEST_F(NetworkTests, sendToClient_mockFile)
{
// server and client
NetworkAddress serverAddress(TEST_HOST, TEST_PORT);
- CryptoOptions cryptoOptions;
-
+
serverAddress.resolve();
// server
SocketMultiplexer serverSocketMultiplexer;
TCPSocketFactory* serverSocketFactory = new TCPSocketFactory(&m_events, &serverSocketMultiplexer);
- ClientListener listener(serverAddress, serverSocketFactory, cryptoOptions, &m_events);
+ ClientListener listener(serverAddress, serverSocketFactory, &m_events);
NiceMock serverScreen;
NiceMock primaryClient;
NiceMock serverConfig;
@@ -195,7 +192,7 @@ TEST_F(NetworkTests, sendToClient_mockFile)
ON_CALL(clientScreen, getShape(_, _, _, _)).WillByDefault(Invoke(getScreenShape));
ON_CALL(clientScreen, getCursorPos(_, _)).WillByDefault(Invoke(getCursorPos));
- Client client(&m_events, "stub", serverAddress, clientSocketFactory, &clientScreen, cryptoOptions, true);
+ Client client(&m_events, "stub", serverAddress, clientSocketFactory, &clientScreen, true);
m_events.adoptHandler(
m_events.forIScreen().fileRecieveCompleted(), &client,
@@ -215,14 +212,12 @@ TEST_F(NetworkTests, sendToServer_mockData)
{
// server and client
NetworkAddress serverAddress(TEST_HOST, TEST_PORT);
- CryptoOptions cryptoOptions;
-
serverAddress.resolve();
// server
SocketMultiplexer serverSocketMultiplexer;
TCPSocketFactory* serverSocketFactory = new TCPSocketFactory(&m_events, &serverSocketMultiplexer);
- ClientListener listener(serverAddress, serverSocketFactory, cryptoOptions, &m_events);
+ ClientListener listener(serverAddress, serverSocketFactory, &m_events);
NiceMock serverScreen;
NiceMock primaryClient;
NiceMock serverConfig;
@@ -243,7 +238,7 @@ TEST_F(NetworkTests, sendToServer_mockData)
ON_CALL(clientScreen, getShape(_, _, _, _)).WillByDefault(Invoke(getScreenShape));
ON_CALL(clientScreen, getCursorPos(_, _)).WillByDefault(Invoke(getCursorPos));
- Client client(&m_events, "stub", serverAddress, clientSocketFactory, &clientScreen, cryptoOptions, true);
+ Client client(&m_events, "stub", serverAddress, clientSocketFactory, &clientScreen, true);
m_events.adoptHandler(
m_events.forClientListener().connected(), &listener,
@@ -268,14 +263,13 @@ TEST_F(NetworkTests, sendToServer_mockFile)
{
// server and client
NetworkAddress serverAddress(TEST_HOST, TEST_PORT);
- CryptoOptions cryptoOptions;
-
+
serverAddress.resolve();
// server
SocketMultiplexer serverSocketMultiplexer;
TCPSocketFactory* serverSocketFactory = new TCPSocketFactory(&m_events, &serverSocketMultiplexer);
- ClientListener listener(serverAddress, serverSocketFactory, cryptoOptions, &m_events);
+ ClientListener listener(serverAddress, serverSocketFactory, &m_events);
NiceMock serverScreen;
NiceMock primaryClient;
NiceMock serverConfig;
@@ -296,7 +290,7 @@ TEST_F(NetworkTests, sendToServer_mockFile)
ON_CALL(clientScreen, getShape(_, _, _, _)).WillByDefault(Invoke(getScreenShape));
ON_CALL(clientScreen, getCursorPos(_, _)).WillByDefault(Invoke(getCursorPos));
- Client client(&m_events, "stub", serverAddress, clientSocketFactory, &clientScreen, cryptoOptions, true);
+ Client client(&m_events, "stub", serverAddress, clientSocketFactory, &clientScreen, true);
m_events.adoptHandler(
m_events.forClientListener().connected(), &listener,
diff --git a/src/test/mock/io/MockCryptoStream.h b/src/test/mock/io/MockCryptoStream.h
deleted file mode 100644
index a46ba593..00000000
--- a/src/test/mock/io/MockCryptoStream.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * synergy -- mouse and keyboard sharing utility
- * Copyright (C) 2013 Synergy Si Ltd.
- *
- * This package is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * found in the file COPYING that should have accompanied this file.
- *
- * This package is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#pragma once
-
-#include "io/CryptoStream.h"
-#include "io/CryptoOptions.h"
-
-#include "test/global/gmock.h"
-
-class MockCryptoStream : public CryptoStream
-{
-public:
- MockCryptoStream(IEventQueue* eventQueue, IStream* stream) :
- CryptoStream(eventQueue, stream, CryptoOptions("gcm", "stub"), false) { }
- MOCK_METHOD2(read, UInt32(void*, UInt32));
- MOCK_METHOD2(write, void(const void*, UInt32));
-};
diff --git a/src/test/unittests/CMakeLists.txt b/src/test/unittests/CMakeLists.txt
index a9a553e5..1c6de96f 100644
--- a/src/test/unittests/CMakeLists.txt
+++ b/src/test/unittests/CMakeLists.txt
@@ -49,4 +49,4 @@ endif()
add_executable(unittests ${sources})
target_link_libraries(unittests
- arch base client server common io net platform server synergy mt ipc gtest gmock cryptopp ${libs})
+ arch base client server common io net platform server synergy mt ipc gtest gmock ${libs})
diff --git a/src/test/unittests/client/ServerProxyTests.cpp b/src/test/unittests/client/ServerProxyTests.cpp
deleted file mode 100644
index 1a6266d4..00000000
--- a/src/test/unittests/client/ServerProxyTests.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * synergy -- mouse and keyboard sharing utility
- * Copyright (C) 2012 Synergy Si Ltd.
- * Copyright (C) 2011 Nick Bolton
- *
- * This package is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * found in the file COPYING that should have accompanied this file.
- *
- * This package is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#define TEST_ENV
-
-#include "test/mock/client/MockClient.h"
-#include "test/mock/io/MockStream.h"
-#include "test/mock/synergy/MockEventQueue.h"
-#include "client/ServerProxy.h"
-#include "synergy/protocol_types.h"
-
-#include "test/global/gtest.h"
-
-using ::testing::_;
-using ::testing::Invoke;
-using ::testing::NiceMock;
-using ::testing::AnyNumber;
-using ::testing::ReturnRef;
-
-const UInt8 g_mouseMove_bufferLen = 16;
-UInt8 g_mouseMove_buffer[g_mouseMove_bufferLen];
-UInt32 g_mouseMove_bufferIndex;
-UInt32 mouseMove_mockRead(void* buffer, UInt32 n);
-
-const UInt8 g_readCryptoIv_bufferLen = 20;
-UInt8 g_readCryptoIv_buffer[g_readCryptoIv_bufferLen];
-UInt32 g_readCryptoIv_bufferIndex;
-String g_readCryptoIv_result;
-UInt32 readCryptoIv_mockRead(void* buffer, UInt32 n);
-void readCryptoIv_setDecryptIv(const UInt8*);
-
-TEST(ServerProxyTests, mouseMove)
-{
- g_mouseMove_bufferIndex = 0;
-
- NiceMock eventQueue;
- NiceMock stream;
- NiceMock client;
- IStreamEvents streamEvents;
- streamEvents.setEvents(&eventQueue);
-
- ON_CALL(eventQueue, forIStream()).WillByDefault(ReturnRef(streamEvents));
- ON_CALL(stream, read(_, _)).WillByDefault(Invoke(mouseMove_mockRead));
-
- EXPECT_CALL(client, mouseMove(1, 2)).Times(1);
-
- const char data[] = "DSOP\0\0\0\0DMMV\0\1\0\2";
- memcpy(g_mouseMove_buffer, data, g_mouseMove_bufferLen);
-
- ServerProxy serverProxy(&client, &stream, &eventQueue);
- serverProxy.handleDataForTest();
-}
-
-TEST(ServerProxyTests, readCryptoIv)
-{
- g_readCryptoIv_bufferIndex = 0;
-
- NiceMock eventQueue;
- NiceMock client;
- NiceMock stream;
- IStreamEvents streamEvents;
- streamEvents.setEvents(&eventQueue);
-
- ON_CALL(eventQueue, forIStream()).WillByDefault(ReturnRef(streamEvents));
- ON_CALL(stream, read(_, _)).WillByDefault(Invoke(readCryptoIv_mockRead));
- ON_CALL(client, setDecryptIv(_)).WillByDefault(Invoke(readCryptoIv_setDecryptIv));
-
- const char data[] = "DSOP\0\0\0\0DCIV\0\0\0\4mock";
- memcpy(g_readCryptoIv_buffer, data, g_readCryptoIv_bufferLen);
-
- ServerProxy serverProxy(&client, &stream, &eventQueue);
- serverProxy.handleDataForTest();
-
- EXPECT_EQ("mock", g_readCryptoIv_result);
-}
-
-UInt32
-mouseMove_mockRead(void* buffer, UInt32 n)
-{
- if (g_mouseMove_bufferIndex >= g_mouseMove_bufferLen) {
- return 0;
- }
- memcpy(buffer, &g_mouseMove_buffer[g_mouseMove_bufferIndex], n);
- g_mouseMove_bufferIndex += n;
- return n;
-}
-
-UInt32
-readCryptoIv_mockRead(void* buffer, UInt32 n)
-{
- if (g_readCryptoIv_bufferIndex >= g_readCryptoIv_bufferLen) {
- return 0;
- }
- memcpy(buffer, &g_readCryptoIv_buffer[g_readCryptoIv_bufferIndex], n);
- g_readCryptoIv_bufferIndex += n;
- return n;
-}
-
-void
-readCryptoIv_setDecryptIv(const UInt8* data)
-{
- g_readCryptoIv_result = reinterpret_cast(data);
-}
diff --git a/src/test/unittests/server/ClientProxyTests.cpp b/src/test/unittests/server/ClientProxyTests.cpp
deleted file mode 100644
index d6d5ba43..00000000
--- a/src/test/unittests/server/ClientProxyTests.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * synergy -- mouse and keyboard sharing utility
- * Copyright (C) 2013 Synergy Si Ltd.
- *
- * This package is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * found in the file COPYING that should have accompanied this file.
- *
- * This package is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#include "test/mock/server/MockServer.h"
-#include "test/mock/io/MockStream.h"
-#include "test/mock/io/MockCryptoStream.h"
-#include "test/mock/synergy/MockEventQueue.h"
-#include "server/ClientProxy1_4.h"
-
-#include "test/global/gtest.h"
-
-using ::testing::_;
-using ::testing::NiceMock;
-using ::testing::Invoke;
-using ::testing::ReturnRef;
-
-const UInt8 g_cryptoIvWrite_bufferLen = 200;
-UInt8 g_cryptoIvWrite_buffer[g_cryptoIvWrite_bufferLen];
-UInt32 g_cryptoIvWrite_writeBufferIndex;
-UInt32 g_cryptoIvWrite_readBufferIndex;
-
-void cryptoIv_mockWrite(const void* in, UInt32 n);
-UInt8 cryptoIv_mockRead(void* out, UInt32 n);
-
-TEST(ClientProxyTests, cryptoIvWrite)
-{
- g_cryptoIvWrite_writeBufferIndex = 0;
- g_cryptoIvWrite_readBufferIndex = 0;
-
- NiceMock eventQueue;
- NiceMock innerStream;
- NiceMock server;
- CryptoOptions options("cfb", "mock");
- IStreamEvents streamEvents;
- streamEvents.setEvents(&eventQueue);
-
- CryptoStream* serverStream = new CryptoStream(&eventQueue, &innerStream, options, false);
- CryptoStream* clientStream = new CryptoStream(&eventQueue, &innerStream, options, false);
-
- byte iv[CRYPTO_IV_SIZE];
- serverStream->newIv(iv);
- serverStream->setEncryptIv(iv);
- clientStream->setDecryptIv(iv);
-
- ON_CALL(eventQueue, forIStream()).WillByDefault(ReturnRef(streamEvents));
- ON_CALL(innerStream, write(_, _)).WillByDefault(Invoke(cryptoIv_mockWrite));
- ON_CALL(innerStream, read(_, _)).WillByDefault(Invoke(cryptoIv_mockRead));
-
- ClientProxy1_4 clientProxy("stub", serverStream, &server, &eventQueue);
-
- UInt8 buffer[100];
- clientStream->read(buffer, 4);
-
- g_cryptoIvWrite_writeBufferIndex = 0;
- g_cryptoIvWrite_readBufferIndex = 0;
-
- // DCIV, then DKDN.
- clientProxy.keyDown(1, 2, 3);
- clientStream->read(buffer, 24);
- EXPECT_EQ('D', buffer[0]);
- EXPECT_EQ('C', buffer[1]);
- EXPECT_EQ('I', buffer[2]);
- EXPECT_EQ('V', buffer[3]);
- clientStream->setDecryptIv(&buffer[8]);
- clientStream->read(buffer, 10);
- EXPECT_EQ('D', buffer[0]);
- EXPECT_EQ('K', buffer[1]);
- EXPECT_EQ('D', buffer[2]);
- EXPECT_EQ('N', buffer[3]);
-
- g_cryptoIvWrite_writeBufferIndex = 0;
- g_cryptoIvWrite_readBufferIndex = 0;
-
- // DCIV, then DKUP.
- clientProxy.keyUp(1, 2, 3);
- clientStream->read(buffer, 24);
- EXPECT_EQ('D', buffer[0]);
- EXPECT_EQ('C', buffer[1]);
- EXPECT_EQ('I', buffer[2]);
- EXPECT_EQ('V', buffer[3]);
- clientStream->setDecryptIv(&buffer[8]);
- clientStream->read(buffer, 10);
- EXPECT_EQ('D', buffer[0]);
- EXPECT_EQ('K', buffer[1]);
- EXPECT_EQ('U', buffer[2]);
- EXPECT_EQ('P', buffer[3]);
-
- g_cryptoIvWrite_writeBufferIndex = 0;
- g_cryptoIvWrite_readBufferIndex = 0;
-
- // DCIV, then DKRP.
- clientProxy.keyRepeat(1, 2, 4, 4);
- clientStream->read(buffer, 24);
- EXPECT_EQ('D', buffer[0]);
- EXPECT_EQ('C', buffer[1]);
- EXPECT_EQ('I', buffer[2]);
- EXPECT_EQ('V', buffer[3]);
- clientStream->setDecryptIv(&buffer[8]);
- clientStream->read(buffer, 12);
- EXPECT_EQ('D', buffer[0]);
- EXPECT_EQ('K', buffer[1]);
- EXPECT_EQ('R', buffer[2]);
- EXPECT_EQ('P', buffer[3]);
-}
-
-void
-cryptoIv_mockWrite(const void* in, UInt32 n)
-{
- assert(g_cryptoIvWrite_writeBufferIndex <= sizeof(g_cryptoIvWrite_buffer));
- memcpy(&g_cryptoIvWrite_buffer[g_cryptoIvWrite_writeBufferIndex], in, n);
- g_cryptoIvWrite_writeBufferIndex += n;
-}
-
-UInt8
-cryptoIv_mockRead(void* out, UInt32 n)
-{
- assert(g_cryptoIvWrite_readBufferIndex <= sizeof(g_cryptoIvWrite_buffer));
- memcpy(out, &g_cryptoIvWrite_buffer[g_cryptoIvWrite_readBufferIndex], n);
- g_cryptoIvWrite_readBufferIndex += n;
- return n;
-}
diff --git a/src/test/unittests/synergy/CryptoStreamTests.cpp b/src/test/unittests/synergy/CryptoStreamTests.cpp
deleted file mode 100644
index 7ade6a99..00000000
--- a/src/test/unittests/synergy/CryptoStreamTests.cpp
+++ /dev/null
@@ -1,351 +0,0 @@
-/*
- * synergy -- mouse and keyboard sharing utility
- * Copyright (C) 2013 Synergy Si Ltd.
- *
- * This package is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * found in the file COPYING that should have accompanied this file.
- *
- * This package is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#include "test/mock/io/MockStream.h"
-#include "test/mock/synergy/MockEventQueue.h"
-#include "synergy/PacketStreamFilter.h"
-#include "io/CryptoStream.h"
-#include "io/CryptoOptions.h"
-
-#include "test/global/gtest.h"
-
-using ::testing::_;
-using ::testing::Invoke;
-using ::testing::NiceMock;
-
-using namespace std;
-
-const byte kIv[] = "aaaaaaaaaaaaaaaa"; // AES block size = 16 (\0 not used)
-
-UInt8 g_write_buffer[4];
-void write_mockWrite(const void* in, UInt32 n);
-
-UInt8 g_read_buffer[4];
-UInt8 read_mockRead(void* out, UInt32 n);
-
-UInt8 g_write4Read1_buffer[4];
-UInt32 g_write4Read1_bufferIndex;
-void write4Read1_mockWrite(const void* in, UInt32 n);
-UInt8 write4Read1_mockRead(void* out, UInt32 n);
-
-UInt8 g_write1Read4_buffer[4];
-UInt32 g_write1Read4_bufferIndex;
-void write1Read4_mockWrite(const void* in, UInt32 n);
-UInt8 write1Read4_mockRead(void* out, UInt32 n);
-
-UInt8 g_readWriteIvChanged_buffer[4];
-UInt32 g_readWriteIvChangeTrigger_writeBufferIndex;
-UInt32 g_readWriteIvChangeTrigger_readBufferIndex;
-void readWriteIvChanged_mockWrite(const void* in, UInt32 n);
-UInt8 readWriteIvChanged_mockRead(void* out, UInt32 n);
-
-UInt8 g_readWriteIvChangeTrigger_buffer[4 + 4 + 16]; // abcd, DCIV, 16-byte IV
-void readWriteIvChangeTrigger_mockWrite(const void* in, UInt32 n);
-UInt8 readWriteIvChangeTrigger_mockRead(void* out, UInt32 n);
-
-UInt8 g_newIvDoesNotChangeIv_buffer[1];
-void newIvDoesNotChangeIv_mockWrite(const void* in, UInt32 n);
-
-TEST(CryptoStreamTests, write)
-{
- const UInt32 size = 4;
- UInt8* buffer = new UInt8[size];
- buffer[0] = 'D';
- buffer[1] = 'K';
- buffer[2] = 'D';
- buffer[3] = 'N';
-
- NiceMock eventQueue;
- NiceMock innerStream;
- CryptoOptions options("cfb", "mock");
-
- ON_CALL(innerStream, write(_, _)).WillByDefault(Invoke(write_mockWrite));
-
- CryptoStream cs(&eventQueue, &innerStream, options, false);
- cs.setEncryptIv(kIv);
- cs.write(buffer, size);
-
- EXPECT_EQ(95, g_write_buffer[0]);
- EXPECT_EQ(107, g_write_buffer[1]);
- EXPECT_EQ(152, g_write_buffer[2]);
- EXPECT_EQ(220, g_write_buffer[3]);
-}
-
-TEST(CryptoStreamTests, read)
-{
- NiceMock eventQueue;
- NiceMock innerStream;
- CryptoOptions options("cfb", "mock");
-
- ON_CALL(innerStream, read(_, _)).WillByDefault(Invoke(read_mockRead));
-
- CryptoStream cs(&eventQueue, &innerStream, options, false);
- cs.setEncryptIv(kIv);
- cs.setDecryptIv(kIv);
-
- g_read_buffer[0] = 95;
- g_read_buffer[1] = 107;
- g_read_buffer[2] = 152;
- g_read_buffer[3] = 220;
-
- const UInt32 size = 4;
- UInt8* buffer = new UInt8[size];
- cs.read(buffer, size);
-
- EXPECT_EQ('D', buffer[0]);
- EXPECT_EQ('K', buffer[1]);
- EXPECT_EQ('D', buffer[2]);
- EXPECT_EQ('N', buffer[3]);
-}
-
-TEST(CryptoStreamTests, write4Read1)
-{
- g_write4Read1_bufferIndex = 0;
-
- NiceMock eventQueue;
- NiceMock innerStream;
- CryptoOptions options("cfb", "mock");
-
- ON_CALL(innerStream, write(_, _)).WillByDefault(Invoke(write4Read1_mockWrite));
- ON_CALL(innerStream, read(_, _)).WillByDefault(Invoke(write4Read1_mockRead));
-
- CryptoStream cs1(&eventQueue, &innerStream, options, false);
- cs1.setEncryptIv(kIv);
-
- cs1.write("a", 1);
- cs1.write("b", 1);
- cs1.write("c", 1);
- cs1.write("d", 1);
-
- CryptoStream cs2(&eventQueue, &innerStream, options, false);
- cs2.setDecryptIv(kIv);
-
- UInt8 buffer[4];
- cs2.read(buffer, 4);
-
- EXPECT_EQ('a', buffer[0]);
- EXPECT_EQ('b', buffer[1]);
- EXPECT_EQ('c', buffer[2]);
- EXPECT_EQ('d', buffer[3]);
-}
-
-TEST(CryptoStreamTests, write1Read4)
-{
- g_write1Read4_bufferIndex = 0;
-
- NiceMock eventQueue;
- NiceMock innerStream;
- CryptoOptions options("cfb", "mock");
-
- ON_CALL(innerStream, write(_, _)).WillByDefault(Invoke(write1Read4_mockWrite));
- ON_CALL(innerStream, read(_, _)).WillByDefault(Invoke(write1Read4_mockRead));
-
- CryptoStream cs1(&eventQueue, &innerStream, options, false);
- cs1.setEncryptIv(kIv);
-
- UInt8 bufferIn[4];
- bufferIn[0] = 'a';
- bufferIn[1] = 'b';
- bufferIn[2] = 'c';
- bufferIn[3] = 'd';
- cs1.write(bufferIn, 4);
-
- CryptoStream cs2(&eventQueue, &innerStream, options, false);
- cs2.setDecryptIv(kIv);
-
- UInt8 bufferOut[4];
- cs2.read(&bufferOut[0], 1);
- cs2.read(&bufferOut[1], 1);
- cs2.read(&bufferOut[2], 1);
- cs2.read(&bufferOut[3], 1);
-
- EXPECT_EQ('a', bufferOut[0]);
- EXPECT_EQ('b', bufferOut[1]);
- EXPECT_EQ('c', bufferOut[2]);
- EXPECT_EQ('d', bufferOut[3]);
-}
-
-TEST(CryptoStreamTests, readWriteIvChanged)
-{
- g_readWriteIvChangeTrigger_writeBufferIndex = 0;
- g_readWriteIvChangeTrigger_readBufferIndex = 0;
-
- NiceMock eventQueue;
- NiceMock innerStream;
- CryptoOptions options("cfb", "mock");
-
- ON_CALL(innerStream, write(_, _)).WillByDefault(Invoke(readWriteIvChanged_mockWrite));
- ON_CALL(innerStream, read(_, _)).WillByDefault(Invoke(readWriteIvChanged_mockRead));
-
- // AES block size = 16 (\0 not used)
- const byte iv1[] = "aaaaaaaaaaaaaaaa";
- const byte iv2[] = "bbbbbbbbbbbbbbbb";
-
- CryptoStream cs1(&eventQueue, &innerStream, options, false);
- cs1.setEncryptIv(iv1);
-
- UInt8 bufferIn[4];
- bufferIn[0] = 'a';
- bufferIn[1] = 'b';
- bufferIn[2] = 'c';
- bufferIn[3] = 'd';
- cs1.write(bufferIn, 4);
-
- CryptoStream cs2(&eventQueue, &innerStream, options, false);
- cs1.setDecryptIv(iv2);
-
- UInt8 bufferOut[4];
- cs2.read(bufferOut, 4);
-
- // assert that the values cannot be decrypted, since the second crypto
- // class instance is using a different IV.
- EXPECT_NE('a', bufferOut[0]);
- EXPECT_NE('b', bufferOut[1]);
- EXPECT_NE('c', bufferOut[2]);
- EXPECT_NE('d', bufferOut[3]);
-
- // generate a new IV and copy it to the second crypto class, and
- // ensure that the new IV is used.
- byte iv[CRYPTO_IV_SIZE];
- cs1.newIv(iv);
- cs1.setEncryptIv(iv);
- cs2.setDecryptIv(iv);
-
- cs1.write(bufferIn, 4);
- cs2.read(bufferOut, 4);
-
- EXPECT_EQ('a', bufferOut[0]);
- EXPECT_EQ('b', bufferOut[1]);
- EXPECT_EQ('c', bufferOut[2]);
- EXPECT_EQ('d', bufferOut[3]);
-}
-
-TEST(CryptoStreamTests, createKey)
-{
- byte hash1[16];
- CryptoStream::createKey(hash1, "MockLongPassword", 16, 16);
- EXPECT_EQ(hash1[0], 149);
- EXPECT_EQ(hash1[15], 235);
-
- byte hash2[32];
- CryptoStream::createKey(hash2, "MockLongPassword", 32, 16);
- EXPECT_EQ(hash2[0], 149);
- EXPECT_EQ(hash2[15], 235);
- EXPECT_EQ(hash2[31], 7);
-
- byte hash3[32];
- CryptoStream::createKey(hash3, "7accbf2f86a9191da0947107d4fe7054", 32, 16);
- EXPECT_EQ(hash3[0], 120);
- EXPECT_EQ(hash3[15], 11);
- EXPECT_EQ(hash3[31], 233);
-}
-
-TEST(CryptoStreamTests, newIvDoesNotChangeIv)
-{
- NiceMock eventQueue;
- NiceMock innerStream;
- CryptoOptions options("cfb", "mock");
-
- ON_CALL(innerStream, write(_, _)).WillByDefault(Invoke(newIvDoesNotChangeIv_mockWrite));
-
- CryptoStream cs1(&eventQueue, &innerStream, options, false);
- cs1.write("a", 1);
- EXPECT_EQ(175, g_newIvDoesNotChangeIv_buffer[0]);
-
- byte iv[CRYPTO_IV_SIZE];
- cs1.newIv(iv);
-
- cs1.write("a", 1);
- EXPECT_EQ(92, g_newIvDoesNotChangeIv_buffer[0]);
-}
-
-void
-write_mockWrite(const void* in, UInt32 n)
-{
- memcpy(g_write_buffer, in, n);
-}
-
-UInt8
-read_mockRead(void* out, UInt32 n)
-{
- memcpy(out, g_read_buffer, n);
- return n;
-}
-
-void
-write4Read1_mockWrite(const void* in, UInt32 n)
-{
- UInt8* buffer = static_cast(const_cast(in));
- g_write4Read1_buffer[g_write4Read1_bufferIndex++] = buffer[0];
-}
-
-UInt8
-write4Read1_mockRead(void* out, UInt32 n)
-{
- memcpy(out, g_write4Read1_buffer, n);
- return n;
-}
-
-void
-write1Read4_mockWrite(const void* in, UInt32 n)
-{
- memcpy(g_write1Read4_buffer, in, n);
-}
-
-UInt8
-write1Read4_mockRead(void* out, UInt32 n)
-{
- UInt8* buffer = static_cast(out);
- buffer[0] = g_write1Read4_buffer[g_write1Read4_bufferIndex++];
- return 1;
-}
-
-void
-readWriteIvChanged_mockWrite(const void* in, UInt32 n)
-{
- memcpy(g_readWriteIvChanged_buffer, in, n);
-}
-
-UInt8
-readWriteIvChanged_mockRead(void* out, UInt32 n)
-{
- memcpy(out, g_readWriteIvChanged_buffer, n);
- return n;
-}
-
-void
-readWriteIvChangeTrigger_mockWrite(const void* in, UInt32 n)
-{
- assert(g_readWriteIvChangeTrigger_writeBufferIndex <= sizeof(g_readWriteIvChangeTrigger_buffer));
- memcpy(&g_readWriteIvChangeTrigger_buffer[g_readWriteIvChangeTrigger_writeBufferIndex], in, n);
- g_readWriteIvChangeTrigger_writeBufferIndex += n;
-}
-
-UInt8
-readWriteIvChangeTrigger_mockRead(void* out, UInt32 n)
-{
- assert(g_readWriteIvChangeTrigger_readBufferIndex <= sizeof(g_readWriteIvChangeTrigger_buffer));
- memcpy(out, &g_readWriteIvChangeTrigger_buffer[g_readWriteIvChangeTrigger_readBufferIndex], n);
- g_readWriteIvChangeTrigger_readBufferIndex += n;
- return n;
-}
-
-void
-newIvDoesNotChangeIv_mockWrite(const void* in, UInt32 n)
-{
- memcpy(g_newIvDoesNotChangeIv_buffer, in, 1);
-}
diff --git a/src/test/unittests/synergy/GenericArgsParsingTests.cpp b/src/test/unittests/synergy/GenericArgsParsingTests.cpp
index 0091a768..cd8f6f17 100644
--- a/src/test/unittests/synergy/GenericArgsParsingTests.cpp
+++ b/src/test/unittests/synergy/GenericArgsParsingTests.cpp
@@ -278,23 +278,6 @@ TEST(GenericArgsParsingTests, parseGenericArgs_ipcCmd_enableIpcTrue)
EXPECT_EQ(1, i);
}
-TEST(GenericArgsParsingTests, parseGenericArgs_cryptoPassCmd_savePassword)
-{
- int i = 1;
- const int argc = 3;
- const char* kCryptoPassCmd[argc] = { "stub", "--crypto-pass", "mock_password" };
-
- ArgParser argParser(NULL);
- ArgsBase argsBase;
- argParser.setArgsBase(argsBase);
-
- argParser.parseGenericArgs(argc, kCryptoPassCmd, i);
-
- EXPECT_EQ("mock_password", argsBase.m_crypto.m_pass);
- EXPECT_EQ(1, argsBase.m_crypto.m_mode); // 1 == kCfb
- EXPECT_EQ(2, i);
-}
-
#ifndef WINAPI_XWINDOWS
TEST(GenericArgsParsingTests, parseGenericArgs_dragDropCmdOnNonLinux_enableDragDropTrue)
{