Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(629)

Side by Side Diff: net/socket/ssl_client_socket_impl.cc

Issue 2382983002: Remove the last of the TLS fallback code. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/socket/ssl_client_socket_impl.h" 5 #include "net/socket/ssl_client_socket_impl.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <openssl/bio.h> 8 #include <openssl/bio.h>
9 #include <openssl/bytestring.h> 9 #include <openssl/bytestring.h>
10 #include <openssl/err.h> 10 #include <openssl/err.h>
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 788
789 SSLConnectionStatusSetCipherSuite( 789 SSLConnectionStatusSetCipherSuite(
790 static_cast<uint16_t>(SSL_CIPHER_get_id(cipher)), 790 static_cast<uint16_t>(SSL_CIPHER_get_id(cipher)),
791 &ssl_info->connection_status); 791 &ssl_info->connection_status);
792 SSLConnectionStatusSetVersion(GetNetSSLVersion(ssl_), 792 SSLConnectionStatusSetVersion(GetNetSSLVersion(ssl_),
793 &ssl_info->connection_status); 793 &ssl_info->connection_status);
794 794
795 if (!SSL_get_secure_renegotiation_support(ssl_)) 795 if (!SSL_get_secure_renegotiation_support(ssl_))
796 ssl_info->connection_status |= SSL_CONNECTION_NO_RENEGOTIATION_EXTENSION; 796 ssl_info->connection_status |= SSL_CONNECTION_NO_RENEGOTIATION_EXTENSION;
797 797
798 if (ssl_config_.version_fallback)
799 ssl_info->connection_status |= SSL_CONNECTION_VERSION_FALLBACK;
mmenke 2016/10/03 16:01:03 Can we remove SSL_CONNECTION_VERSION_FALLBACK from
davidben 2016/10/03 19:09:24 Done. Note this changes behavior slightly, but I t
mmenke 2016/10/03 20:12:01 I think it's fine, but I'd also be fine with dropp
800
801 ssl_info->handshake_type = SSL_session_reused(ssl_) 798 ssl_info->handshake_type = SSL_session_reused(ssl_)
802 ? SSLInfo::HANDSHAKE_RESUME 799 ? SSLInfo::HANDSHAKE_RESUME
803 : SSLInfo::HANDSHAKE_FULL; 800 : SSLInfo::HANDSHAKE_FULL;
804 801
805 return true; 802 return true;
806 } 803 }
807 804
808 void SSLClientSocketImpl::GetConnectionAttempts(ConnectionAttempts* out) const { 805 void SSLClientSocketImpl::GetConnectionAttempts(ConnectionAttempts* out) const {
809 out->clear(); 806 out->clear();
810 } 807 }
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 961
965 // Same as above, this time for the SSL mode. 962 // Same as above, this time for the SSL mode.
966 SslSetClearMask mode; 963 SslSetClearMask mode;
967 964
968 mode.ConfigureFlag(SSL_MODE_RELEASE_BUFFERS, true); 965 mode.ConfigureFlag(SSL_MODE_RELEASE_BUFFERS, true);
969 mode.ConfigureFlag(SSL_MODE_CBC_RECORD_SPLITTING, true); 966 mode.ConfigureFlag(SSL_MODE_CBC_RECORD_SPLITTING, true);
970 967
971 mode.ConfigureFlag(SSL_MODE_ENABLE_FALSE_START, 968 mode.ConfigureFlag(SSL_MODE_ENABLE_FALSE_START,
972 ssl_config_.false_start_enabled); 969 ssl_config_.false_start_enabled);
973 970
974 mode.ConfigureFlag(SSL_MODE_SEND_FALLBACK_SCSV, ssl_config_.version_fallback);
975
976 SSL_set_mode(ssl_, mode.set_mask); 971 SSL_set_mode(ssl_, mode.set_mask);
977 SSL_clear_mode(ssl_, mode.clear_mask); 972 SSL_clear_mode(ssl_, mode.clear_mask);
978 973
979 // Use BoringSSL defaults, but disable HMAC-SHA256 and HMAC-SHA384 ciphers 974 // Use BoringSSL defaults, but disable HMAC-SHA256 and HMAC-SHA384 ciphers
980 // (note that SHA256 and SHA384 only select legacy CBC ciphers). Also disable 975 // (note that SHA256 and SHA384 only select legacy CBC ciphers). Also disable
981 // DHE_RSA_WITH_AES_256_GCM_SHA384. Historically, AES_256_GCM was not 976 // DHE_RSA_WITH_AES_256_GCM_SHA384. Historically, AES_256_GCM was not
982 // supported. As DHE is being deprecated, don't add a cipher only to remove it 977 // supported. As DHE is being deprecated, don't add a cipher only to remove it
983 // immediately. 978 // immediately.
984 std::string command; 979 std::string command;
985 if (SSLClientSocket::IsPostQuantumExperimentEnabled()) { 980 if (SSLClientSocket::IsPostQuantumExperimentEnabled()) {
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 } 1145 }
1151 1146
1152 next_handshake_state_ = STATE_HANDSHAKE_COMPLETE; 1147 next_handshake_state_ = STATE_HANDSHAKE_COMPLETE;
1153 return net_error; 1148 return net_error;
1154 } 1149 }
1155 1150
1156 int SSLClientSocketImpl::DoHandshakeComplete(int result) { 1151 int SSLClientSocketImpl::DoHandshakeComplete(int result) {
1157 if (result < 0) 1152 if (result < 0)
1158 return result; 1153 return result;
1159 1154
1160 if (ssl_config_.version_fallback &&
1161 ssl_config_.version_max < ssl_config_.version_fallback_min) {
1162 return ERR_SSL_FALLBACK_BEYOND_MINIMUM_VERSION;
1163 }
1164
1165 // DHE is offered on the deprecated cipher fallback and then rejected 1155 // DHE is offered on the deprecated cipher fallback and then rejected
1166 // afterwards. This is to aid in diagnosing connection failures because a 1156 // afterwards. This is to aid in diagnosing connection failures because a
1167 // server requires DHE ciphers. 1157 // server requires DHE ciphers.
1168 // 1158 //
1169 // TODO(davidben): A few releases after DHE's removal, remove this logic. 1159 // TODO(davidben): A few releases after DHE's removal, remove this logic.
1170 if (!ssl_config_.dhe_enabled && 1160 if (!ssl_config_.dhe_enabled &&
1171 SSL_CIPHER_is_DHE(SSL_get_current_cipher(ssl_))) { 1161 SSL_CIPHER_is_DHE(SSL_get_current_cipher(ssl_))) {
1172 return ERR_SSL_OBSOLETE_CIPHER; 1162 return ERR_SSL_OBSOLETE_CIPHER;
1173 } 1163 }
1174 1164
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after
2023 2013
2024 void SSLClientSocketImpl::AddCTInfoToSSLInfo(SSLInfo* ssl_info) const { 2014 void SSLClientSocketImpl::AddCTInfoToSSLInfo(SSLInfo* ssl_info) const {
2025 ssl_info->UpdateCertificateTransparencyInfo(ct_verify_result_); 2015 ssl_info->UpdateCertificateTransparencyInfo(ct_verify_result_);
2026 } 2016 }
2027 2017
2028 std::string SSLClientSocketImpl::GetSessionCacheKey() const { 2018 std::string SSLClientSocketImpl::GetSessionCacheKey() const {
2029 std::string result = host_and_port_.ToString(); 2019 std::string result = host_and_port_.ToString();
2030 result.append("/"); 2020 result.append("/");
2031 result.append(ssl_session_cache_shard_); 2021 result.append(ssl_session_cache_shard_);
2032 2022
2033 // Shard the session cache based on maximum protocol version. This causes
2034 // fallback connections to use a separate session cache.
2035 result.append("/");
2036 switch (ssl_config_.version_max) {
2037 case SSL_PROTOCOL_VERSION_TLS1:
2038 result.append("tls1");
2039 break;
2040 case SSL_PROTOCOL_VERSION_TLS1_1:
2041 result.append("tls1.1");
2042 break;
2043 case SSL_PROTOCOL_VERSION_TLS1_2:
2044 result.append("tls1.2");
2045 break;
2046 case SSL_PROTOCOL_VERSION_TLS1_3:
2047 result.append("tls1.3");
2048 break;
2049 default:
2050 NOTREACHED();
2051 }
2052
2053 result.append("/"); 2023 result.append("/");
2054 if (ssl_config_.deprecated_cipher_suites_enabled) 2024 if (ssl_config_.deprecated_cipher_suites_enabled)
2055 result.append("deprecated"); 2025 result.append("deprecated");
2056 2026
2057 result.append("/"); 2027 result.append("/");
2058 if (ssl_config_.channel_id_enabled) 2028 if (ssl_config_.channel_id_enabled)
2059 result.append("channelid"); 2029 result.append("channelid");
2060 2030
2061 return result; 2031 return result;
2062 } 2032 }
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
2282 } 2252 }
2283 UMA_HISTOGRAM_ENUMERATION("DomainBoundCerts.Support", supported, 2253 UMA_HISTOGRAM_ENUMERATION("DomainBoundCerts.Support", supported,
2284 CHANNEL_ID_USAGE_MAX); 2254 CHANNEL_ID_USAGE_MAX);
2285 } 2255 }
2286 2256
2287 bool SSLClientSocketImpl::IsChannelIDEnabled() const { 2257 bool SSLClientSocketImpl::IsChannelIDEnabled() const {
2288 return ssl_config_.channel_id_enabled && channel_id_service_; 2258 return ssl_config_.channel_id_enabled && channel_id_service_;
2289 } 2259 }
2290 2260
2291 } // namespace net 2261 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698