mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-24 15:01:16 +01:00
Config: Migrate SSL options to Onion config
This commit is contained in:
parent
798dc2c532
commit
10870a0f74
@ -139,4 +139,13 @@ const Info<std::string> MAIN_LOAD_PATH{{System::Main, "General", "LoadPath"}, ""
|
||||
const Info<std::string> MAIN_RESOURCEPACK_PATH{{System::Main, "General", "ResourcePackPath"}, ""};
|
||||
const Info<std::string> MAIN_FS_PATH{{System::Main, "General", "NANDRootPath"}, ""};
|
||||
const Info<std::string> MAIN_SD_PATH{{System::Main, "General", "WiiSDCardPath"}, ""};
|
||||
|
||||
// Main.Network
|
||||
const Info<bool> MAIN_NETWORK_SSL_DUMP_READ{{System::Main, "Network", "SSLDumpRead"}, false};
|
||||
const Info<bool> MAIN_NETWORK_SSL_DUMP_WRITE{{System::Main, "Network", "SSLDumpWrite"}, false};
|
||||
const Info<bool> MAIN_NETWORK_SSL_VERIFY_CERTIFICATES{
|
||||
{System::Main, "Network", "SSLVerifyCertificates"}, true};
|
||||
const Info<bool> MAIN_NETWORK_SSL_DUMP_ROOT_CA{{System::Main, "Network", "SSLDumpRootCA"}, false};
|
||||
const Info<bool> MAIN_NETWORK_SSL_DUMP_PEER_CERT{{System::Main, "Network", "SSLDumpPeerCert"},
|
||||
false};
|
||||
} // namespace Config
|
||||
|
@ -117,4 +117,12 @@ extern const Info<std::string> MAIN_LOAD_PATH;
|
||||
extern const Info<std::string> MAIN_RESOURCEPACK_PATH;
|
||||
extern const Info<std::string> MAIN_FS_PATH;
|
||||
extern const Info<std::string> MAIN_SD_PATH;
|
||||
|
||||
// Main.Network
|
||||
|
||||
extern const Info<bool> MAIN_NETWORK_SSL_DUMP_READ;
|
||||
extern const Info<bool> MAIN_NETWORK_SSL_DUMP_WRITE;
|
||||
extern const Info<bool> MAIN_NETWORK_SSL_VERIFY_CERTIFICATES;
|
||||
extern const Info<bool> MAIN_NETWORK_SSL_DUMP_ROOT_CA;
|
||||
extern const Info<bool> MAIN_NETWORK_SSL_DUMP_PEER_CERT;
|
||||
} // namespace Config
|
||||
|
@ -28,7 +28,7 @@ bool IsSettingSaveable(const Config::Location& config_location)
|
||||
return true;
|
||||
}
|
||||
|
||||
static constexpr std::array<const Config::Location*, 97> s_setting_saveable = {
|
||||
static constexpr std::array<const Config::Location*, 102> s_setting_saveable = {
|
||||
// Main.Core
|
||||
|
||||
&Config::MAIN_DEFAULT_ISO.location,
|
||||
@ -50,6 +50,14 @@ bool IsSettingSaveable(const Config::Location& config_location)
|
||||
&Config::MAIN_KEEP_WINDOW_ON_TOP.location,
|
||||
&Config::MAIN_DISABLE_SCREENSAVER.location,
|
||||
|
||||
// Main.Network
|
||||
|
||||
&Config::MAIN_NETWORK_SSL_DUMP_READ.location,
|
||||
&Config::MAIN_NETWORK_SSL_DUMP_WRITE.location,
|
||||
&Config::MAIN_NETWORK_SSL_VERIFY_CERTIFICATES.location,
|
||||
&Config::MAIN_NETWORK_SSL_DUMP_ROOT_CA.location,
|
||||
&Config::MAIN_NETWORK_SSL_DUMP_PEER_CERT.location,
|
||||
|
||||
// Graphics.Hardware
|
||||
|
||||
&Config::GFX_VSYNC.location,
|
||||
|
@ -93,7 +93,6 @@ void SConfig::SaveSettings()
|
||||
SaveInputSettings(ini);
|
||||
SaveFifoPlayerSettings(ini);
|
||||
SaveAnalyticsSettings(ini);
|
||||
SaveNetworkSettings(ini);
|
||||
SaveBluetoothPassthroughSettings(ini);
|
||||
SaveUSBPassthroughSettings(ini);
|
||||
SaveAutoUpdateSettings(ini);
|
||||
@ -292,17 +291,6 @@ void SConfig::SaveFifoPlayerSettings(IniFile& ini)
|
||||
fifoplayer->Set("LoopReplay", bLoopFifoReplay);
|
||||
}
|
||||
|
||||
void SConfig::SaveNetworkSettings(IniFile& ini)
|
||||
{
|
||||
IniFile::Section* network = ini.GetOrCreateSection("Network");
|
||||
|
||||
network->Set("SSLDumpRead", m_SSLDumpRead);
|
||||
network->Set("SSLDumpWrite", m_SSLDumpWrite);
|
||||
network->Set("SSLVerifyCertificates", m_SSLVerifyCert);
|
||||
network->Set("SSLDumpRootCA", m_SSLDumpRootCA);
|
||||
network->Set("SSLDumpPeerCert", m_SSLDumpPeerCert);
|
||||
}
|
||||
|
||||
void SConfig::SaveAnalyticsSettings(IniFile& ini)
|
||||
{
|
||||
IniFile::Section* analytics = ini.GetOrCreateSection("Analytics");
|
||||
@ -376,7 +364,6 @@ void SConfig::LoadSettings()
|
||||
LoadDSPSettings(ini);
|
||||
LoadInputSettings(ini);
|
||||
LoadFifoPlayerSettings(ini);
|
||||
LoadNetworkSettings(ini);
|
||||
LoadAnalyticsSettings(ini);
|
||||
LoadBluetoothPassthroughSettings(ini);
|
||||
LoadUSBPassthroughSettings(ini);
|
||||
@ -583,17 +570,6 @@ void SConfig::LoadFifoPlayerSettings(IniFile& ini)
|
||||
fifoplayer->Get("LoopReplay", &bLoopFifoReplay, true);
|
||||
}
|
||||
|
||||
void SConfig::LoadNetworkSettings(IniFile& ini)
|
||||
{
|
||||
IniFile::Section* network = ini.GetOrCreateSection("Network");
|
||||
|
||||
network->Get("SSLDumpRead", &m_SSLDumpRead, false);
|
||||
network->Get("SSLDumpWrite", &m_SSLDumpWrite, false);
|
||||
network->Get("SSLVerifyCertificates", &m_SSLVerifyCert, true);
|
||||
network->Get("SSLDumpRootCA", &m_SSLDumpRootCA, false);
|
||||
network->Get("SSLDumpPeerCert", &m_SSLDumpPeerCert, false);
|
||||
}
|
||||
|
||||
void SConfig::LoadAnalyticsSettings(IniFile& ini)
|
||||
{
|
||||
IniFile::Section* analytics = ini.GetOrCreateSection("Analytics");
|
||||
|
@ -306,13 +306,6 @@ struct SConfig
|
||||
bool m_AdapterRumble[4];
|
||||
bool m_AdapterKonga[4];
|
||||
|
||||
// Network settings
|
||||
bool m_SSLDumpRead;
|
||||
bool m_SSLDumpWrite;
|
||||
bool m_SSLVerifyCert;
|
||||
bool m_SSLDumpRootCA;
|
||||
bool m_SSLDumpPeerCert;
|
||||
|
||||
// Auto-update settings
|
||||
std::string m_auto_update_track;
|
||||
std::string m_auto_update_hash_override;
|
||||
@ -345,7 +338,6 @@ private:
|
||||
void SaveInputSettings(IniFile& ini);
|
||||
void SaveMovieSettings(IniFile& ini);
|
||||
void SaveFifoPlayerSettings(IniFile& ini);
|
||||
void SaveNetworkSettings(IniFile& ini);
|
||||
void SaveAnalyticsSettings(IniFile& ini);
|
||||
void SaveBluetoothPassthroughSettings(IniFile& ini);
|
||||
void SaveUSBPassthroughSettings(IniFile& ini);
|
||||
@ -360,7 +352,6 @@ private:
|
||||
void LoadInputSettings(IniFile& ini);
|
||||
void LoadMovieSettings(IniFile& ini);
|
||||
void LoadFifoPlayerSettings(IniFile& ini);
|
||||
void LoadNetworkSettings(IniFile& ini);
|
||||
void LoadAnalyticsSettings(IniFile& ini);
|
||||
void LoadBluetoothPassthroughSettings(IniFile& ini);
|
||||
void LoadUSBPassthroughSettings(IniFile& ini);
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/MsgHandler.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/IOS/Network/Socket.h"
|
||||
@ -216,7 +216,7 @@ IPCCommandResult NetSSL::IOCtlV(const IOCtlVRequest& request)
|
||||
mbedtls_ssl_conf_cert_profile(&ssl->config, &mbedtls_x509_crt_profile_wii);
|
||||
mbedtls_ssl_set_session(&ssl->ctx, &ssl->session);
|
||||
|
||||
if (SConfig::GetInstance().m_SSLVerifyCert && verifyOption)
|
||||
if (Config::Get(Config::MAIN_NETWORK_SSL_VERIFY_CERTIFICATES) && verifyOption)
|
||||
mbedtls_ssl_conf_authmode(&ssl->config, MBEDTLS_SSL_VERIFY_REQUIRED);
|
||||
else
|
||||
mbedtls_ssl_conf_authmode(&ssl->config, MBEDTLS_SSL_VERIFY_NONE);
|
||||
@ -298,7 +298,7 @@ IPCCommandResult NetSSL::IOCtlV(const IOCtlVRequest& request)
|
||||
int ret =
|
||||
mbedtls_x509_crt_parse_der(&ssl->cacert, Memory::GetPointer(BufferOut2), BufferOutSize2);
|
||||
|
||||
if (SConfig::GetInstance().m_SSLDumpRootCA)
|
||||
if (Config::Get(Config::MAIN_NETWORK_SSL_DUMP_ROOT_CA))
|
||||
{
|
||||
std::string filename = File::GetUserPath(D_DUMPSSL_IDX) + ssl->hostname + "_rootca.der";
|
||||
File::IOFile(filename, "wb").WriteBytes(Memory::GetPointer(BufferOut2), BufferOutSize2);
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "Common/File.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/IOS/Device.h"
|
||||
@ -383,7 +384,8 @@ void WiiSocket::Update(bool read, bool write, bool except)
|
||||
|
||||
// mbedtls_ssl_get_peer_cert(ctx) seems not to work if handshake failed
|
||||
// Below is an alternative to dump the peer certificate
|
||||
if (SConfig::GetInstance().m_SSLDumpPeerCert && ctx->session_negotiate != nullptr)
|
||||
if (Config::Get(Config::MAIN_NETWORK_SSL_DUMP_PEER_CERT) &&
|
||||
ctx->session_negotiate != nullptr)
|
||||
{
|
||||
const mbedtls_x509_crt* cert = ctx->session_negotiate->peer_cert;
|
||||
if (cert != nullptr)
|
||||
@ -408,7 +410,7 @@ void WiiSocket::Update(bool read, bool write, bool except)
|
||||
int ret = mbedtls_ssl_write(&Device::NetSSL::_SSL[sslID].ctx,
|
||||
Memory::GetPointer(BufferOut2), BufferOutSize2);
|
||||
|
||||
if (SConfig::GetInstance().m_SSLDumpWrite && ret > 0)
|
||||
if (Config::Get(Config::MAIN_NETWORK_SSL_DUMP_WRITE) && ret > 0)
|
||||
{
|
||||
std::string filename = File::GetUserPath(D_DUMPSSL_IDX) +
|
||||
SConfig::GetInstance().GetGameID() + "_write.bin";
|
||||
@ -446,7 +448,7 @@ void WiiSocket::Update(bool read, bool write, bool except)
|
||||
int ret = mbedtls_ssl_read(&Device::NetSSL::_SSL[sslID].ctx,
|
||||
Memory::GetPointer(BufferIn2), BufferInSize2);
|
||||
|
||||
if (SConfig::GetInstance().m_SSLDumpRead && ret > 0)
|
||||
if (Config::Get(Config::MAIN_NETWORK_SSL_DUMP_READ) && ret > 0)
|
||||
{
|
||||
std::string filename = File::GetUserPath(D_DUMPSSL_IDX) +
|
||||
SConfig::GetInstance().GetGameID() + "_read.bin";
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/IOS/Network/SSL.h"
|
||||
#include "Core/IOS/Network/Socket.h"
|
||||
#include "DolphinQt/Host.h"
|
||||
@ -191,16 +191,21 @@ void NetworkWidget::CreateWidgets()
|
||||
|
||||
void NetworkWidget::ConnectWidgets()
|
||||
{
|
||||
connect(m_dump_ssl_read_checkbox, &QCheckBox::stateChanged,
|
||||
[](int state) { SConfig::GetInstance().m_SSLDumpRead = state == Qt::Checked; });
|
||||
connect(m_dump_ssl_write_checkbox, &QCheckBox::stateChanged,
|
||||
[](int state) { SConfig::GetInstance().m_SSLDumpWrite = state == Qt::Checked; });
|
||||
connect(m_dump_root_ca_checkbox, &QCheckBox::stateChanged,
|
||||
[](int state) { SConfig::GetInstance().m_SSLDumpRootCA = state == Qt::Checked; });
|
||||
connect(m_dump_peer_cert_checkbox, &QCheckBox::stateChanged,
|
||||
[](int state) { SConfig::GetInstance().m_SSLDumpPeerCert = state == Qt::Checked; });
|
||||
connect(m_verify_certificates_checkbox, &QCheckBox::stateChanged,
|
||||
[](int state) { SConfig::GetInstance().m_SSLVerifyCert = state == Qt::Checked; });
|
||||
connect(m_dump_ssl_read_checkbox, &QCheckBox::stateChanged, [](int state) {
|
||||
Config::SetBaseOrCurrent(Config::MAIN_NETWORK_SSL_DUMP_READ, state == Qt::Checked);
|
||||
});
|
||||
connect(m_dump_ssl_write_checkbox, &QCheckBox::stateChanged, [](int state) {
|
||||
Config::SetBaseOrCurrent(Config::MAIN_NETWORK_SSL_DUMP_WRITE, state == Qt::Checked);
|
||||
});
|
||||
connect(m_dump_root_ca_checkbox, &QCheckBox::stateChanged, [](int state) {
|
||||
Config::SetBaseOrCurrent(Config::MAIN_NETWORK_SSL_DUMP_ROOT_CA, state == Qt::Checked);
|
||||
});
|
||||
connect(m_dump_peer_cert_checkbox, &QCheckBox::stateChanged, [](int state) {
|
||||
Config::SetBaseOrCurrent(Config::MAIN_NETWORK_SSL_DUMP_PEER_CERT, state == Qt::Checked);
|
||||
});
|
||||
connect(m_verify_certificates_checkbox, &QCheckBox::stateChanged, [](int state) {
|
||||
Config::SetBaseOrCurrent(Config::MAIN_NETWORK_SSL_VERIFY_CERTIFICATES, state == Qt::Checked);
|
||||
});
|
||||
}
|
||||
|
||||
void NetworkWidget::Update()
|
||||
@ -237,12 +242,12 @@ void NetworkWidget::Update()
|
||||
}
|
||||
m_ssl_table->resizeColumnsToContents();
|
||||
|
||||
const auto& config = SConfig::GetInstance();
|
||||
m_dump_ssl_read_checkbox->setChecked(config.m_SSLDumpRead);
|
||||
m_dump_ssl_write_checkbox->setChecked(config.m_SSLDumpWrite);
|
||||
m_dump_root_ca_checkbox->setChecked(config.m_SSLDumpRootCA);
|
||||
m_dump_peer_cert_checkbox->setChecked(config.m_SSLDumpPeerCert);
|
||||
m_verify_certificates_checkbox->setChecked(config.m_SSLVerifyCert);
|
||||
m_dump_ssl_read_checkbox->setChecked(Config::Get(Config::MAIN_NETWORK_SSL_DUMP_READ));
|
||||
m_dump_ssl_write_checkbox->setChecked(Config::Get(Config::MAIN_NETWORK_SSL_DUMP_WRITE));
|
||||
m_dump_root_ca_checkbox->setChecked(Config::Get(Config::MAIN_NETWORK_SSL_DUMP_ROOT_CA));
|
||||
m_dump_peer_cert_checkbox->setChecked(Config::Get(Config::MAIN_NETWORK_SSL_DUMP_PEER_CERT));
|
||||
m_verify_certificates_checkbox->setChecked(
|
||||
Config::Get(Config::MAIN_NETWORK_SSL_VERIFY_CERTIFICATES));
|
||||
}
|
||||
|
||||
QGroupBox* NetworkWidget::CreateSocketTableGroup()
|
||||
|
Loading…
x
Reference in New Issue
Block a user