Commit 5a24328a authored by vadimt's avatar vadimt Committed by Commit bot

Instrumenting SSL_do_handshake and UpdateServerCert to find jank.

Last instrumentations showed that:
SSL_do_handshake call is 17 jph (I mean janks per startup-hour)
This excludes all callbacks that SSL_do_handshake can invoke.

SSLClientSocketOpenSSL::UpdateServerCert is 5.8 jph.

Adding instrumentations to differentiate the cert from no-cert cases.
Also instrumenting SSLClientSocketOpenSSL::UpdateServerCert.

BUG=424386

Review URL: https://codereview.chromium.org/787913003

Cr-Commit-Position: refs/heads/master@{#309590}
parent fe11d94a
......@@ -931,14 +931,26 @@ bool SSLClientSocketOpenSSL::DoTransportIO() {
}
int SSLClientSocketOpenSSL::DoHandshake() {
// TODO(vadimt): Remove ScopedTracker below once crbug.com/424386 is fixed.
tracked_objects::ScopedTracker tracking_profile1(
FROM_HERE_WITH_EXPLICIT_FUNCTION(
"424386 SSLClientSocketOpenSSL::DoHandshake1"));
crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE);
int net_error = OK;
int rv = SSL_do_handshake(ssl_);
int rv;
// TODO(vadimt): Leave only 1 call to SSL_do_handshake once crbug.com/424386
// is fixed.
if (ssl_config_.send_client_cert && ssl_config_.client_cert.get()) {
// TODO(vadimt): Remove ScopedTracker below once crbug.com/424386 is fixed.
tracked_objects::ScopedTracker tracking_profile1(
FROM_HERE_WITH_EXPLICIT_FUNCTION("424386 DoHandshake_WithCert"));
rv = SSL_do_handshake(ssl_);
} else {
// TODO(vadimt): Remove ScopedTracker below once crbug.com/424386 is fixed.
tracked_objects::ScopedTracker tracking_profile1(
FROM_HERE_WITH_EXPLICIT_FUNCTION("424386 DoHandshake_WithoutCert"));
rv = SSL_do_handshake(ssl_);
}
if (client_auth_cert_needed_) {
// TODO(vadimt): Remove ScopedTracker below once crbug.com/424386 is fixed.
......@@ -1229,6 +1241,11 @@ void SSLClientSocketOpenSSL::UpdateServerCert() {
"424386 SSLClientSocketOpenSSL::UpdateServerCert"));
server_cert_chain_->Reset(SSL_get_peer_cert_chain(ssl_));
// TODO(vadimt): Remove ScopedTracker below once crbug.com/424386 is fixed.
tracked_objects::ScopedTracker tracking_profile1(
FROM_HERE_WITH_EXPLICIT_FUNCTION(
"424386 SSLClientSocketOpenSSL::UpdateServerCert1"));
server_cert_ = server_cert_chain_->AsOSChain();
if (server_cert_.get()) {
......@@ -1241,6 +1258,12 @@ void SSLClientSocketOpenSSL::UpdateServerCert() {
// update IsOCSPStaplingSupported for Mac. https://crbug.com/430714
if (IsOCSPStaplingSupported()) {
#if defined(OS_WIN)
// TODO(vadimt): Remove ScopedTracker below once crbug.com/424386 is
// fixed.
tracked_objects::ScopedTracker tracking_profile2(
FROM_HERE_WITH_EXPLICIT_FUNCTION(
"424386 SSLClientSocketOpenSSL::UpdateServerCert2"));
const uint8_t* ocsp_response_raw;
size_t ocsp_response_len;
SSL_get0_ocsp_response(ssl_, &ocsp_response_raw, &ocsp_response_len);
......
......@@ -28,6 +28,7 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/profiler/scoped_tracker.h"
#include "base/win/windows_version.h"
#include "crypto/scoped_capi_types.h"
#include "crypto/wincrypt_shim.h"
......@@ -196,6 +197,10 @@ int RsaMethodSign(int hash_nid,
uint8_t* out,
unsigned* out_len,
const RSA* rsa) {
// TODO(vadimt): Remove ScopedTracker below once crbug.com/424386 is fixed.
tracked_objects::ScopedTracker tracking_profile(
FROM_HERE_WITH_EXPLICIT_FUNCTION("424386 RsaMethodSign"));
// TODO(davidben): Switch BoringSSL's sign hook to using size_t rather than
// unsigned.
const KeyExData* ex_data = RsaGetExData(rsa);
......@@ -431,6 +436,10 @@ int EcdsaMethodSign(const uint8_t* digest,
uint8_t* out_sig,
unsigned int* out_sig_len,
EC_KEY* ec_key) {
// TODO(vadimt): Remove ScopedTracker below once crbug.com/424386 is fixed.
tracked_objects::ScopedTracker tracking_profile(
FROM_HERE_WITH_EXPLICIT_FUNCTION("424386 EcdsaMethodSign"));
const KeyExData* ex_data = EcKeyGetExData(ec_key);
// Only CNG supports ECDSA.
if (!ex_data || ex_data->key->dwKeySpec != CERT_NCRYPT_KEY_SPEC) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment