- Removed GCM, CTR and OFB encryption modes.
- Every time server sends CALV message, IV will be changed as well.
This commit is contained in:
parent
beab22e5b2
commit
a25587c4c5
|
@ -66,7 +66,6 @@ HEADERS += src/MainWindow.h \
|
|||
src/IpcClient.h \
|
||||
src/IpcReader.h \
|
||||
src/Ipc.h \
|
||||
src/CryptoMode.h \
|
||||
src/SynergyLocale.h \
|
||||
src/QUtility.h
|
||||
RESOURCES += res/Synergy.qrc
|
||||
|
|
|
@ -189,51 +189,6 @@
|
|||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="m_pLabel_26">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>75</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Mode:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>m_pComboCryptoMode</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="m_pComboCryptoMode">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">OFB (Output Feedback)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">CFB (Cipher Feedback)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">CTR (Counter)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">GCM (Galois/Counter)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">Disable encryption</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="m_pLabel_23">
|
||||
<property name="minimumSize">
|
||||
|
@ -260,6 +215,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="m_pCheckBoxEnableCrypto">
|
||||
<property name="text">
|
||||
<string>Enable</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -397,7 +359,6 @@
|
|||
<tabstop>m_pCheckBoxAutoStart</tabstop>
|
||||
<tabstop>m_pCheckBoxAutoConnect</tabstop>
|
||||
<tabstop>m_pCheckBoxAutoHide</tabstop>
|
||||
<tabstop>m_pComboCryptoMode</tabstop>
|
||||
<tabstop>m_pLineEditCryptoPass</tabstop>
|
||||
<tabstop>m_pComboLogLevel</tabstop>
|
||||
<tabstop>m_pCheckBoxLogToFile</tabstop>
|
||||
|
|
|
@ -535,108 +535,16 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Choose a random encryption mode. The mode must be the same on both the client and server.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="m_pLabel_26">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeIncrement">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<widget class="QCheckBox" name="m_pCheckBoxEnableCrypto">
|
||||
<property name="text">
|
||||
<string>&Mode:</string>
|
||||
<string>Enable encryption</string>
|
||||
</property>
|
||||
<property name="indent">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>m_pComboCryptoMode</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="m_pComboCryptoMode">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">OFB (Output Feedback)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">CFB (Cipher Feedback)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">CTR (Counter)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">GCM (Galois/Counter)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">Disable encryption</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -808,7 +716,6 @@
|
|||
<tabstop>m_pRadioButtonPremiumLater</tabstop>
|
||||
<tabstop>m_pServerRadioButton</tabstop>
|
||||
<tabstop>m_pClientRadioButton</tabstop>
|
||||
<tabstop>m_pComboCryptoMode</tabstop>
|
||||
<tabstop>m_pLineEditCryptoPassword1</tabstop>
|
||||
<tabstop>m_pLineEditCryptoPassword2</tabstop>
|
||||
</tabstops>
|
||||
|
|
|
@ -57,7 +57,6 @@ AppConfig::AppConfig(QSettings* settings) :
|
|||
m_AutoStartPrompt(false),
|
||||
m_WizardLastRun(0),
|
||||
m_CryptoPass(),
|
||||
m_CryptoMode(),
|
||||
m_ProcessMode(DEFAULT_PROCESS_MODE)
|
||||
{
|
||||
Q_ASSERT(m_pSettings);
|
||||
|
@ -160,7 +159,7 @@ void AppConfig::loadSettings()
|
|||
m_WizardLastRun = settings().value("wizardLastRun", 0).toInt();
|
||||
m_ProcessMode = (ProcessMode)settings().value("processMode2", DEFAULT_PROCESS_MODE).toInt();
|
||||
m_CryptoPass = settings().value("cryptoPass", "").toString();
|
||||
m_CryptoMode = (CryptoMode)settings().value("cryptoMode", Disabled).toInt();
|
||||
m_CryptoEnabled = settings().value("cryptoEnabled", false).toBool();
|
||||
m_Language = settings().value("language", QLocale::system().name()).toString();
|
||||
m_PremiumEmail= settings().value("premiumEmail", "").toString();
|
||||
m_PremiumToken = settings().value("premiumToken", "").toString();
|
||||
|
@ -181,7 +180,7 @@ void AppConfig::saveSettings()
|
|||
settings().setValue("wizardLastRun", kWizardVersion);
|
||||
settings().setValue("processMode2", m_ProcessMode);
|
||||
settings().setValue("cryptoPass", m_CryptoPass);
|
||||
settings().setValue("cryptoMode", m_CryptoMode);
|
||||
settings().setValue("cryptoEnabled", m_CryptoEnabled);
|
||||
settings().setValue("language", m_Language);
|
||||
settings().setValue("premiumEmail", m_PremiumEmail);
|
||||
settings().setValue("premiumToken", m_PremiumToken);
|
||||
|
@ -203,28 +202,6 @@ void AppConfig::setCryptoPass(const QString &s)
|
|||
}
|
||||
}
|
||||
|
||||
QString AppConfig::cryptoModeString() const
|
||||
{
|
||||
switch (cryptoMode())
|
||||
{
|
||||
case OFB:
|
||||
return "ofb";
|
||||
|
||||
case CFB:
|
||||
return "cfb";
|
||||
|
||||
case CTR:
|
||||
return "ctr";
|
||||
|
||||
case GCM:
|
||||
return "gcm";
|
||||
|
||||
default:
|
||||
qCritical() << "invalid crypto mode";
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
bool AppConfig::isPremium()
|
||||
{
|
||||
QString hashSrc = m_PremiumEmail + getFirstMacAddress();
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#define APPCONFIG_H
|
||||
|
||||
#include <QString>
|
||||
#include "CryptoMode.h"
|
||||
|
||||
// this should be incremented each time a new page is added. this is
|
||||
// saved to settings when the user finishes running the wizard. if
|
||||
|
@ -66,7 +65,7 @@ class AppConfig
|
|||
bool autoHide() const { return m_AutoHide; }
|
||||
bool autoStartPrompt() const { return m_AutoStartPrompt; }
|
||||
const QString& cryptoPass() const { return m_CryptoPass; }
|
||||
CryptoMode cryptoMode() const { return m_CryptoMode; }
|
||||
bool cryptoEnabled() const { return m_CryptoEnabled; }
|
||||
QString cryptoModeString() const;
|
||||
ProcessMode processMode() const { return m_ProcessMode; }
|
||||
bool wizardShouldRun() const { return m_WizardLastRun < kWizardVersion; }
|
||||
|
@ -95,7 +94,7 @@ class AppConfig
|
|||
void setAutoStart(bool b);
|
||||
void setAutoHide(bool b) { m_AutoHide = b; }
|
||||
void setAutoStartPrompt(bool b) { m_AutoStartPrompt = b; }
|
||||
void setCryptoMode(CryptoMode c) { m_CryptoMode = c; }
|
||||
void setCryptoEnabled(bool b) { m_CryptoEnabled = b; }
|
||||
void setProcessMode(ProcessMode p) { m_ProcessMode = p; }
|
||||
void setWizardHasRun() { m_WizardLastRun = kWizardVersion; }
|
||||
void setLanguage(const QString language) { m_Language = language; }
|
||||
|
@ -120,8 +119,8 @@ class AppConfig
|
|||
bool m_AutoHide;
|
||||
bool m_AutoStartPrompt;
|
||||
int m_WizardLastRun;
|
||||
bool m_CryptoEnabled;
|
||||
QString m_CryptoPass;
|
||||
CryptoMode m_CryptoMode;
|
||||
ProcessMode m_ProcessMode;
|
||||
QString m_Language;
|
||||
QString m_PremiumEmail;
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
/*
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2013 Bolton Software 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
enum CryptoMode {
|
||||
Disabled,
|
||||
OFB,
|
||||
CFB,
|
||||
CTR,
|
||||
GCM
|
||||
};
|
|
@ -392,9 +392,8 @@ void MainWindow::startSynergy()
|
|||
if (!appConfig().screenName().isEmpty())
|
||||
args << "--name" << appConfig().screenName();
|
||||
|
||||
if (appConfig().cryptoMode() != Disabled)
|
||||
if (appConfig().cryptoEnabled())
|
||||
{
|
||||
args << "--crypto-mode" << appConfig().cryptoModeString();
|
||||
args << "--crypto-pass" << appConfig().cryptoPass();
|
||||
}
|
||||
|
||||
|
|
|
@ -44,17 +44,21 @@ SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
|
|||
m_pLineEditLogFilename->setText(appConfig().logFilename());
|
||||
m_pCheckBoxAutoStart->setChecked(appConfig().autoStart());
|
||||
m_pCheckBoxAutoHide->setChecked(appConfig().autoHide());
|
||||
m_pCheckBoxEnableCrypto->setChecked(appConfig().cryptoEnabled());
|
||||
setIndexFromItemData(m_pComboLanguage, appConfig().language());
|
||||
if (appConfig().isPremium())
|
||||
{
|
||||
m_pComboCryptoMode->setCurrentIndex(getCryptoModeIndex(appConfig().cryptoMode()));
|
||||
m_pLineEditCryptoPass->setText(appConfig().cryptoPass());
|
||||
if (appConfig().cryptoEnabled())
|
||||
{
|
||||
m_pLineEditCryptoPass->setText(appConfig().cryptoPass());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int size = m_pComboCryptoMode->count();
|
||||
m_pComboCryptoMode->setCurrentIndex(size - 1);
|
||||
m_pComboCryptoMode->setEnabled(false);
|
||||
m_pCheckBoxEnableCrypto->setChecked(false);
|
||||
m_pCheckBoxEnableCrypto->setEnabled(false);
|
||||
m_pLineEditCryptoPass->clear();
|
||||
m_pLineEditCryptoPass->setEnabled(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -62,8 +66,8 @@ SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
|
|||
void SettingsDialog::accept()
|
||||
{
|
||||
const QString& cryptoPass = m_pLineEditCryptoPass->text();
|
||||
CryptoMode cryptoMode = parseCryptoMode(m_pComboCryptoMode->currentText());
|
||||
if ((cryptoMode != Disabled) && cryptoPass.isEmpty())
|
||||
bool cryptoEnabled = m_pCheckBoxEnableCrypto->isChecked();
|
||||
if (cryptoEnabled && cryptoPass.isEmpty())
|
||||
{
|
||||
QMessageBox message;
|
||||
message.setWindowTitle("Settings");
|
||||
|
@ -83,7 +87,7 @@ void SettingsDialog::accept()
|
|||
appConfig().setLogFilename(m_pLineEditLogFilename->text());
|
||||
appConfig().setAutoStart(m_pCheckBoxAutoStart->isChecked());
|
||||
appConfig().setAutoHide(m_pCheckBoxAutoHide->isChecked());
|
||||
appConfig().setCryptoMode(cryptoMode);
|
||||
appConfig().setCryptoEnabled(cryptoEnabled);
|
||||
appConfig().setCryptoPass(cryptoPass);
|
||||
appConfig().setLanguage(m_pComboLanguage->itemData(m_pComboLanguage->currentIndex()).toString());
|
||||
appConfig().saveSettings();
|
||||
|
@ -143,59 +147,17 @@ void SettingsDialog::on_m_pButtonBrowseLog_clicked()
|
|||
}
|
||||
}
|
||||
|
||||
void SettingsDialog::on_m_pComboCryptoMode_currentIndexChanged(int index)
|
||||
void SettingsDialog::on_m_pCheckBoxEnableCrypto_stateChanged(int )
|
||||
{
|
||||
bool enabled = parseCryptoMode(m_pComboCryptoMode->currentText()) != Disabled;
|
||||
m_pLineEditCryptoPass->setEnabled(enabled);
|
||||
if (!enabled)
|
||||
bool cryptoEnabled = m_pCheckBoxEnableCrypto->isChecked();
|
||||
m_pLineEditCryptoPass->setEnabled(cryptoEnabled);
|
||||
|
||||
if (!cryptoEnabled)
|
||||
{
|
||||
m_pLineEditCryptoPass->clear();
|
||||
}
|
||||
}
|
||||
|
||||
int SettingsDialog::getCryptoModeIndex(const CryptoMode& mode) const
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case OFB:
|
||||
return m_pComboCryptoMode->findText("OFB", Qt::MatchStartsWith);
|
||||
|
||||
case CFB:
|
||||
return m_pComboCryptoMode->findText("CFB", Qt::MatchStartsWith);
|
||||
|
||||
case CTR:
|
||||
return m_pComboCryptoMode->findText("CTR", Qt::MatchStartsWith);
|
||||
|
||||
case GCM:
|
||||
return m_pComboCryptoMode->findText("GCM", Qt::MatchStartsWith);
|
||||
|
||||
default:
|
||||
return m_pComboCryptoMode->findText("Disable", Qt::MatchStartsWith);
|
||||
}
|
||||
}
|
||||
|
||||
CryptoMode SettingsDialog::parseCryptoMode(const QString& s)
|
||||
{
|
||||
if (s.startsWith("OFB"))
|
||||
{
|
||||
return OFB;
|
||||
}
|
||||
else if (s.startsWith("CFB"))
|
||||
{
|
||||
return CFB;
|
||||
}
|
||||
else if (s.startsWith("CTR"))
|
||||
{
|
||||
return CTR;
|
||||
}
|
||||
else if (s.startsWith("GCM"))
|
||||
{
|
||||
return GCM;
|
||||
}
|
||||
|
||||
return Disabled;
|
||||
}
|
||||
|
||||
void SettingsDialog::on_m_pComboLanguage_currentIndexChanged(int index)
|
||||
{
|
||||
QString ietfCode = m_pComboLanguage->itemData(index).toString();
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
#include <QDialog>
|
||||
#include "ui_SettingsDialogBase.h"
|
||||
#include "CryptoMode.h"
|
||||
#include "SynergyLocale.h"
|
||||
|
||||
class AppConfig;
|
||||
|
@ -43,13 +42,11 @@ class SettingsDialog : public QDialog, public Ui::SettingsDialogBase
|
|||
AppConfig& appConfig() { return m_AppConfig; }
|
||||
|
||||
private:
|
||||
int getCryptoModeIndex(const CryptoMode& mode) const;
|
||||
CryptoMode parseCryptoMode(const QString& s);
|
||||
AppConfig& m_AppConfig;
|
||||
SynergyLocale m_Locale;
|
||||
|
||||
private slots:
|
||||
void on_m_pComboCryptoMode_currentIndexChanged(int index);
|
||||
void on_m_pCheckBoxEnableCrypto_stateChanged(int );
|
||||
void on_m_pComboLanguage_currentIndexChanged(int index);
|
||||
void on_m_pCheckBoxLogToFile_stateChanged(int );
|
||||
void on_m_pButtonBrowseLog_clicked();
|
||||
|
|
|
@ -107,8 +107,8 @@ bool SetupWizard::validateCurrentPage()
|
|||
}
|
||||
else
|
||||
{
|
||||
m_pComboCryptoMode->setCurrentIndex(0);
|
||||
m_pComboCryptoMode->setEnabled(true);
|
||||
m_pCheckBoxEnableCrypto->setEnabled(true);
|
||||
m_pCheckBoxEnableCrypto->setChecked(true);
|
||||
}
|
||||
}
|
||||
else if (m_pRadioButtonPremiumRegister->isChecked())
|
||||
|
@ -120,9 +120,9 @@ bool SetupWizard::validateCurrentPage()
|
|||
}
|
||||
else if (m_pRadioButtonPremiumLater->isChecked())
|
||||
{
|
||||
int size = m_pComboCryptoMode->count();
|
||||
m_pComboCryptoMode->setCurrentIndex(size - 1);
|
||||
m_pComboCryptoMode->setEnabled(false);
|
||||
m_pCheckBoxEnableCrypto->setEnabled(false);
|
||||
m_pLineEditCryptoPassword1->setEnabled(false);
|
||||
m_pLineEditCryptoPassword2->setEnabled(false);
|
||||
}
|
||||
else {
|
||||
message.setText(tr("Please select an option."));
|
||||
|
@ -132,15 +132,7 @@ bool SetupWizard::validateCurrentPage()
|
|||
}
|
||||
else if (currentPage() == m_pCryptoPage)
|
||||
{
|
||||
QString modeText = m_pComboCryptoMode->currentText();
|
||||
if (modeText.isEmpty())
|
||||
{
|
||||
message.setText(tr("Encryption mode required."));
|
||||
message.exec();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (parseCryptoMode(modeText) != Disabled)
|
||||
if (m_pCheckBoxEnableCrypto->isChecked())
|
||||
{
|
||||
if (m_pLineEditCryptoPassword1->text().isEmpty())
|
||||
{
|
||||
|
@ -185,7 +177,7 @@ void SetupWizard::accept()
|
|||
{
|
||||
AppConfig& appConfig = m_MainWindow.appConfig();
|
||||
|
||||
appConfig.setCryptoMode(parseCryptoMode(m_pComboCryptoMode->currentText()));
|
||||
appConfig.setCryptoEnabled(m_pCheckBoxEnableCrypto->isChecked());
|
||||
appConfig.setCryptoPass(m_pLineEditCryptoPassword1->text());
|
||||
appConfig.setLanguage(m_pComboLanguage->itemData(m_pComboLanguage->currentIndex()).toString());
|
||||
appConfig.setPremiumEmail(m_pLineEditPremiumEmail->text());
|
||||
|
@ -239,33 +231,16 @@ void SetupWizard::reject()
|
|||
QWizard::reject();
|
||||
}
|
||||
|
||||
void SetupWizard::on_m_pComboCryptoMode_currentIndexChanged(int index)
|
||||
void SetupWizard::on_m_pCheckBoxEnableCrypto_stateChanged(int )
|
||||
{
|
||||
bool enabled = parseCryptoMode(m_pComboCryptoMode->currentText()) != Disabled;
|
||||
bool enabled = m_pCheckBoxEnableCrypto->isChecked();
|
||||
m_pLineEditCryptoPassword1->setEnabled(enabled);
|
||||
m_pLineEditCryptoPassword2->setEnabled(enabled);
|
||||
}
|
||||
|
||||
CryptoMode SetupWizard::parseCryptoMode(const QString& s)
|
||||
{
|
||||
if (s.startsWith("OFB"))
|
||||
if (!enabled)
|
||||
{
|
||||
return OFB;
|
||||
m_pLineEditCryptoPassword1->clear();
|
||||
m_pLineEditCryptoPassword2->clear();
|
||||
}
|
||||
else if (s.startsWith("CFB"))
|
||||
{
|
||||
return CFB;
|
||||
}
|
||||
else if (s.startsWith("CTR"))
|
||||
{
|
||||
return CTR;
|
||||
}
|
||||
else if (s.startsWith("GCM"))
|
||||
{
|
||||
return GCM;
|
||||
}
|
||||
|
||||
return Disabled;
|
||||
}
|
||||
|
||||
void SetupWizard::on_m_pComboLanguage_currentIndexChanged(int index)
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "ui_SetupWizardBase.h"
|
||||
#include "CryptoMode.h"
|
||||
#include "SynergyLocale.h"
|
||||
|
||||
#include <QWizard>
|
||||
|
@ -41,7 +40,6 @@ protected:
|
|||
void reject();
|
||||
|
||||
private:
|
||||
CryptoMode parseCryptoMode(const QString& s);
|
||||
bool isPremiumLoginValid(QMessageBox& message);
|
||||
|
||||
private:
|
||||
|
@ -51,7 +49,7 @@ private:
|
|||
QNetworkAccessManager m_Network;
|
||||
|
||||
private slots:
|
||||
void on_m_pComboCryptoMode_currentIndexChanged(int index);
|
||||
void on_m_pCheckBoxEnableCrypto_stateChanged(int );
|
||||
void on_m_pComboLanguage_currentIndexChanged(int index);
|
||||
void on_m_pRadioButtonPremiumLogin_toggled(bool checked);
|
||||
};
|
||||
|
|
|
@ -27,22 +27,10 @@ CCryptoMode::CCryptoMode(ECryptoMode mode, bool encryption) :
|
|||
{
|
||||
if (m_encryption) {
|
||||
switch (m_mode) {
|
||||
case kOfb:
|
||||
m_crypto = new COfbModeEnc;
|
||||
break;
|
||||
|
||||
case kCfb:
|
||||
m_crypto = new CCfbModeEnc;
|
||||
break;
|
||||
|
||||
case kCtr:
|
||||
m_crypto = new CCtrModeEnc;
|
||||
break;
|
||||
|
||||
case kGcm:
|
||||
m_crypto = new CGcmModeEnc;
|
||||
break;
|
||||
|
||||
case kDisabled:
|
||||
break;
|
||||
|
||||
|
@ -52,22 +40,10 @@ CCryptoMode::CCryptoMode(ECryptoMode mode, bool encryption) :
|
|||
}
|
||||
else {
|
||||
switch (m_mode) {
|
||||
case kOfb:
|
||||
m_crypto = new COfbModeDec;
|
||||
break;
|
||||
|
||||
case kCfb:
|
||||
m_crypto = new CCfbModeDec;
|
||||
break;
|
||||
|
||||
case kCtr:
|
||||
m_crypto = new CCtrModeDec;
|
||||
break;
|
||||
|
||||
case kGcm:
|
||||
m_crypto = new CGcmModeDec;
|
||||
break;
|
||||
|
||||
case kDisabled:
|
||||
break;
|
||||
|
||||
|
@ -85,40 +61,16 @@ CCryptoMode::~CCryptoMode()
|
|||
|
||||
if (m_encryption) {
|
||||
switch (m_mode) {
|
||||
case kOfb:
|
||||
delete reinterpret_cast<COfbModeEnc*>(m_crypto);
|
||||
break;
|
||||
|
||||
case kCfb:
|
||||
delete reinterpret_cast<CCfbModeEnc*>(m_crypto);
|
||||
break;
|
||||
|
||||
case kCtr:
|
||||
delete reinterpret_cast<CCtrModeEnc*>(m_crypto);
|
||||
break;
|
||||
|
||||
case kGcm:
|
||||
delete reinterpret_cast<CGcmModeEnc*>(m_crypto);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch (m_mode) {
|
||||
case kOfb:
|
||||
delete reinterpret_cast<COfbModeDec*>(m_crypto);
|
||||
break;
|
||||
|
||||
case kCfb:
|
||||
delete reinterpret_cast<CCfbModeDec*>(m_crypto);
|
||||
break;
|
||||
|
||||
case kCtr:
|
||||
delete reinterpret_cast<CCtrModeDec*>(m_crypto);
|
||||
break;
|
||||
|
||||
case kGcm:
|
||||
delete reinterpret_cast<CGcmModeDec*>(m_crypto);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -132,40 +84,16 @@ CCryptoMode::processData(byte* out, const byte* in, size_t length)
|
|||
|
||||
if (m_encryption) {
|
||||
switch (m_mode) {
|
||||
case kOfb:
|
||||
reinterpret_cast<COfbModeEnc*>(m_crypto)->ProcessData(out, in, length);
|
||||
break;
|
||||
|
||||
case kCfb:
|
||||
reinterpret_cast<CCfbModeEnc*>(m_crypto)->ProcessData(out, in, length);
|
||||
break;
|
||||
|
||||
case kCtr:
|
||||
reinterpret_cast<CCtrModeEnc*>(m_crypto)->ProcessData(out, in, length);
|
||||
break;
|
||||
|
||||
case kGcm:
|
||||
reinterpret_cast<CGcmModeEnc*>(m_crypto)->ProcessData(out, in, length);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch (m_mode) {
|
||||
case kOfb:
|
||||
reinterpret_cast<COfbModeDec*>(m_crypto)->ProcessData(out, in, length);
|
||||
break;
|
||||
|
||||
case kCfb:
|
||||
reinterpret_cast<CCfbModeDec*>(m_crypto)->ProcessData(out, in, length);
|
||||
break;
|
||||
|
||||
case kCtr:
|
||||
reinterpret_cast<CCtrModeDec*>(m_crypto)->ProcessData(out, in, length);
|
||||
break;
|
||||
|
||||
case kGcm:
|
||||
reinterpret_cast<CGcmModeDec*>(m_crypto)->ProcessData(out, in, length);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -180,40 +108,16 @@ CCryptoMode::setKeyWithIv(const byte* key, size_t length, const byte* iv)
|
|||
|
||||
if (m_encryption) {
|
||||
switch (m_mode) {
|
||||
case kOfb:
|
||||
reinterpret_cast<COfbModeEnc*>(m_crypto)->SetKeyWithIV(key, length, iv);
|
||||
break;
|
||||
|
||||
case kCfb:
|
||||
reinterpret_cast<CCfbModeEnc*>(m_crypto)->SetKeyWithIV(key, length, iv);
|
||||
break;
|
||||
|
||||
case kCtr:
|
||||
reinterpret_cast<CCtrModeEnc*>(m_crypto)->SetKeyWithIV(key, length, iv);
|
||||
break;
|
||||
|
||||
case kGcm:
|
||||
reinterpret_cast<CGcmModeEnc*>(m_crypto)->SetKeyWithIV(key, length, iv);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch (m_mode) {
|
||||
case kOfb:
|
||||
reinterpret_cast<COfbModeDec*>(m_crypto)->SetKeyWithIV(key, length, iv);
|
||||
break;
|
||||
|
||||
case kCfb:
|
||||
reinterpret_cast<CCfbModeDec*>(m_crypto)->SetKeyWithIV(key, length, iv);
|
||||
break;
|
||||
|
||||
case kCtr:
|
||||
reinterpret_cast<CCtrModeDec*>(m_crypto)->SetKeyWithIV(key, length, iv);
|
||||
break;
|
||||
|
||||
case kGcm:
|
||||
reinterpret_cast<CGcmModeDec*>(m_crypto)->SetKeyWithIV(key, length, iv);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,18 +36,9 @@ CCryptoOptions::setMode(CString modeString)
|
|||
ECryptoMode
|
||||
CCryptoOptions::parseMode(CString modeString)
|
||||
{
|
||||
if (modeString == "ofb") {
|
||||
return kOfb;
|
||||
}
|
||||
else if (modeString == "cfb") {
|
||||
if (modeString == "cfb") {
|
||||
return kCfb;
|
||||
}
|
||||
else if (modeString == "ctr") {
|
||||
return kCtr;
|
||||
}
|
||||
else if (modeString == "gcm") {
|
||||
return kGcm;
|
||||
}
|
||||
else {
|
||||
throw XIOBadCryptoMode();
|
||||
}
|
||||
|
|
|
@ -19,9 +19,6 @@
|
|||
|
||||
enum ECryptoMode {
|
||||
kDisabled,
|
||||
kOfb,
|
||||
kCfb,
|
||||
kCtr,
|
||||
kGcm,
|
||||
kNumOfModes
|
||||
};
|
||||
|
|
|
@ -116,6 +116,12 @@ CClientProxy1_3::removeHeartbeatTimer()
|
|||
|
||||
void
|
||||
CClientProxy1_3::handleKeepAlive(const CEvent&, void*)
|
||||
{
|
||||
keepAlive();
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_3::keepAlive()
|
||||
{
|
||||
CProtocolUtil::writef(getStream(), kMsgCKeepAlive);
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ protected:
|
|||
virtual void resetHeartbeatTimer();
|
||||
virtual void addHeartbeatTimer();
|
||||
virtual void removeHeartbeatTimer();
|
||||
virtual void keepAlive();
|
||||
|
||||
private:
|
||||
void handleKeepAlive(const CEvent&, void*);
|
||||
|
|
|
@ -61,6 +61,13 @@ CClientProxy1_4::keyUp(KeyID key, KeyModifierMask mask, KeyButton button)
|
|||
CClientProxy1_3::keyUp(key, mask, button);
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_4::keepAlive()
|
||||
{
|
||||
cryptoIv();
|
||||
CClientProxy1_3::keepAlive();
|
||||
}
|
||||
|
||||
void
|
||||
CClientProxy1_4::cryptoIv()
|
||||
{
|
||||
|
|
|
@ -40,6 +40,7 @@ public:
|
|||
virtual void keyDown(KeyID key, KeyModifierMask mask, KeyButton button);
|
||||
virtual void keyRepeat(KeyID key, KeyModifierMask mask, SInt32 count, KeyButton button);
|
||||
virtual void keyUp(KeyID key, KeyModifierMask mask, KeyButton button);
|
||||
virtual void keepAlive();
|
||||
|
||||
//! Send IV to make
|
||||
void cryptoIv();
|
||||
|
|
|
@ -165,10 +165,7 @@ CApp::parseArg(const int& argc, const char* const* argv, int& i)
|
|||
|
||||
else if (isArg(i, argc, argv, NULL, "--crypto-pass")) {
|
||||
argsBase().m_crypto.m_pass = argv[++i];
|
||||
}
|
||||
|
||||
else if (isArg(i, argc, argv, NULL, "--crypto-mode")) {
|
||||
argsBase().m_crypto.setMode(argv[++i]);
|
||||
argsBase().m_crypto.setMode("cfb");
|
||||
}
|
||||
|
||||
else if (isArg(i, argc, argv, NULL, "--filetransfer-src")) {
|
||||
|
|
Loading…
Reference in New Issue