OLD | NEW |
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 <openssl/digest.h> | 7 #include <openssl/digest.h> |
8 #include <openssl/evp.h> | 8 #include <openssl/evp.h> |
| 9 |
9 #include <utility> | 10 #include <utility> |
10 | 11 |
11 #include "base/logging.h" | 12 #include "base/logging.h" |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/ptr_util.h" |
13 #include "crypto/scoped_openssl_types.h" | 15 #include "crypto/scoped_openssl_types.h" |
14 #include "net/base/net_errors.h" | 16 #include "net/base/net_errors.h" |
15 #include "net/ssl/openssl_client_key_store.h" | 17 #include "net/ssl/openssl_client_key_store.h" |
16 #include "net/ssl/ssl_platform_key_task_runner.h" | 18 #include "net/ssl/ssl_platform_key_task_runner.h" |
17 #include "net/ssl/ssl_private_key.h" | 19 #include "net/ssl/ssl_private_key.h" |
18 #include "net/ssl/threaded_ssl_private_key.h" | 20 #include "net/ssl/threaded_ssl_private_key.h" |
19 | 21 |
20 namespace net { | 22 namespace net { |
21 | 23 |
22 namespace { | 24 namespace { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 type = SSLPrivateKey::Type::RSA; | 115 type = SSLPrivateKey::Type::RSA; |
114 break; | 116 break; |
115 case EVP_PKEY_EC: | 117 case EVP_PKEY_EC: |
116 type = SSLPrivateKey::Type::ECDSA; | 118 type = SSLPrivateKey::Type::ECDSA; |
117 break; | 119 break; |
118 default: | 120 default: |
119 LOG(ERROR) << "Unknown key type: " << EVP_PKEY_id(key.get()); | 121 LOG(ERROR) << "Unknown key type: " << EVP_PKEY_id(key.get()); |
120 return nullptr; | 122 return nullptr; |
121 } | 123 } |
122 return make_scoped_refptr(new ThreadedSSLPrivateKey( | 124 return make_scoped_refptr(new ThreadedSSLPrivateKey( |
123 make_scoped_ptr(new SSLPlatformKeyAndroid(std::move(key), type)), | 125 base::WrapUnique(new SSLPlatformKeyAndroid(std::move(key), type)), |
124 GetSSLPlatformKeyTaskRunner())); | 126 GetSSLPlatformKeyTaskRunner())); |
125 } | 127 } |
126 | 128 |
127 } // namespace | 129 } // namespace |
128 | 130 |
129 scoped_refptr<SSLPrivateKey> FetchClientCertPrivateKey( | 131 scoped_refptr<SSLPrivateKey> FetchClientCertPrivateKey( |
130 X509Certificate* certificate) { | 132 X509Certificate* certificate) { |
131 crypto::ScopedEVP_PKEY key = | 133 crypto::ScopedEVP_PKEY key = |
132 OpenSSLClientKeyStore::GetInstance()->FetchClientCertPrivateKey( | 134 OpenSSLClientKeyStore::GetInstance()->FetchClientCertPrivateKey( |
133 certificate); | 135 certificate); |
134 return WrapOpenSSLPrivateKey(std::move(key)); | 136 return WrapOpenSSLPrivateKey(std::move(key)); |
135 } | 137 } |
136 | 138 |
137 } // namespace net | 139 } // namespace net |
OLD | NEW |