| 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 <windows.h> | 7 #include <windows.h> |
| 8 #include <NCrypt.h> | 8 #include <NCrypt.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <utility> | 12 #include <utility> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "crypto/openssl_util.h" | 17 #include "crypto/openssl_util.h" |
| 18 #include "crypto/scoped_capi_types.h" | 18 #include "crypto/scoped_capi_types.h" |
| 19 #include "crypto/wincrypt_shim.h" | 19 #include "crypto/wincrypt_shim.h" |
| 20 #include "net/base/net_errors.h" | 20 #include "net/base/net_errors.h" |
| 21 #include "net/cert/x509_certificate.h" | 21 #include "net/cert/x509_certificate.h" |
| 22 #include "net/ssl/ssl_platform_key_util.h" | 22 #include "net/ssl/ssl_platform_key_util.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 #include "third_party/boringssl/src/include/openssl/bn.h" | 25 #include "third_party/boringssl/src/include/openssl/bn.h" |
| 26 #include "third_party/boringssl/src/include/openssl/ecdsa.h" | 26 #include "third_party/boringssl/src/include/openssl/ecdsa.h" |
| 27 #include "third_party/boringssl/src/include/openssl/evp.h" | 27 #include "third_party/boringssl/src/include/openssl/evp.h" |
| 28 #include "third_party/boringssl/src/include/openssl/x509.h" | |
| 29 | 28 |
| 30 namespace net { | 29 namespace net { |
| 31 | 30 |
| 32 namespace { | 31 namespace { |
| 33 | 32 |
| 34 class SSLPlatformKeyCAPI : public ThreadedSSLPrivateKey::Delegate { | 33 class SSLPlatformKeyCAPI : public ThreadedSSLPrivateKey::Delegate { |
| 35 public: | 34 public: |
| 36 // Takes ownership of |provider|. | 35 // Takes ownership of |provider|. |
| 37 SSLPlatformKeyCAPI(HCRYPTPROV provider, DWORD key_spec, size_t max_length) | 36 SSLPlatformKeyCAPI(HCRYPTPROV provider, DWORD key_spec, size_t max_length) |
| 38 : provider_(provider), key_spec_(key_spec), max_length_(max_length) {} | 37 : provider_(provider), key_spec_(key_spec), max_length_(max_length) {} |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 delegate.reset(new SSLPlatformKeyCNG(prov_or_key, key_type, max_length)); | 278 delegate.reset(new SSLPlatformKeyCNG(prov_or_key, key_type, max_length)); |
| 280 } else { | 279 } else { |
| 281 DCHECK(SSLPrivateKey::Type::RSA == key_type); | 280 DCHECK(SSLPrivateKey::Type::RSA == key_type); |
| 282 delegate.reset(new SSLPlatformKeyCAPI(prov_or_key, key_spec, max_length)); | 281 delegate.reset(new SSLPlatformKeyCAPI(prov_or_key, key_spec, max_length)); |
| 283 } | 282 } |
| 284 return make_scoped_refptr(new ThreadedSSLPrivateKey( | 283 return make_scoped_refptr(new ThreadedSSLPrivateKey( |
| 285 std::move(delegate), GetSSLPlatformKeyTaskRunner())); | 284 std::move(delegate), GetSSLPlatformKeyTaskRunner())); |
| 286 } | 285 } |
| 287 | 286 |
| 288 } // namespace net | 287 } // namespace net |
| OLD | NEW |