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

Unified Diff: net/socket/ssl_client_socket_openssl.cc

Issue 1131763002: Reject renegotiations in SSLClientSocket by default. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: NSS greediness... Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/socket/ssl_client_socket_openssl.h ('k') | net/ssl/ssl_config.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/ssl_client_socket_openssl.cc
diff --git a/net/socket/ssl_client_socket_openssl.cc b/net/socket/ssl_client_socket_openssl.cc
index 9338bcf96c45cf9734247215a45bcea3f1c26a4c..88965f5688d2bbe129f8a34e483e92d5df49bfe4 100644
--- a/net/socket/ssl_client_socket_openssl.cc
+++ b/net/socket/ssl_client_socket_openssl.cc
@@ -843,6 +843,10 @@ int SSLClientSocketOpenSSL::Init() {
ssl_config_.fastradio_padding_enabled &&
ssl_config_.fastradio_padding_eligible);
+ // By default, renegotiations are rejected. After the initial handshake
+ // completes, some application protocols may re-enable it.
+ SSL_set_reject_peer_renegotiations(ssl_, 1);
+
return OK;
}
@@ -949,6 +953,9 @@ int SSLClientSocketOpenSSL::DoHandshake() {
SSL_get0_signed_cert_timestamp_list(ssl_, &sct_list, &sct_list_len);
set_signed_cert_timestamps_received(sct_list_len != 0);
+ if (IsRenegotiationAllowed())
+ SSL_set_reject_peer_renegotiations(ssl_, 0);
+
// Verify the certificate.
UpdateServerCert();
GotoState(STATE_VERIFY_CERT);
@@ -1886,6 +1893,18 @@ std::string SSLClientSocketOpenSSL::GetSessionCacheKey() const {
return result;
}
+bool SSLClientSocketOpenSSL::IsRenegotiationAllowed() const {
+ if (npn_status_ == kNextProtoUnsupported)
+ return ssl_config_.renego_allowed_default;
+
+ NextProto next_proto = NextProtoFromString(npn_proto_);
+ for (NextProto allowed : ssl_config_.renego_allowed_for_protos) {
+ if (next_proto == allowed)
+ return true;
+ }
+ return false;
+}
+
scoped_refptr<X509Certificate>
SSLClientSocketOpenSSL::GetUnverifiedServerCertificateChain() const {
return server_cert_;
« no previous file with comments | « net/socket/ssl_client_socket_openssl.h ('k') | net/ssl/ssl_config.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698