OLD | NEW |
---|---|
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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
465 policy_enforcer_(context.cert_policy_enforcer), | 465 policy_enforcer_(context.cert_policy_enforcer), |
466 net_log_(transport_->socket()->NetLog()), | 466 net_log_(transport_->socket()->NetLog()), |
467 weak_factory_(this) { | 467 weak_factory_(this) { |
468 DCHECK(cert_verifier_); | 468 DCHECK(cert_verifier_); |
469 } | 469 } |
470 | 470 |
471 SSLClientSocketOpenSSL::~SSLClientSocketOpenSSL() { | 471 SSLClientSocketOpenSSL::~SSLClientSocketOpenSSL() { |
472 Disconnect(); | 472 Disconnect(); |
473 } | 473 } |
474 | 474 |
475 void SSLClientSocketOpenSSL::SetSslKeyLogFile(std::string ssl_keylog_file) { | |
476 std::string env_keylog_file; | |
477 scoped_ptr<base::Environment> env(base::Environment::Create()); | |
Bryan McQuade
2015/10/14 00:38:54
I think there's some benefit to centralizing the l
| |
478 if (env->GetVar("SSLKEYLOGFILE", &env_keylog_file) && | |
479 !env_keylog_file.empty()) { | |
480 return; | |
481 } | |
482 | |
483 crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE); | |
484 BIO* bio = BIO_new_file(ssl_keylog_file.c_str(), "a"); | |
485 if (!bio) { | |
486 LOG(ERROR) << "Failed to open " << ssl_keylog_file; | |
487 ERR_print_errors_cb(&LogErrorCallback, NULL); | |
488 } else { | |
489 SSL_CTX_set_keylog_bio(SSLContext::GetInstance()->ssl_ctx(), bio); | |
490 } | |
491 } | |
492 | |
475 void SSLClientSocketOpenSSL::GetSSLCertRequestInfo( | 493 void SSLClientSocketOpenSSL::GetSSLCertRequestInfo( |
476 SSLCertRequestInfo* cert_request_info) { | 494 SSLCertRequestInfo* cert_request_info) { |
477 cert_request_info->host_and_port = host_and_port_; | 495 cert_request_info->host_and_port = host_and_port_; |
478 cert_request_info->cert_authorities = cert_authorities_; | 496 cert_request_info->cert_authorities = cert_authorities_; |
479 cert_request_info->cert_key_types = cert_key_types_; | 497 cert_request_info->cert_key_types = cert_key_types_; |
480 } | 498 } |
481 | 499 |
482 SSLClientSocket::NextProtoStatus SSLClientSocketOpenSSL::GetNextProto( | 500 SSLClientSocket::NextProtoStatus SSLClientSocketOpenSSL::GetNextProto( |
483 std::string* proto) const { | 501 std::string* proto) const { |
484 *proto = npn_proto_; | 502 *proto = npn_proto_; |
(...skipping 1682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2167 OnHandshakeIOComplete(signature_result_); | 2185 OnHandshakeIOComplete(signature_result_); |
2168 return; | 2186 return; |
2169 } | 2187 } |
2170 | 2188 |
2171 // During a renegotiation, either Read or Write calls may be blocked on an | 2189 // During a renegotiation, either Read or Write calls may be blocked on an |
2172 // asynchronous private key operation. | 2190 // asynchronous private key operation. |
2173 PumpReadWriteEvents(); | 2191 PumpReadWriteEvents(); |
2174 } | 2192 } |
2175 | 2193 |
2176 } // namespace net | 2194 } // namespace net |
OLD | NEW |