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_openssl.cc

Issue 1403863002: Enable exporting SSLKEYLOGFILE on Android w/ command line arguments (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
« chrome/common/chrome_switches.cc ('K') | « chrome/common/chrome_switches.cc ('k') | no next file » | 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 1e0d799e6a731167e86489a9449142eb78752a91..23ea8cb8a49cb9ea5c2c2d52a9ed262251142b74 100644
--- a/net/socket/ssl_client_socket_openssl.cc
+++ b/net/socket/ssl_client_socket_openssl.cc
@@ -222,6 +222,18 @@ class SSLClientSocketOpenSSL::SSLContext {
private:
friend struct base::DefaultSingletonTraits<SSLContext>;
+ void SetKeyLogFile(std::string ssl_keylog_file) {
+ DCHECK(!ssl_keylog_file.empty());
+ crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE);
+ BIO* bio = BIO_new_file(ssl_keylog_file.c_str(), "a");
+ if (!bio) {
+ LOG(ERROR) << "Failed to open " << ssl_keylog_file;
+ ERR_print_errors_cb(&LogErrorCallback, NULL);
+ } else {
+ SSL_CTX_set_keylog_bio(ssl_ctx_.get(), bio);
+ }
+ }
+
SSLContext() : session_cache_(SSLClientSessionCacheOpenSSL::Config()) {
crypto::EnsureOpenSSLInit();
ssl_socket_data_index_ = SSL_get_ex_new_index(0, 0, 0, 0, 0);
@@ -250,14 +262,7 @@ class SSLClientSocketOpenSSL::SSLContext {
std::string ssl_keylog_file;
if (env->GetVar("SSLKEYLOGFILE", &ssl_keylog_file) &&
!ssl_keylog_file.empty()) {
- crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE);
- BIO* bio = BIO_new_file(ssl_keylog_file.c_str(), "a");
- if (!bio) {
- LOG(ERROR) << "Failed to open " << ssl_keylog_file;
- ERR_print_errors_cb(&LogErrorCallback, NULL);
- } else {
- SSL_CTX_set_keylog_bio(ssl_ctx_.get(), bio);
- }
+ SetKeyLogFile(ssl_keylog_file);
}
}
« chrome/common/chrome_switches.cc ('K') | « chrome/common/chrome_switches.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698