| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/base/ssl_config_service.h" | 5 #include "net/base/ssl_config_service.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "net/base/crl_set.h" | 9 #include "net/base/crl_set.h" |
| 10 #include "net/base/ssl_config_service_defaults.h" | 10 #include "net/base/ssl_config_service_defaults.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 : observer_list_(ObserverList<Observer>::NOTIFY_EXISTING_ONLY) { | 52 : observer_list_(ObserverList<Observer>::NOTIFY_EXISTING_ONLY) { |
| 53 } | 53 } |
| 54 | 54 |
| 55 // static | 55 // static |
| 56 bool SSLConfigService::IsKnownFalseStartIncompatibleServer( | 56 bool SSLConfigService::IsKnownFalseStartIncompatibleServer( |
| 57 const std::string& hostname) { | 57 const std::string& hostname) { |
| 58 return SSLFalseStartBlacklist::IsMember(hostname); | 58 return SSLFalseStartBlacklist::IsMember(hostname); |
| 59 } | 59 } |
| 60 | 60 |
| 61 static bool g_cached_info_enabled = false; | 61 static bool g_cached_info_enabled = false; |
| 62 static bool g_origin_bound_certs_enabled = false; | |
| 63 static bool g_false_start_enabled = true; | 62 static bool g_false_start_enabled = true; |
| 64 static bool g_dns_cert_provenance_checking = false; | 63 static bool g_dns_cert_provenance_checking = false; |
| 65 base::LazyInstance<scoped_refptr<CRLSet>, | 64 base::LazyInstance<scoped_refptr<CRLSet>, |
| 66 base::LeakyLazyInstanceTraits<scoped_refptr<CRLSet> > > | 65 base::LeakyLazyInstanceTraits<scoped_refptr<CRLSet> > > |
| 67 g_crl_set = LAZY_INSTANCE_INITIALIZER; | 66 g_crl_set = LAZY_INSTANCE_INITIALIZER; |
| 68 | 67 |
| 69 // static | 68 // static |
| 70 void SSLConfigService::DisableFalseStart() { | 69 void SSLConfigService::DisableFalseStart() { |
| 71 g_false_start_enabled = false; | 70 g_false_start_enabled = false; |
| 72 } | 71 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 98 | 97 |
| 99 void SSLConfigService::EnableCachedInfo() { | 98 void SSLConfigService::EnableCachedInfo() { |
| 100 g_cached_info_enabled = true; | 99 g_cached_info_enabled = true; |
| 101 } | 100 } |
| 102 | 101 |
| 103 // static | 102 // static |
| 104 bool SSLConfigService::cached_info_enabled() { | 103 bool SSLConfigService::cached_info_enabled() { |
| 105 return g_cached_info_enabled; | 104 return g_cached_info_enabled; |
| 106 } | 105 } |
| 107 | 106 |
| 108 // static | |
| 109 void SSLConfigService::EnableOriginBoundCerts() { | |
| 110 g_origin_bound_certs_enabled = true; | |
| 111 } | |
| 112 | |
| 113 // static | |
| 114 bool SSLConfigService::origin_bound_certs_enabled() { | |
| 115 return g_origin_bound_certs_enabled; | |
| 116 } | |
| 117 | |
| 118 void SSLConfigService::AddObserver(Observer* observer) { | 107 void SSLConfigService::AddObserver(Observer* observer) { |
| 119 observer_list_.AddObserver(observer); | 108 observer_list_.AddObserver(observer); |
| 120 } | 109 } |
| 121 | 110 |
| 122 void SSLConfigService::RemoveObserver(Observer* observer) { | 111 void SSLConfigService::RemoveObserver(Observer* observer) { |
| 123 observer_list_.RemoveObserver(observer); | 112 observer_list_.RemoveObserver(observer); |
| 124 } | 113 } |
| 125 | 114 |
| 126 SSLConfigService::~SSLConfigService() { | 115 SSLConfigService::~SSLConfigService() { |
| 127 } | 116 } |
| 128 | 117 |
| 129 // static | 118 // static |
| 130 void SSLConfigService::SetSSLConfigFlags(SSLConfig* ssl_config) { | 119 void SSLConfigService::SetSSLConfigFlags(SSLConfig* ssl_config) { |
| 131 ssl_config->false_start_enabled = g_false_start_enabled; | 120 ssl_config->false_start_enabled = g_false_start_enabled; |
| 132 ssl_config->dns_cert_provenance_checking_enabled = | 121 ssl_config->dns_cert_provenance_checking_enabled = |
| 133 g_dns_cert_provenance_checking; | 122 g_dns_cert_provenance_checking; |
| 134 ssl_config->cached_info_enabled = g_cached_info_enabled; | 123 ssl_config->cached_info_enabled = g_cached_info_enabled; |
| 135 ssl_config->origin_bound_certs_enabled = g_origin_bound_certs_enabled; | |
| 136 } | 124 } |
| 137 | 125 |
| 138 void SSLConfigService::ProcessConfigUpdate(const SSLConfig& orig_config, | 126 void SSLConfigService::ProcessConfigUpdate(const SSLConfig& orig_config, |
| 139 const SSLConfig& new_config) { | 127 const SSLConfig& new_config) { |
| 140 bool config_changed = | 128 bool config_changed = |
| 141 (orig_config.rev_checking_enabled != new_config.rev_checking_enabled) || | 129 (orig_config.rev_checking_enabled != new_config.rev_checking_enabled) || |
| 142 (orig_config.ssl3_enabled != new_config.ssl3_enabled) || | 130 (orig_config.ssl3_enabled != new_config.ssl3_enabled) || |
| 143 (orig_config.tls1_enabled != new_config.tls1_enabled) || | 131 (orig_config.tls1_enabled != new_config.tls1_enabled) || |
| 144 (orig_config.disabled_cipher_suites != | 132 (orig_config.disabled_cipher_suites != |
| 145 new_config.disabled_cipher_suites); | 133 new_config.disabled_cipher_suites) || |
| 134 (orig_config.origin_bound_certs_enabled != |
| 135 new_config.origin_bound_certs_enabled); |
| 146 | 136 |
| 147 if (config_changed) | 137 if (config_changed) |
| 148 FOR_EACH_OBSERVER(Observer, observer_list_, OnSSLConfigChanged()); | 138 FOR_EACH_OBSERVER(Observer, observer_list_, OnSSLConfigChanged()); |
| 149 } | 139 } |
| 150 | 140 |
| 151 // static | 141 // static |
| 152 bool SSLConfigService::IsSNIAvailable(SSLConfigService* service) { | 142 bool SSLConfigService::IsSNIAvailable(SSLConfigService* service) { |
| 153 if (!service) | 143 if (!service) |
| 154 return false; | 144 return false; |
| 155 | 145 |
| 156 SSLConfig ssl_config; | 146 SSLConfig ssl_config; |
| 157 service->GetSSLConfig(&ssl_config); | 147 service->GetSSLConfig(&ssl_config); |
| 158 return ssl_config.tls1_enabled; | 148 return ssl_config.tls1_enabled; |
| 159 } | 149 } |
| 160 | 150 |
| 161 } // namespace net | 151 } // namespace net |
| OLD | NEW |