OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "net/socket/ssl_session_cache_openssl.h" | 5 #include "net/socket/ssl_session_cache_openssl.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include <openssl/rand.h> | 10 #include <openssl/rand.h> |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
229 return false; // Session has not yet been marked good. Treat as a miss. | 229 return false; // Session has not yet been marked good. Treat as a miss. |
230 | 230 |
231 // Move to front of MRU list. | 231 // Move to front of MRU list. |
232 ordering_.push_front(session); | 232 ordering_.push_front(session); |
233 ordering_.erase(it->second); | 233 ordering_.erase(it->second); |
234 it->second = ordering_.begin(); | 234 it->second = ordering_.begin(); |
235 | 235 |
236 return SSL_set_session(ssl, session) == 1; | 236 return SSL_set_session(ssl, session) == 1; |
237 } | 237 } |
238 | 238 |
239 bool SessionIsInCache(const std::string& cache_key) { | |
wtc
2014/06/13 22:47:24
Mark this method const.
mshelley1
2014/06/16 19:02:50
Done.
| |
240 base::AutoLock locked(lock_); | |
241 KeyIndex::iterator it = key_index_.find(cache_key); | |
242 if (it == key_index_.end()) | |
243 return false; | |
244 return true; | |
245 } | |
246 | |
239 void MarkSSLSessionAsGood(SSL* ssl) { | 247 void MarkSSLSessionAsGood(SSL* ssl) { |
240 SSL_SESSION* session = SSL_get_session(ssl); | 248 SSL_SESSION* session = SSL_get_session(ssl); |
241 if (!session) | 249 if (!session) |
242 return; | 250 return; |
243 | 251 |
244 // Mark the session as good, allowing it to be used for future connections. | 252 // Mark the session as good, allowing it to be used for future connections. |
245 SSL_SESSION_set_ex_data( | 253 SSL_SESSION_set_ex_data( |
246 session, GetSSLSessionExIndex(), reinterpret_cast<void*>(1)); | 254 session, GetSSLSessionExIndex(), reinterpret_cast<void*>(1)); |
247 } | 255 } |
248 | 256 |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
492 bool SSLSessionCacheOpenSSL::SetSSLSession(SSL* ssl) { | 500 bool SSLSessionCacheOpenSSL::SetSSLSession(SSL* ssl) { |
493 return impl_->SetSSLSession(ssl); | 501 return impl_->SetSSLSession(ssl); |
494 } | 502 } |
495 | 503 |
496 bool SSLSessionCacheOpenSSL::SetSSLSessionWithKey( | 504 bool SSLSessionCacheOpenSSL::SetSSLSessionWithKey( |
497 SSL* ssl, | 505 SSL* ssl, |
498 const std::string& cache_key) { | 506 const std::string& cache_key) { |
499 return impl_->SetSSLSessionWithKey(ssl, cache_key); | 507 return impl_->SetSSLSessionWithKey(ssl, cache_key); |
500 } | 508 } |
501 | 509 |
510 bool SSLSessionCacheOpenSSL::SessionIsInCache(const std::string& cache_key) { | |
511 return impl_->SessionIsInCache(cache_key); | |
512 } | |
513 | |
502 void SSLSessionCacheOpenSSL::MarkSSLSessionAsGood(SSL* ssl) { | 514 void SSLSessionCacheOpenSSL::MarkSSLSessionAsGood(SSL* ssl) { |
503 return impl_->MarkSSLSessionAsGood(ssl); | 515 return impl_->MarkSSLSessionAsGood(ssl); |
504 } | 516 } |
505 | 517 |
506 void SSLSessionCacheOpenSSL::Flush() { impl_->Flush(); } | 518 void SSLSessionCacheOpenSSL::Flush() { impl_->Flush(); } |
507 | 519 |
508 } // namespace net | 520 } // namespace net |
OLD | NEW |