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 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1236 // cipher suite defined only for higher protocol versions (such as | 1236 // cipher suite defined only for higher protocol versions (such as |
1237 // an SSL 3.0 server that chose a TLS-only cipher suite). Fall | 1237 // an SSL 3.0 server that chose a TLS-only cipher suite). Fall |
1238 // back to the next lower version and retry. | 1238 // back to the next lower version and retry. |
1239 // NOTE: if the SSLClientSocket class doesn't support TLS 1.1, | 1239 // NOTE: if the SSLClientSocket class doesn't support TLS 1.1, |
1240 // specifying TLS 1.1 in version_max will result in a TLS 1.0 | 1240 // specifying TLS 1.1 in version_max will result in a TLS 1.0 |
1241 // handshake, so falling back from TLS 1.1 to TLS 1.0 will simply | 1241 // handshake, so falling back from TLS 1.1 to TLS 1.0 will simply |
1242 // repeat the TLS 1.0 handshake. To avoid this problem, the default | 1242 // repeat the TLS 1.0 handshake. To avoid this problem, the default |
1243 // version_max should match the maximum protocol version supported | 1243 // version_max should match the maximum protocol version supported |
1244 // by the SSLClientSocket class. | 1244 // by the SSLClientSocket class. |
1245 version_max--; | 1245 version_max--; |
1246 | 1246 should_fallback = true; |
1247 // Fallback to the lower SSL version. | |
1248 // While SSL 3.0 fallback should be eliminated because of security | |
1249 // reasons, there is a high risk of breaking the servers if this is | |
1250 // done in general. | |
1251 // For now SSL 3.0 fallback is disabled for Google servers first, | |
1252 // and will be expanded to other servers after enough experiences | |
1253 // have been gained showing that this experiment works well with | |
1254 // today's Internet. | |
1255 if (version_max > SSL_PROTOCOL_VERSION_SSL3 || | |
1256 (server_ssl_config_.unrestricted_ssl3_fallback_enabled || | |
1257 !TransportSecurityState::IsGooglePinnedProperty( | |
1258 request_->url.host(), true /* include SNI */))) { | |
1259 should_fallback = true; | |
1260 } | |
1261 } | 1247 } |
1262 break; | 1248 break; |
1263 case ERR_SSL_BAD_RECORD_MAC_ALERT: | 1249 case ERR_SSL_BAD_RECORD_MAC_ALERT: |
1264 if (version_max >= SSL_PROTOCOL_VERSION_TLS1_1 && | 1250 if (version_max >= SSL_PROTOCOL_VERSION_TLS1_1 && |
1265 version_max > server_ssl_config_.version_min) { | 1251 version_max > server_ssl_config_.version_min) { |
1266 // Some broken SSL devices negotiate TLS 1.0 when sent a TLS 1.1 or | 1252 // Some broken SSL devices negotiate TLS 1.0 when sent a TLS 1.1 or |
1267 // 1.2 ClientHello, but then return a bad_record_mac alert. See | 1253 // 1.2 ClientHello, but then return a bad_record_mac alert. See |
1268 // crbug.com/260358. In order to make the fallback as minimal as | 1254 // crbug.com/260358. In order to make the fallback as minimal as |
1269 // possible, this fallback is only triggered for >= TLS 1.1. | 1255 // possible, this fallback is only triggered for >= TLS 1.1. |
1270 version_max--; | 1256 version_max--; |
1271 should_fallback = true; | 1257 should_fallback = true; |
1272 } | 1258 } |
1273 break; | 1259 break; |
1274 } | 1260 } |
1275 | 1261 |
| 1262 // While fallback should be eliminated because of security reasons, |
| 1263 // there is a high risk of breaking the servers if this is done in |
| 1264 // general. |
| 1265 // |
| 1266 // For now fallback is disabled for Google servers first, and will be |
| 1267 // expanded to other servers after enough experiences have been gained |
| 1268 // showing that this experiment works well with today's Internet. |
| 1269 // |
| 1270 // The --enable-unrestricted-ssl3-fallback command-line flag exists to allow |
| 1271 // fallback to any version, all the way down to SSLv3. |
| 1272 if (!server_ssl_config_.unrestricted_ssl3_fallback_enabled && |
| 1273 TransportSecurityState::IsGooglePinnedProperty(request_->url.host(), |
| 1274 true /* include SNI */)) { |
| 1275 should_fallback = false; |
| 1276 } |
| 1277 |
1276 if (should_fallback) { | 1278 if (should_fallback) { |
1277 net_log_.AddEvent( | 1279 net_log_.AddEvent( |
1278 NetLog::TYPE_SSL_VERSION_FALLBACK, | 1280 NetLog::TYPE_SSL_VERSION_FALLBACK, |
1279 base::Bind(&NetLogSSLVersionFallbackCallback, | 1281 base::Bind(&NetLogSSLVersionFallbackCallback, |
1280 &request_->url, error, server_ssl_config_.version_max, | 1282 &request_->url, error, server_ssl_config_.version_max, |
1281 version_max)); | 1283 version_max)); |
1282 server_ssl_config_.version_max = version_max; | 1284 server_ssl_config_.version_max = version_max; |
1283 server_ssl_config_.version_fallback = true; | 1285 server_ssl_config_.version_fallback = true; |
1284 ResetConnectionAndRequestForResend(); | 1286 ResetConnectionAndRequestForResend(); |
1285 error = OK; | 1287 error = OK; |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1482 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, | 1484 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, |
1483 state); | 1485 state); |
1484 break; | 1486 break; |
1485 } | 1487 } |
1486 return description; | 1488 return description; |
1487 } | 1489 } |
1488 | 1490 |
1489 #undef STATE_CASE | 1491 #undef STATE_CASE |
1490 | 1492 |
1491 } // namespace net | 1493 } // namespace net |
OLD | NEW |