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

Unified Diff: net/socket/ssl_client_socket.cc

Issue 757033004: Do not use HTTP/2 without adequate security. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add ssl_cipher_suite_names to NaCl build. Created 6 years 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
Index: net/socket/ssl_client_socket.cc
diff --git a/net/socket/ssl_client_socket.cc b/net/socket/ssl_client_socket.cc
index a52e6a3c052c70eba239aa57594c8a390816fc56..17643552e5186e48898ffb45804c176219310c3e 100644
--- a/net/socket/ssl_client_socket.cc
+++ b/net/socket/ssl_client_socket.cc
@@ -11,6 +11,7 @@
#include "net/base/connection_type_histograms.h"
#include "net/base/host_port_pair.h"
#include "net/ssl/channel_id_service.h"
+#include "net/ssl/ssl_cipher_suite_names.h"
#include "net/ssl/ssl_config_service.h"
#include "net/ssl/ssl_connection_status_flags.h"
@@ -234,8 +235,23 @@ bool SSLClientSocket::IsChannelIDEnabled(
}
// static
+bool SSLClientSocket::IsSecurityAdequateForHTTP2(
+ const SSLConfig& ssl_config,
+ const std::vector<uint16>& cipher_suites) {
+ if (ssl_config.version_max < SSL_PROTOCOL_VERSION_TLS1_2)
+ return false;
+ for (std::vector<uint16>::const_iterator it = cipher_suites.begin();
+ it != cipher_suites.end(); ++it) {
+ if (IsSecureTLSCipherSuite(*it))
+ return true;
+ }
+ return false;
+}
+
+// static
std::vector<uint8_t> SSLClientSocket::SerializeNextProtos(
- const std::vector<std::string>& next_protos) {
+ const std::vector<std::string>& next_protos,
+ bool advertise_http2) {
// Do a first pass to determine the total length.
size_t wire_length = 0;
for (std::vector<std::string>::const_iterator i = next_protos.begin();
@@ -248,6 +264,13 @@ std::vector<uint8_t> SSLClientSocket::SerializeNextProtos(
LOG(WARNING) << "Ignoring empty NPN/ALPN protocol";
continue;
}
+ if (!advertise_http2) {
+ const NextProto proto = NextProtoFromString(*i);
+ if (kProtoSPDY4MinimumVersion <= proto &&
+ proto <= kProtoSPDY4MaximumVersion) {
+ continue;
+ }
+ }
wire_length += i->size();
wire_length++;
}
@@ -259,6 +282,13 @@ std::vector<uint8_t> SSLClientSocket::SerializeNextProtos(
i != next_protos.end(); i++) {
if (i->size() == 0 || i->size() > 255)
continue;
+ if (!advertise_http2) {
+ const NextProto proto = NextProtoFromString(*i);
+ if (kProtoSPDY4MinimumVersion <= proto &&
+ proto <= kProtoSPDY4MaximumVersion) {
+ continue;
+ }
+ }
wire_protos.push_back(i->size());
wire_protos.resize(wire_protos.size() + i->size());
memcpy(&wire_protos[wire_protos.size() - i->size()],

Powered by Google App Engine
This is Rietveld 408576698