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

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

Issue 1366253005: Expose TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 on the deprecated cipher fallback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « no previous file | no next file » | 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 // OpenSSL binding for SSLClientSocket. The class layout and general principle 5 // OpenSSL binding for SSLClientSocket. The class layout and general principle
6 // of operation is derived from SSLClientSocketNSS. 6 // of operation is derived from SSLClientSocketNSS.
7 7
8 #include "net/socket/ssl_client_socket_openssl.h" 8 #include "net/socket/ssl_client_socket_openssl.h"
9 9
10 #include <errno.h> 10 #include <errno.h>
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 876
877 SSL_set_mode(ssl_, mode.set_mask); 877 SSL_set_mode(ssl_, mode.set_mask);
878 SSL_clear_mode(ssl_, mode.clear_mask); 878 SSL_clear_mode(ssl_, mode.clear_mask);
879 879
880 // Removing ciphers by ID from OpenSSL is a bit involved as we must use the 880 // Removing ciphers by ID from OpenSSL is a bit involved as we must use the
881 // textual name with SSL_set_cipher_list because there is no public API to 881 // textual name with SSL_set_cipher_list because there is no public API to
882 // directly remove a cipher by ID. 882 // directly remove a cipher by ID.
883 STACK_OF(SSL_CIPHER)* ciphers = SSL_get_ciphers(ssl_); 883 STACK_OF(SSL_CIPHER)* ciphers = SSL_get_ciphers(ssl_);
884 DCHECK(ciphers); 884 DCHECK(ciphers);
885 // See SSLConfig::disabled_cipher_suites for description of the suites 885 // See SSLConfig::disabled_cipher_suites for description of the suites
886 // disabled by default. Note that !SHA256 and !SHA384 only remove HMAC-SHA256 886 // disabled by default. Note that SHA256 and SHA384 only select HMAC-SHA256
887 // and HMAC-SHA384 cipher suites, not GCM cipher suites with SHA256 or SHA384 887 // and HMAC-SHA384 cipher suites, not GCM cipher suites with SHA256 or SHA384
888 // as the handshake hash. 888 // as the handshake hash.
889 std::string command("DEFAULT:!SHA256:!SHA384:!AESGCM+AES256:!aPSK"); 889 std::string command("DEFAULT:!SHA256:-SHA384:!AESGCM+AES256:!aPSK");
890 // Walk through all the installed ciphers, seeing if any need to be 890 // Walk through all the installed ciphers, seeing if any need to be
891 // appended to the cipher removal |command|. 891 // appended to the cipher removal |command|.
892 for (size_t i = 0; i < sk_SSL_CIPHER_num(ciphers); ++i) { 892 for (size_t i = 0; i < sk_SSL_CIPHER_num(ciphers); ++i) {
893 const SSL_CIPHER* cipher = sk_SSL_CIPHER_value(ciphers, i); 893 const SSL_CIPHER* cipher = sk_SSL_CIPHER_value(ciphers, i);
894 const uint16 id = static_cast<uint16>(SSL_CIPHER_get_id(cipher)); 894 const uint16 id = static_cast<uint16>(SSL_CIPHER_get_id(cipher));
895 bool disable = false; 895 bool disable = false;
896 if (ssl_config_.require_ecdhe) { 896 if (ssl_config_.require_ecdhe) {
897 base::StringPiece kx_name(SSL_CIPHER_get_kx_name(cipher)); 897 base::StringPiece kx_name(SSL_CIPHER_get_kx_name(cipher));
898 disable = kx_name != "ECDHE_RSA" && kx_name != "ECDHE_ECDSA"; 898 disable = kx_name != "ECDHE_RSA" && kx_name != "ECDHE_ECDSA";
899 } 899 }
900 if (!disable) { 900 if (!disable) {
901 disable = std::find(ssl_config_.disabled_cipher_suites.begin(), 901 disable = std::find(ssl_config_.disabled_cipher_suites.begin(),
902 ssl_config_.disabled_cipher_suites.end(), id) != 902 ssl_config_.disabled_cipher_suites.end(), id) !=
903 ssl_config_.disabled_cipher_suites.end(); 903 ssl_config_.disabled_cipher_suites.end();
904 } 904 }
905 if (disable) { 905 if (disable) {
906 const char* name = SSL_CIPHER_get_name(cipher); 906 const char* name = SSL_CIPHER_get_name(cipher);
907 DVLOG(3) << "Found cipher to remove: '" << name << "', ID: " << id 907 DVLOG(3) << "Found cipher to remove: '" << name << "', ID: " << id
908 << " strength: " << SSL_CIPHER_get_bits(cipher, NULL); 908 << " strength: " << SSL_CIPHER_get_bits(cipher, NULL);
909 command.append(":!"); 909 command.append(":!");
910 command.append(name); 910 command.append(name);
911 } 911 }
912 } 912 }
913 913
914 if (!ssl_config_.enable_deprecated_cipher_suites) 914 if (!ssl_config_.enable_deprecated_cipher_suites) {
915 command.append(":!RC4"); 915 command.append(":!RC4");
916 } else {
917 // Add TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 under a fallback. This is
918 // believed to work around a bug in some out-of-date Microsoft IIS servers
919 // which cause them to require the version downgrade
920 // (https://crbug.com/433406).
921 command.append(":ECDHE-RSA-AES256-SHA384");
922 }
916 923
917 // Disable ECDSA cipher suites on platforms that do not support ECDSA 924 // Disable ECDSA cipher suites on platforms that do not support ECDSA
918 // signed certificates, as servers may use the presence of such 925 // signed certificates, as servers may use the presence of such
919 // ciphersuites as a hint to send an ECDSA certificate. 926 // ciphersuites as a hint to send an ECDSA certificate.
920 #if defined(OS_WIN) 927 #if defined(OS_WIN)
921 if (base::win::GetVersion() < base::win::VERSION_VISTA) 928 if (base::win::GetVersion() < base::win::VERSION_VISTA)
922 command.append(":!ECDSA"); 929 command.append(":!ECDSA");
923 #endif 930 #endif
924 931
925 int rv = SSL_set_cipher_list(ssl_, command.c_str()); 932 int rv = SSL_set_cipher_list(ssl_, command.c_str());
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after
2134 OnHandshakeIOComplete(signature_result_); 2141 OnHandshakeIOComplete(signature_result_);
2135 return; 2142 return;
2136 } 2143 }
2137 2144
2138 // During a renegotiation, either Read or Write calls may be blocked on an 2145 // During a renegotiation, either Read or Write calls may be blocked on an
2139 // asynchronous private key operation. 2146 // asynchronous private key operation.
2140 PumpReadWriteEvents(); 2147 PumpReadWriteEvents();
2141 } 2148 }
2142 2149
2143 } // namespace net 2150 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698