OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/http/http_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1233 // cipher suite defined only for higher protocol versions (such as | 1233 // cipher suite defined only for higher protocol versions (such as |
1234 // an SSL 3.0 server that chose a TLS-only cipher suite). Fall | 1234 // an SSL 3.0 server that chose a TLS-only cipher suite). Fall |
1235 // back to the next lower version and retry. | 1235 // back to the next lower version and retry. |
1236 // NOTE: if the SSLClientSocket class doesn't support TLS 1.1, | 1236 // NOTE: if the SSLClientSocket class doesn't support TLS 1.1, |
1237 // specifying TLS 1.1 in version_max will result in a TLS 1.0 | 1237 // specifying TLS 1.1 in version_max will result in a TLS 1.0 |
1238 // handshake, so falling back from TLS 1.1 to TLS 1.0 will simply | 1238 // handshake, so falling back from TLS 1.1 to TLS 1.0 will simply |
1239 // repeat the TLS 1.0 handshake. To avoid this problem, the default | 1239 // repeat the TLS 1.0 handshake. To avoid this problem, the default |
1240 // version_max should match the maximum protocol version supported | 1240 // version_max should match the maximum protocol version supported |
1241 // by the SSLClientSocket class. | 1241 // by the SSLClientSocket class. |
1242 version_max--; | 1242 version_max--; |
1243 | 1243 should_fallback = true; |
1244 // Fallback to the lower SSL version. | |
1245 // While SSL 3.0 fallback should be eliminated because of security | |
1246 // reasons, there is a high risk of breaking the servers if this is | |
1247 // done in general. | |
1248 // For now SSL 3.0 fallback is disabled for Google servers first, | |
1249 // and will be expanded to other servers after enough experiences | |
1250 // have been gained showing that this experiment works well with | |
1251 // today's Internet. | |
1252 if (version_max > SSL_PROTOCOL_VERSION_SSL3 || | |
1253 (server_ssl_config_.unrestricted_ssl3_fallback_enabled || | |
1254 !TransportSecurityState::IsGooglePinnedProperty( | |
1255 request_->url.host(), true /* include SNI */))) { | |
1256 should_fallback = true; | |
1257 } | |
1258 } | 1244 } |
1259 break; | 1245 break; |
1260 case ERR_SSL_BAD_RECORD_MAC_ALERT: | 1246 case ERR_SSL_BAD_RECORD_MAC_ALERT: |
1261 if (version_max >= SSL_PROTOCOL_VERSION_TLS1_1 && | 1247 if (version_max >= SSL_PROTOCOL_VERSION_TLS1_1 && |
1262 version_max > server_ssl_config_.version_min) { | 1248 version_max > server_ssl_config_.version_min) { |
1263 // Some broken SSL devices negotiate TLS 1.0 when sent a TLS 1.1 or | 1249 // Some broken SSL devices negotiate TLS 1.0 when sent a TLS 1.1 or |
1264 // 1.2 ClientHello, but then return a bad_record_mac alert. See | 1250 // 1.2 ClientHello, but then return a bad_record_mac alert. See |
1265 // crbug.com/260358. In order to make the fallback as minimal as | 1251 // crbug.com/260358. In order to make the fallback as minimal as |
1266 // possible, this fallback is only triggered for >= TLS 1.1. | 1252 // possible, this fallback is only triggered for >= TLS 1.1. |
1267 version_max--; | 1253 version_max--; |
1268 should_fallback = true; | 1254 should_fallback = true; |
1269 } | 1255 } |
1270 break; | 1256 break; |
1271 } | 1257 } |
1272 | 1258 |
1259 // While fallback should be eliminated because of security reasons, | |
1260 // there is a high risk of breaking the servers if this is done in | |
1261 // general. | |
1262 // | |
1263 // For now fallback is disabled for Google servers first, and will be | |
1264 // expanded to other servers after enough experiences have been gained | |
1265 // showing that this experiment works well with today's Internet. | |
1266 if (!server_ssl_config_.unrestricted_ssl3_fallback_enabled && | |
wtc
2013/10/01 22:03:51
Nit: this comment should be updated to note that u
agl
2013/10/02 16:33:17
Done.
I lean against updating the config option n
| |
1267 TransportSecurityState::IsGooglePinnedProperty(request_->url.host(), | |
1268 true /* include SNI */)) { | |
1269 should_fallback = false; | |
1270 } | |
1271 | |
1273 if (should_fallback) { | 1272 if (should_fallback) { |
1274 net_log_.AddEvent( | 1273 net_log_.AddEvent( |
1275 NetLog::TYPE_SSL_VERSION_FALLBACK, | 1274 NetLog::TYPE_SSL_VERSION_FALLBACK, |
1276 base::Bind(&NetLogSSLVersionFallbackCallback, | 1275 base::Bind(&NetLogSSLVersionFallbackCallback, |
1277 &request_->url, error, server_ssl_config_.version_max, | 1276 &request_->url, error, server_ssl_config_.version_max, |
1278 version_max)); | 1277 version_max)); |
1279 server_ssl_config_.version_max = version_max; | 1278 server_ssl_config_.version_max = version_max; |
1280 server_ssl_config_.version_fallback = true; | 1279 server_ssl_config_.version_fallback = true; |
1281 ResetConnectionAndRequestForResend(); | 1280 ResetConnectionAndRequestForResend(); |
1282 error = OK; | 1281 error = OK; |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1479 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, | 1478 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, |
1480 state); | 1479 state); |
1481 break; | 1480 break; |
1482 } | 1481 } |
1483 return description; | 1482 return description; |
1484 } | 1483 } |
1485 | 1484 |
1486 #undef STATE_CASE | 1485 #undef STATE_CASE |
1487 | 1486 |
1488 } // namespace net | 1487 } // namespace net |
OLD | NEW |