| 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 KeyIndex::const_iterator it = key_index_.find(cache_key); | 243 KeyIndex::const_iterator it = key_index_.find(cache_key); |
| 244 if (it == key_index_.end()) | 244 if (it == key_index_.end()) |
| 245 return false; | 245 return false; |
| 246 | 246 |
| 247 SSL_SESSION* session = *it->second; | 247 SSL_SESSION* session = *it->second; |
| 248 DCHECK(session); | 248 DCHECK(session); |
| 249 | 249 |
| 250 void* session_is_good = | 250 void* session_is_good = |
| 251 SSL_SESSION_get_ex_data(session, GetSSLSessionExIndex()); | 251 SSL_SESSION_get_ex_data(session, GetSSLSessionExIndex()); |
| 252 | 252 |
| 253 return session_is_good; | 253 return session_is_good != NULL; |
| 254 } | 254 } |
| 255 | 255 |
| 256 void MarkSSLSessionAsGood(SSL* ssl) { | 256 void MarkSSLSessionAsGood(SSL* ssl) { |
| 257 SSL_SESSION* session = SSL_get_session(ssl); | 257 SSL_SESSION* session = SSL_get_session(ssl); |
| 258 CHECK(session); | 258 CHECK(session); |
| 259 | 259 |
| 260 // Mark the session as good, allowing it to be used for future connections. | 260 // Mark the session as good, allowing it to be used for future connections. |
| 261 SSL_SESSION_set_ex_data( | 261 SSL_SESSION_set_ex_data( |
| 262 session, GetSSLSessionExIndex(), reinterpret_cast<void*>(1)); | 262 session, GetSSLSessionExIndex(), reinterpret_cast<void*>(1)); |
| 263 } | 263 } |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 return impl_->SSLSessionIsInCache(cache_key); | 521 return impl_->SSLSessionIsInCache(cache_key); |
| 522 } | 522 } |
| 523 | 523 |
| 524 void SSLSessionCacheOpenSSL::MarkSSLSessionAsGood(SSL* ssl) { | 524 void SSLSessionCacheOpenSSL::MarkSSLSessionAsGood(SSL* ssl) { |
| 525 return impl_->MarkSSLSessionAsGood(ssl); | 525 return impl_->MarkSSLSessionAsGood(ssl); |
| 526 } | 526 } |
| 527 | 527 |
| 528 void SSLSessionCacheOpenSSL::Flush() { impl_->Flush(); } | 528 void SSLSessionCacheOpenSSL::Flush() { impl_->Flush(); } |
| 529 | 529 |
| 530 } // namespace net | 530 } // namespace net |
| OLD | NEW |