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

Side by Side Diff: net/ssl/ssl_platform_key_nss.cc

Issue 1545233002: Convert Pass()→std::move() in //net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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/ssl/ssl_client_session_cache_openssl.cc ('k') | net/ssl/threaded_ssl_private_key.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/ssl/ssl_platform_key.h" 5 #include "net/ssl/ssl_platform_key.h"
6 6
7 #include <keyhi.h> 7 #include <keyhi.h>
8 #include <pk11pub.h>
9 #include <prerror.h>
10
11 #include <openssl/bn.h> 8 #include <openssl/bn.h>
12 #include <openssl/ecdsa.h> 9 #include <openssl/ecdsa.h>
13 #include <openssl/rsa.h> 10 #include <openssl/rsa.h>
11 #include <pk11pub.h>
12 #include <prerror.h>
13 #include <utility>
14 14
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/sequenced_task_runner.h" 17 #include "base/sequenced_task_runner.h"
18 #include "crypto/scoped_nss_types.h" 18 #include "crypto/scoped_nss_types.h"
19 #include "crypto/scoped_openssl_types.h" 19 #include "crypto/scoped_openssl_types.h"
20 #include "net/cert/x509_certificate.h" 20 #include "net/cert/x509_certificate.h"
21 #include "net/ssl/client_key_store.h" 21 #include "net/ssl/client_key_store.h"
22 #include "net/ssl/ssl_platform_key_task_runner.h" 22 #include "net/ssl/ssl_platform_key_task_runner.h"
23 #include "net/ssl/ssl_private_key.h" 23 #include "net/ssl/ssl_private_key.h"
24 #include "net/ssl/threaded_ssl_private_key.h" 24 #include "net/ssl/threaded_ssl_private_key.h"
25 25
26 namespace net { 26 namespace net {
27 27
28 namespace { 28 namespace {
29 29
30 void LogPRError() { 30 void LogPRError() {
31 PRErrorCode err = PR_GetError(); 31 PRErrorCode err = PR_GetError();
32 const char* err_name = PR_ErrorToName(err); 32 const char* err_name = PR_ErrorToName(err);
33 if (err_name == nullptr) 33 if (err_name == nullptr)
34 err_name = ""; 34 err_name = "";
35 LOG(ERROR) << "Could not sign digest: " << err << " (" << err_name << ")"; 35 LOG(ERROR) << "Could not sign digest: " << err << " (" << err_name << ")";
36 } 36 }
37 37
38 class SSLPlatformKeyNSS : public ThreadedSSLPrivateKey::Delegate { 38 class SSLPlatformKeyNSS : public ThreadedSSLPrivateKey::Delegate {
39 public: 39 public:
40 SSLPlatformKeyNSS(SSLPrivateKey::Type type, 40 SSLPlatformKeyNSS(SSLPrivateKey::Type type,
41 crypto::ScopedSECKEYPrivateKey key) 41 crypto::ScopedSECKEYPrivateKey key)
42 : type_(type), key_(key.Pass()) {} 42 : type_(type), key_(std::move(key)) {}
43 ~SSLPlatformKeyNSS() override {} 43 ~SSLPlatformKeyNSS() override {}
44 44
45 SSLPrivateKey::Type GetType() override { return type_; } 45 SSLPrivateKey::Type GetType() override { return type_; }
46 46
47 std::vector<SSLPrivateKey::Hash> GetDigestPreferences() override { 47 std::vector<SSLPrivateKey::Hash> GetDigestPreferences() override {
48 static const SSLPrivateKey::Hash kHashes[] = { 48 static const SSLPrivateKey::Hash kHashes[] = {
49 SSLPrivateKey::Hash::SHA512, SSLPrivateKey::Hash::SHA384, 49 SSLPrivateKey::Hash::SHA512, SSLPrivateKey::Hash::SHA384,
50 SSLPrivateKey::Hash::SHA256, SSLPrivateKey::Hash::SHA1}; 50 SSLPrivateKey::Hash::SHA256, SSLPrivateKey::Hash::SHA1};
51 return std::vector<SSLPrivateKey::Hash>(kHashes, 51 return std::vector<SSLPrivateKey::Hash>(kHashes,
52 kHashes + arraysize(kHashes)); 52 kHashes + arraysize(kHashes));
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 type = SSLPrivateKey::Type::RSA; 175 type = SSLPrivateKey::Type::RSA;
176 break; 176 break;
177 case ecKey: 177 case ecKey:
178 type = SSLPrivateKey::Type::ECDSA; 178 type = SSLPrivateKey::Type::ECDSA;
179 break; 179 break;
180 default: 180 default:
181 LOG(ERROR) << "Unknown key type: " << nss_type; 181 LOG(ERROR) << "Unknown key type: " << nss_type;
182 return nullptr; 182 return nullptr;
183 } 183 }
184 return make_scoped_refptr(new ThreadedSSLPrivateKey( 184 return make_scoped_refptr(new ThreadedSSLPrivateKey(
185 make_scoped_ptr(new SSLPlatformKeyNSS(type, key.Pass())), 185 make_scoped_ptr(new SSLPlatformKeyNSS(type, std::move(key))),
186 GetSSLPlatformKeyTaskRunner())); 186 GetSSLPlatformKeyTaskRunner()));
187 } 187 }
188 188
189 } // namespace net 189 } // namespace net
OLDNEW
« no previous file with comments | « net/ssl/ssl_client_session_cache_openssl.cc ('k') | net/ssl/threaded_ssl_private_key.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698