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

Unified Diff: net/ssl/ssl_client_session_cache.cc

Issue 2626113002: Query the certificate size with CRYPTO_BUFFER in SSLClientSessionCache. (Closed)
Patch Set: const Created 3 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/ssl/ssl_client_session_cache.cc
diff --git a/net/ssl/ssl_client_session_cache.cc b/net/ssl/ssl_client_session_cache.cc
index 19b9d556a13c9c0c2f9d15f00a835f44254ba2e1..ff945cc47ec95a58a6f03fbc0e0e790d34575334 100644
--- a/net/ssl/ssl_client_session_cache.cc
+++ b/net/ssl/ssl_client_session_cache.cc
@@ -98,16 +98,15 @@ void SSLClientSessionCache::DumpMemoryStats(
return;
cache_dump = pmd->CreateAllocatorDump(absolute_name);
base::AutoLock lock(lock_);
- int total_serialized_cert_size = 0;
- int total_cert_count = 0;
+ size_t total_serialized_cert_size = 0;
+ size_t total_cert_count = 0;
for (const auto& pair : cache_) {
- auto entry = pair.second.get();
- auto cert_chain = entry->x509_chain;
- size_t cert_count = sk_X509_num(cert_chain);
+ const SSL_SESSION* session = pair.second.get();
+ size_t cert_count = sk_CRYPTO_BUFFER_num(session->certs);
total_cert_count += cert_count;
for (size_t i = 0; i < cert_count; ++i) {
- X509* cert = sk_X509_value(cert_chain, i);
- total_serialized_cert_size += i2d_X509(cert, nullptr);
+ const CRYPTO_BUFFER* cert = sk_CRYPTO_BUFFER_value(session->certs, i);
+ total_serialized_cert_size += CRYPTO_BUFFER_len(cert);
}
}
// This measures the lower bound of the serialized certificate. It doesn't
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698