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

Side by Side Diff: net/quic/test_tools/crypto_test_utils_nss.cc

Issue 1076063002: Remove certificates from Channel ID (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Udpate KeysEqual to fail if preconditions fail Created 5 years, 7 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
« no previous file with comments | « net/quic/crypto/channel_id_chromium.cc ('k') | net/socket/ssl_client_socket.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/quic/test_tools/crypto_test_utils.h" 5 #include "net/quic/test_tools/crypto_test_utils.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "crypto/ec_private_key.h" 9 #include "crypto/ec_private_key.h"
10 #include "crypto/ec_signature_creator.h" 10 #include "crypto/ec_signature_creator.h"
(...skipping 17 matching lines...) Expand all
28 const string& hostname, 28 const string& hostname,
29 scoped_ptr<ChannelIDKey>* channel_id_key, 29 scoped_ptr<ChannelIDKey>* channel_id_key,
30 ChannelIDSourceCallback* /*callback*/) override { 30 ChannelIDSourceCallback* /*callback*/) override {
31 channel_id_key->reset(new ChannelIDKeyChromium(HostnameToKey(hostname))); 31 channel_id_key->reset(new ChannelIDKeyChromium(HostnameToKey(hostname)));
32 return QUIC_SUCCESS; 32 return QUIC_SUCCESS;
33 } 33 }
34 34
35 private: 35 private:
36 typedef std::map<string, crypto::ECPrivateKey*> HostnameToKeyMap; 36 typedef std::map<string, crypto::ECPrivateKey*> HostnameToKeyMap;
37 37
38 crypto::ECPrivateKey* HostnameToKey(const string& hostname) { 38 scoped_ptr<crypto::ECPrivateKey> HostnameToKey(const string& hostname) {
39 HostnameToKeyMap::const_iterator it = hostname_to_key_.find(hostname); 39 HostnameToKeyMap::const_iterator it = hostname_to_key_.find(hostname);
40 if (it != hostname_to_key_.end()) { 40 if (it != hostname_to_key_.end()) {
41 return it->second->Copy(); 41 return make_scoped_ptr(it->second->Copy());
42 } 42 }
43 43
44 crypto::ECPrivateKey* keypair = crypto::ECPrivateKey::Create(); 44 crypto::ECPrivateKey* keypair = crypto::ECPrivateKey::Create();
45 if (!keypair) { 45 if (!keypair) {
46 return nullptr; 46 return nullptr;
47 } 47 }
48 hostname_to_key_[hostname] = keypair; 48 hostname_to_key_[hostname] = keypair;
49 return keypair->Copy(); 49 return make_scoped_ptr(keypair->Copy());
50 } 50 }
51 51
52 HostnameToKeyMap hostname_to_key_; 52 HostnameToKeyMap hostname_to_key_;
53 }; 53 };
54 54
55 // static 55 // static
56 ChannelIDSource* CryptoTestUtils::ChannelIDSourceForTesting() { 56 ChannelIDSource* CryptoTestUtils::ChannelIDSourceForTesting() {
57 return new TestChannelIDSource(); 57 return new TestChannelIDSource();
58 } 58 }
59 59
60 } // namespace test 60 } // namespace test
61 61
62 } // namespace net 62 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/crypto/channel_id_chromium.cc ('k') | net/socket/ssl_client_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698