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

Unified Diff: remoting/protocol/ssl_hmac_channel_authenticator.cc

Issue 2300533002: Stop caching DER-encoded certificates unnecessarily (Closed)
Patch Set: More feedback Created 4 years, 4 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
« net/socket/ssl_server_socket_unittest.cc ('K') | « net/ssl/ssl_config.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/ssl_hmac_channel_authenticator.cc
diff --git a/remoting/protocol/ssl_hmac_channel_authenticator.cc b/remoting/protocol/ssl_hmac_channel_authenticator.cc
index e0aa78108b41cdbc9a06289f8ebf976c1c2fabd2..e66ca53028d3abac99799f714056ab901b678a77 100644
--- a/remoting/protocol/ssl_hmac_channel_authenticator.cc
+++ b/remoting/protocol/ssl_hmac_channel_authenticator.cc
@@ -258,7 +258,7 @@ void SslHmacChannelAuthenticator::SecureAndAuthenticate(
scoped_refptr<net::X509Certificate> cert =
net::X509Certificate::CreateFromBytes(local_cert_.data(),
local_cert_.length());
- if (!cert.get()) {
+ if (!cert) {
LOG(ERROR) << "Failed to parse X509Certificate";
NotifyError(net::ERR_FAILED);
return;
@@ -285,10 +285,6 @@ void SslHmacChannelAuthenticator::SecureAndAuthenticate(
ct_verifier_.reset(new IgnoresCTVerifier);
ct_policy_enforcer_.reset(new IgnoresCTPolicyEnforcer);
- net::SSLConfig::CertAndStatus cert_and_status;
- cert_and_status.cert_status = net::CERT_STATUS_AUTHORITY_INVALID;
- cert_and_status.der_cert = remote_cert_;
-
net::SSLConfig ssl_config;
// Certificate verification and revocation checking are not needed
// because we use self-signed certs. Disable it so that the SSL
@@ -296,9 +292,22 @@ void SslHmacChannelAuthenticator::SecureAndAuthenticate(
// thread).
ssl_config.cert_io_enabled = false;
ssl_config.rev_checking_enabled = false;
- ssl_config.allowed_bad_certs.push_back(cert_and_status);
ssl_config.require_ecdhe = true;
+ scoped_refptr<net::X509Certificate> cert =
+ net::X509Certificate::CreateFromBytes(remote_cert_.data(),
+ remote_cert_.length());
+ if (!cert) {
+ LOG(ERROR) << "Failed to parse X509Certificate";
+ NotifyError(net::ERR_FAILED);
+ return;
+ }
+
+ net::SSLConfig::CertAndStatus cert_and_status;
+ cert_and_status.cert = std::move(cert);
+ cert_and_status.cert_status = net::CERT_STATUS_AUTHORITY_INVALID;
+ ssl_config.allowed_bad_certs.emplace_back(std::move(cert_and_status));
davidben 2016/09/01 19:44:40 Ditto
+
net::HostPortPair host_and_port(kSslFakeHostName, 0);
net::SSLClientSocketContext context;
context.transport_security_state = transport_security_state_.get();
« net/socket/ssl_server_socket_unittest.cc ('K') | « net/ssl/ssl_config.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698