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

Side by Side Diff: net/socket/ssl_client_socket_openssl.cc

Issue 947603002: Shard the SSL session cache by version fallback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: be more clever Created 5 years, 10 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 unified diff | Download patch
OLDNEW
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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 } 396 }
397 397
398 SSLClientSocketOpenSSL::~SSLClientSocketOpenSSL() { 398 SSLClientSocketOpenSSL::~SSLClientSocketOpenSSL() {
399 Disconnect(); 399 Disconnect();
400 } 400 }
401 401
402 std::string SSLClientSocketOpenSSL::GetSessionCacheKey() const { 402 std::string SSLClientSocketOpenSSL::GetSessionCacheKey() const {
403 std::string result = host_and_port_.ToString(); 403 std::string result = host_and_port_.ToString();
404 result.append("/"); 404 result.append("/");
405 result.append(ssl_session_cache_shard_); 405 result.append(ssl_session_cache_shard_);
406
407 // Shard the session cache based on maximum protocol version. This causes
408 // fallback connections to use a separate session cache.
409 result.append("/");
410 switch (ssl_config_.version_max) {
411 case SSL_PROTOCOL_VERSION_SSL3:
412 result.append("ssl3");
413 break;
414 case SSL_PROTOCOL_VERSION_TLS1:
415 result.append("tls1");
416 break;
417 case SSL_PROTOCOL_VERSION_TLS1_1:
418 result.append("tls1.1");
419 break;
420 case SSL_PROTOCOL_VERSION_TLS1_2:
421 result.append("tls1.2");
422 break;
423 default:
424 NOTREACHED();
425 }
426
406 return result; 427 return result;
407 } 428 }
408 429
409 bool SSLClientSocketOpenSSL::InSessionCache() const { 430 bool SSLClientSocketOpenSSL::InSessionCache() const {
410 SSLContext* context = SSLContext::GetInstance(); 431 SSLContext* context = SSLContext::GetInstance();
411 std::string cache_key = GetSessionCacheKey(); 432 std::string cache_key = GetSessionCacheKey();
412 return context->session_cache()->SSLSessionIsInCache(cache_key); 433 return context->session_cache()->SSLSessionIsInCache(cache_key);
413 } 434 }
414 435
415 void SSLClientSocketOpenSSL::SetHandshakeCompletionCallback( 436 void SSLClientSocketOpenSSL::SetHandshakeCompletionCallback(
(...skipping 1608 matching lines...) Expand 10 before | Expand all | Expand 10 after
2024 ct::SCT_STATUS_LOG_UNKNOWN)); 2045 ct::SCT_STATUS_LOG_UNKNOWN));
2025 } 2046 }
2026 } 2047 }
2027 2048
2028 scoped_refptr<X509Certificate> 2049 scoped_refptr<X509Certificate>
2029 SSLClientSocketOpenSSL::GetUnverifiedServerCertificateChain() const { 2050 SSLClientSocketOpenSSL::GetUnverifiedServerCertificateChain() const {
2030 return server_cert_; 2051 return server_cert_;
2031 } 2052 }
2032 2053
2033 } // namespace net 2054 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698