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

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

Issue 2382983002: Remove the last of the TLS fallback code. (Closed)
Patch Set: mmenke comments 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
« no previous file with comments | « net/base/net_error_list.h ('k') | net/socket/ssl_client_socket_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 792
793 SSLConnectionStatusSetCipherSuite( 793 SSLConnectionStatusSetCipherSuite(
794 static_cast<uint16_t>(SSL_CIPHER_get_id(cipher)), 794 static_cast<uint16_t>(SSL_CIPHER_get_id(cipher)),
795 &ssl_info->connection_status); 795 &ssl_info->connection_status);
796 SSLConnectionStatusSetVersion(GetNetSSLVersion(ssl_), 796 SSLConnectionStatusSetVersion(GetNetSSLVersion(ssl_),
797 &ssl_info->connection_status); 797 &ssl_info->connection_status);
798 798
799 if (!SSL_get_secure_renegotiation_support(ssl_)) 799 if (!SSL_get_secure_renegotiation_support(ssl_))
800 ssl_info->connection_status |= SSL_CONNECTION_NO_RENEGOTIATION_EXTENSION; 800 ssl_info->connection_status |= SSL_CONNECTION_NO_RENEGOTIATION_EXTENSION;
801 801
802 if (ssl_config_.version_fallback)
803 ssl_info->connection_status |= SSL_CONNECTION_VERSION_FALLBACK;
804
805 ssl_info->handshake_type = SSL_session_reused(ssl_) 802 ssl_info->handshake_type = SSL_session_reused(ssl_)
806 ? SSLInfo::HANDSHAKE_RESUME 803 ? SSLInfo::HANDSHAKE_RESUME
807 : SSLInfo::HANDSHAKE_FULL; 804 : SSLInfo::HANDSHAKE_FULL;
808 805
809 return true; 806 return true;
810 } 807 }
811 808
812 void SSLClientSocketImpl::GetConnectionAttempts(ConnectionAttempts* out) const { 809 void SSLClientSocketImpl::GetConnectionAttempts(ConnectionAttempts* out) const {
813 out->clear(); 810 out->clear();
814 } 811 }
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 965
969 // Same as above, this time for the SSL mode. 966 // Same as above, this time for the SSL mode.
970 SslSetClearMask mode; 967 SslSetClearMask mode;
971 968
972 mode.ConfigureFlag(SSL_MODE_RELEASE_BUFFERS, true); 969 mode.ConfigureFlag(SSL_MODE_RELEASE_BUFFERS, true);
973 mode.ConfigureFlag(SSL_MODE_CBC_RECORD_SPLITTING, true); 970 mode.ConfigureFlag(SSL_MODE_CBC_RECORD_SPLITTING, true);
974 971
975 mode.ConfigureFlag(SSL_MODE_ENABLE_FALSE_START, 972 mode.ConfigureFlag(SSL_MODE_ENABLE_FALSE_START,
976 ssl_config_.false_start_enabled); 973 ssl_config_.false_start_enabled);
977 974
978 mode.ConfigureFlag(SSL_MODE_SEND_FALLBACK_SCSV, ssl_config_.version_fallback);
979
980 SSL_set_mode(ssl_, mode.set_mask); 975 SSL_set_mode(ssl_, mode.set_mask);
981 SSL_clear_mode(ssl_, mode.clear_mask); 976 SSL_clear_mode(ssl_, mode.clear_mask);
982 977
983 // Use BoringSSL defaults, but disable HMAC-SHA256 and HMAC-SHA384 ciphers 978 // Use BoringSSL defaults, but disable HMAC-SHA256 and HMAC-SHA384 ciphers
984 // (note that SHA256 and SHA384 only select legacy CBC ciphers). Also disable 979 // (note that SHA256 and SHA384 only select legacy CBC ciphers). Also disable
985 // DHE_RSA_WITH_AES_256_GCM_SHA384. Historically, AES_256_GCM was not 980 // DHE_RSA_WITH_AES_256_GCM_SHA384. Historically, AES_256_GCM was not
986 // supported. As DHE is being deprecated, don't add a cipher only to remove it 981 // supported. As DHE is being deprecated, don't add a cipher only to remove it
987 // immediately. 982 // immediately.
988 std::string command; 983 std::string command;
989 if (SSLClientSocket::IsPostQuantumExperimentEnabled()) { 984 if (SSLClientSocket::IsPostQuantumExperimentEnabled()) {
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
1154 } 1149 }
1155 1150
1156 next_handshake_state_ = STATE_HANDSHAKE_COMPLETE; 1151 next_handshake_state_ = STATE_HANDSHAKE_COMPLETE;
1157 return net_error; 1152 return net_error;
1158 } 1153 }
1159 1154
1160 int SSLClientSocketImpl::DoHandshakeComplete(int result) { 1155 int SSLClientSocketImpl::DoHandshakeComplete(int result) {
1161 if (result < 0) 1156 if (result < 0)
1162 return result; 1157 return result;
1163 1158
1164 if (ssl_config_.version_fallback &&
1165 ssl_config_.version_max < ssl_config_.version_fallback_min) {
1166 return ERR_SSL_FALLBACK_BEYOND_MINIMUM_VERSION;
1167 }
1168
1169 // DHE is offered on the deprecated cipher fallback and then rejected 1159 // DHE is offered on the deprecated cipher fallback and then rejected
1170 // afterwards. This is to aid in diagnosing connection failures because a 1160 // afterwards. This is to aid in diagnosing connection failures because a
1171 // server requires DHE ciphers. 1161 // server requires DHE ciphers.
1172 // 1162 //
1173 // TODO(davidben): A few releases after DHE's removal, remove this logic. 1163 // TODO(davidben): A few releases after DHE's removal, remove this logic.
1174 if (!ssl_config_.dhe_enabled && 1164 if (!ssl_config_.dhe_enabled &&
1175 SSL_CIPHER_is_DHE(SSL_get_current_cipher(ssl_))) { 1165 SSL_CIPHER_is_DHE(SSL_get_current_cipher(ssl_))) {
1176 return ERR_SSL_OBSOLETE_CIPHER; 1166 return ERR_SSL_OBSOLETE_CIPHER;
1177 } 1167 }
1178 1168
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after
2027 2017
2028 void SSLClientSocketImpl::AddCTInfoToSSLInfo(SSLInfo* ssl_info) const { 2018 void SSLClientSocketImpl::AddCTInfoToSSLInfo(SSLInfo* ssl_info) const {
2029 ssl_info->UpdateCertificateTransparencyInfo(ct_verify_result_); 2019 ssl_info->UpdateCertificateTransparencyInfo(ct_verify_result_);
2030 } 2020 }
2031 2021
2032 std::string SSLClientSocketImpl::GetSessionCacheKey() const { 2022 std::string SSLClientSocketImpl::GetSessionCacheKey() const {
2033 std::string result = host_and_port_.ToString(); 2023 std::string result = host_and_port_.ToString();
2034 result.append("/"); 2024 result.append("/");
2035 result.append(ssl_session_cache_shard_); 2025 result.append(ssl_session_cache_shard_);
2036 2026
2037 // Shard the session cache based on maximum protocol version. This causes
2038 // fallback connections to use a separate session cache.
2039 result.append("/");
2040 switch (ssl_config_.version_max) {
2041 case SSL_PROTOCOL_VERSION_TLS1:
2042 result.append("tls1");
2043 break;
2044 case SSL_PROTOCOL_VERSION_TLS1_1:
2045 result.append("tls1.1");
2046 break;
2047 case SSL_PROTOCOL_VERSION_TLS1_2:
2048 result.append("tls1.2");
2049 break;
2050 case SSL_PROTOCOL_VERSION_TLS1_3:
2051 result.append("tls1.3");
2052 break;
2053 default:
2054 NOTREACHED();
2055 }
2056
2057 result.append("/"); 2027 result.append("/");
2058 if (ssl_config_.deprecated_cipher_suites_enabled) 2028 if (ssl_config_.deprecated_cipher_suites_enabled)
2059 result.append("deprecated"); 2029 result.append("deprecated");
2060 2030
2061 result.append("/"); 2031 result.append("/");
2062 if (ssl_config_.channel_id_enabled) 2032 if (ssl_config_.channel_id_enabled)
2063 result.append("channelid"); 2033 result.append("channelid");
2064 2034
2065 return result; 2035 return result;
2066 } 2036 }
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
2318 if (ERR_GET_REASON(info->error_code) == SSL_R_TLSV1_ALERT_ACCESS_DENIED && 2288 if (ERR_GET_REASON(info->error_code) == SSL_R_TLSV1_ALERT_ACCESS_DENIED &&
2319 !certificate_requested_) { 2289 !certificate_requested_) {
2320 net_error = ERR_SSL_PROTOCOL_ERROR; 2290 net_error = ERR_SSL_PROTOCOL_ERROR;
2321 } 2291 }
2322 } 2292 }
2323 2293
2324 return net_error; 2294 return net_error;
2325 } 2295 }
2326 2296
2327 } // namespace net 2297 } // namespace net
OLDNEW
« no previous file with comments | « net/base/net_error_list.h ('k') | net/socket/ssl_client_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698