diff options
author | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-14 20:10:01 +0000 |
---|---|---|
committer | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-14 20:10:01 +0000 |
commit | b626bdc2f6a057e25550b40c3986abdb5903410c (patch) | |
tree | d429be826a76a58ebabc1ddb707b35c61d804e1a /net/base | |
parent | ce258c92a8cb8183105d05a6f8d8b8b48614eabf (diff) | |
download | chromium_src-b626bdc2f6a057e25550b40c3986abdb5903410c.zip chromium_src-b626bdc2f6a057e25550b40c3986abdb5903410c.tar.gz chromium_src-b626bdc2f6a057e25550b40c3986abdb5903410c.tar.bz2 |
Add the "Use SSL 3.0" and "Use TLS 1.0" checkboxes to
the Options menu ("Under the Hood" tab) on Windows.
R=mattm
BUG=59125
TEST=net_unittests.exe --gtest_filter=SSLConfigServiceWinTest.SetTest.
Manually verify the Options menu has the two new checkboxes.
Review URL: http://codereview.chromium.org/3779003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62634 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base')
-rw-r--r-- | net/base/ssl_config_service_win.cc | 21 | ||||
-rw-r--r-- | net/base/ssl_config_service_win.h | 4 | ||||
-rw-r--r-- | net/base/ssl_config_service_win_unittest.cc | 28 |
3 files changed, 49 insertions, 4 deletions
diff --git a/net/base/ssl_config_service_win.cc b/net/base/ssl_config_service_win.cc index 4b289dd..82f44bf 100644 --- a/net/base/ssl_config_service_win.cc +++ b/net/base/ssl_config_service_win.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -92,15 +92,30 @@ void SSLConfigServiceWin::SetRevCheckingEnabled(bool enabled) { // static void SSLConfigServiceWin::SetSSL2Enabled(bool enabled) { + SetSSLVersionEnabled(SSL2, enabled); +} + +// static +void SSLConfigServiceWin::SetSSL3Enabled(bool enabled) { + SetSSLVersionEnabled(SSL3, enabled); +} + +// static +void SSLConfigServiceWin::SetTLS1Enabled(bool enabled) { + SetSSLVersionEnabled(TLS1, enabled); +} + +// static +void SSLConfigServiceWin::SetSSLVersionEnabled(int version, bool enabled) { RegKey internet_settings(HKEY_CURRENT_USER, kInternetSettingsSubKeyName, KEY_READ | KEY_WRITE); DWORD value; if (!internet_settings.ReadValueDW(kProtocolsValueName, &value)) value = PROTOCOLS_DEFAULT; if (enabled) - value |= SSL2; + value |= version; else - value &= ~SSL2; + value &= ~version; internet_settings.WriteValue(kProtocolsValueName, value); // TODO(mattm): We should call UpdateConfig after updating settings, but these // methods are static. diff --git a/net/base/ssl_config_service_win.h b/net/base/ssl_config_service_win.h index 2b37f84..e5eb862 100644 --- a/net/base/ssl_config_service_win.h +++ b/net/base/ssl_config_service_win.h @@ -30,6 +30,8 @@ class SSLConfigServiceWin : public SSLConfigService { // Setters. Can be called on any thread. static void SetRevCheckingEnabled(bool enabled); static void SetSSL2Enabled(bool enabled); + static void SetSSL3Enabled(bool enabled); + static void SetTLS1Enabled(bool enabled); // Get the (cached) SSL configuration settings that are fresh within 10 // seconds. This is cheaper than GetSSLConfigNow and is suitable when @@ -45,6 +47,8 @@ class SSLConfigServiceWin : public SSLConfigService { private: virtual ~SSLConfigServiceWin() {} + static void SetSSLVersionEnabled(int version, bool enabled); + void UpdateConfig(base::TimeTicks now); // We store the IE SSL config and the time that we fetched it. diff --git a/net/base/ssl_config_service_win_unittest.cc b/net/base/ssl_config_service_win_unittest.cc index 736f93c..1db4cef 100644 --- a/net/base/ssl_config_service_win_unittest.cc +++ b/net/base/ssl_config_service_win_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -81,6 +81,32 @@ TEST(SSLConfigServiceWinTest, SetTest) { EXPECT_FALSE(config.ssl2_enabled); net::SSLConfigServiceWin::SetSSL2Enabled(config_save.ssl2_enabled); + + // Test SetSSL3Enabled. + net::SSLConfigServiceWin::SetSSL3Enabled(true); + rv = net::SSLConfigServiceWin::GetSSLConfigNow(&config); + EXPECT_TRUE(rv); + EXPECT_TRUE(config.ssl3_enabled); + + net::SSLConfigServiceWin::SetSSL3Enabled(false); + rv = net::SSLConfigServiceWin::GetSSLConfigNow(&config); + EXPECT_TRUE(rv); + EXPECT_FALSE(config.ssl3_enabled); + + net::SSLConfigServiceWin::SetSSL3Enabled(config_save.ssl3_enabled); + + // Test SetTLS1Enabled. + net::SSLConfigServiceWin::SetTLS1Enabled(true); + rv = net::SSLConfigServiceWin::GetSSLConfigNow(&config); + EXPECT_TRUE(rv); + EXPECT_TRUE(config.tls1_enabled); + + net::SSLConfigServiceWin::SetTLS1Enabled(false); + rv = net::SSLConfigServiceWin::GetSSLConfigNow(&config); + EXPECT_TRUE(rv); + EXPECT_FALSE(config.tls1_enabled); + + net::SSLConfigServiceWin::SetTLS1Enabled(config_save.tls1_enabled); } TEST(SSLConfigServiceWinTest, GetTest) { |