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

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

Issue 401153002: Switch to BoringSSL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase across DEPS change Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « net/socket/ssl_server_socket_openssl.cc ('k') | net/tools/flip_server/acceptor_thread.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <openssl/ssl.h> 7 #include <openssl/ssl.h>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } 68 }
69 69
70 void SetValue(SSL* ssl, const std::string& value) { 70 void SetValue(SSL* ssl, const std::string& value) {
71 int ret = SSL_set_ex_data(ssl, ex_index_, new std::string(value)); 71 int ret = SSL_set_ex_data(ssl, ex_index_, new std::string(value));
72 CHECK_EQ(1, ret); 72 CHECK_EQ(1, ret);
73 } 73 }
74 74
75 // Called when an SSL object is copied through SSL_dup(). This needs to copy 75 // Called when an SSL object is copied through SSL_dup(). This needs to copy
76 // the value as well. 76 // the value as well.
77 static int KeyDup(CRYPTO_EX_DATA* to, 77 static int KeyDup(CRYPTO_EX_DATA* to,
78 CRYPTO_EX_DATA* from, 78 const CRYPTO_EX_DATA* from,
79 void* from_fd, 79 void** from_fd,
80 int idx, 80 int idx,
81 long argl, 81 long argl,
82 void* argp) { 82 void* argp) {
83 // |from_fd| is really the address of a temporary pointer. On input, it 83 // |from_fd| is really the address of a temporary pointer. On input, it
84 // points to the value from the original SSL object. The function must 84 // points to the value from the original SSL object. The function must
85 // update it to the address of a copy. 85 // update it to the address of a copy.
86 std::string** ptr = reinterpret_cast<std::string**>(from_fd); 86 std::string** ptr = reinterpret_cast<std::string**>(from_fd);
87 std::string* old_string = *ptr; 87 std::string* old_string = *ptr;
88 std::string* new_string = new std::string(*old_string); 88 std::string* new_string = new std::string(*old_string);
89 *ptr = new_string; 89 *ptr = new_string;
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 371
372 // Call SetSSLSession another time, this shall expire all sessions except 372 // Call SetSSLSession another time, this shall expire all sessions except
373 // the last one. 373 // the last one.
374 ScopedSSL bad_ssl(NewSSL("unknown-key")); 374 ScopedSSL bad_ssl(NewSSL("unknown-key"));
375 cache_.SetSSLSession(bad_ssl.get()); 375 cache_.SetSSLSession(bad_ssl.get());
376 bad_ssl.reset(NULL); 376 bad_ssl.reset(NULL);
377 EXPECT_EQ(1U, cache_.size()); 377 EXPECT_EQ(1U, cache_.size());
378 } 378 }
379 379
380 } // namespace net 380 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/ssl_server_socket_openssl.cc ('k') | net/tools/flip_server/acceptor_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698