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

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 namespace qualifier to definition. 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..49bcdff210e9ed53b783bbed28209e8bf4a2ec20 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,25 @@ 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();
Ryan Hamilton 2014/12/10 21:11:41 for (uint16 cipher : cipher_suites) { }
Bence 2014/12/11 16:50:49 Done.
+ it != cipher_suites.end(); ++it) {
+ if (IsSecureTLSCipherSuite(*it)) {
Ryan Hamilton 2014/12/10 21:11:41 Just to confirm, this is the right check, yes?
Ryan Sleevi 2014/12/10 22:53:06 Yes
+ 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 +266,13 @@ std::vector<uint8_t> SSLClientSocket::SerializeNextProtos(
LOG(WARNING) << "Ignoring empty NPN/ALPN protocol";
continue;
}
+ if (!advertise_http2) {
davidben 2014/12/10 21:29:57 I'm mildly unhappy that the SSL layer needs to kno
Ryan Sleevi 2014/12/10 22:53:06 It's almost like you were at the last IETF meeting
Ryan Hamilton 2014/12/11 19:59:05 We thought about this when bnc and I were brainsto
+ const NextProto proto = NextProtoFromString(*i);
+ if (kProtoSPDY4MinimumVersion <= proto &&
+ proto <= kProtoSPDY4MaximumVersion) {
Ryan Hamilton 2014/12/10 21:11:41 consider adding an IsHttp2NextProto(NextProto next
Bence 2014/12/11 16:50:49 It will not be in two places after rebasing on htt
+ continue;
+ }
+ }
wire_length += i->size();
wire_length++;
}
@@ -259,6 +284,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