| 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 <Security/SecBase.h> |
| 8 #include <Security/SecCertificate.h> |
| 9 #include <Security/SecIdentity.h> |
| 10 #include <Security/SecKey.h> |
| 11 #include <Security/cssm.h> |
| 7 #include <openssl/ecdsa.h> | 12 #include <openssl/ecdsa.h> |
| 8 #include <openssl/obj.h> | 13 #include <openssl/obj.h> |
| 9 #include <openssl/rsa.h> | 14 #include <openssl/rsa.h> |
| 10 | 15 |
| 11 #include <Security/cssm.h> | 16 #include <memory> |
| 12 #include <Security/SecBase.h> | |
| 13 #include <Security/SecCertificate.h> | |
| 14 #include <Security/SecIdentity.h> | |
| 15 #include <Security/SecKey.h> | |
| 16 | 17 |
| 17 #include "base/location.h" | 18 #include "base/location.h" |
| 18 #include "base/logging.h" | 19 #include "base/logging.h" |
| 19 #include "base/mac/mac_logging.h" | 20 #include "base/mac/mac_logging.h" |
| 20 #include "base/mac/scoped_cftyperef.h" | 21 #include "base/mac/scoped_cftyperef.h" |
| 21 #include "base/macros.h" | 22 #include "base/macros.h" |
| 23 #include "base/memory/ptr_util.h" |
| 22 #include "base/memory/scoped_policy.h" | 24 #include "base/memory/scoped_policy.h" |
| 23 #include "base/memory/scoped_ptr.h" | |
| 24 #include "base/sequenced_task_runner.h" | 25 #include "base/sequenced_task_runner.h" |
| 25 #include "base/synchronization/lock.h" | 26 #include "base/synchronization/lock.h" |
| 26 #include "crypto/mac_security_services_lock.h" | 27 #include "crypto/mac_security_services_lock.h" |
| 27 #include "crypto/openssl_util.h" | 28 #include "crypto/openssl_util.h" |
| 28 #include "crypto/scoped_openssl_types.h" | 29 #include "crypto/scoped_openssl_types.h" |
| 29 #include "net/base/net_errors.h" | 30 #include "net/base/net_errors.h" |
| 30 #include "net/cert/x509_certificate.h" | 31 #include "net/cert/x509_certificate.h" |
| 31 #include "net/ssl/ssl_platform_key_task_runner.h" | 32 #include "net/ssl/ssl_platform_key_task_runner.h" |
| 32 #include "net/ssl/ssl_private_key.h" | 33 #include "net/ssl/ssl_private_key.h" |
| 33 #include "net/ssl/threaded_ssl_private_key.h" | 34 #include "net/ssl/threaded_ssl_private_key.h" |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 OSStatus status = SecKeyGetCSSMKey(private_key.get(), &cssm_key); | 236 OSStatus status = SecKeyGetCSSMKey(private_key.get(), &cssm_key); |
| 236 if (status != noErr) | 237 if (status != noErr) |
| 237 return nullptr; | 238 return nullptr; |
| 238 | 239 |
| 239 if (cssm_key->KeyHeader.AlgorithmId != CSSM_ALGID_RSA && | 240 if (cssm_key->KeyHeader.AlgorithmId != CSSM_ALGID_RSA && |
| 240 cssm_key->KeyHeader.AlgorithmId != CSSM_ALGID_ECDSA) { | 241 cssm_key->KeyHeader.AlgorithmId != CSSM_ALGID_ECDSA) { |
| 241 LOG(ERROR) << "Unknown key type: " << cssm_key->KeyHeader.AlgorithmId; | 242 LOG(ERROR) << "Unknown key type: " << cssm_key->KeyHeader.AlgorithmId; |
| 242 return nullptr; | 243 return nullptr; |
| 243 } | 244 } |
| 244 return make_scoped_refptr(new ThreadedSSLPrivateKey( | 245 return make_scoped_refptr(new ThreadedSSLPrivateKey( |
| 245 make_scoped_ptr(new SSLPlatformKeyMac(private_key.get(), cssm_key)), | 246 base::WrapUnique(new SSLPlatformKeyMac(private_key.get(), cssm_key)), |
| 246 GetSSLPlatformKeyTaskRunner())); | 247 GetSSLPlatformKeyTaskRunner())); |
| 247 } | 248 } |
| 248 | 249 |
| 249 #pragma clang diagnostic pop // "-Wdeprecated-declarations" | 250 #pragma clang diagnostic pop // "-Wdeprecated-declarations" |
| 250 | 251 |
| 251 } // namespace net | 252 } // namespace net |
| OLD | NEW |