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

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

Issue 2400033005: Use BoringSSL scopers in //net. (Closed)
Patch Set: eroman comments Created 4 years, 2 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_platform_key_chromecast.cc ('k') | net/ssl/ssl_platform_key_nss.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 <Security/SecBase.h> 7 #include <Security/SecBase.h>
8 #include <Security/SecCertificate.h> 8 #include <Security/SecCertificate.h>
9 #include <Security/SecIdentity.h> 9 #include <Security/SecIdentity.h>
10 #include <Security/SecKey.h> 10 #include <Security/SecKey.h>
11 #include <Security/cssm.h> 11 #include <Security/cssm.h>
12 #include <openssl/ecdsa.h> 12 #include <openssl/ecdsa.h>
13 #include <openssl/obj.h> 13 #include <openssl/mem.h>
14 #include <openssl/nid.h>
14 #include <openssl/rsa.h> 15 #include <openssl/rsa.h>
15 16
16 #include <memory> 17 #include <memory>
17 18
18 #include "base/location.h" 19 #include "base/location.h"
19 #include "base/logging.h" 20 #include "base/logging.h"
20 #include "base/mac/mac_logging.h" 21 #include "base/mac/mac_logging.h"
21 #include "base/mac/scoped_cftyperef.h" 22 #include "base/mac/scoped_cftyperef.h"
22 #include "base/macros.h" 23 #include "base/macros.h"
23 #include "base/memory/ptr_util.h" 24 #include "base/memory/ptr_util.h"
24 #include "base/memory/scoped_policy.h" 25 #include "base/memory/scoped_policy.h"
25 #include "base/sequenced_task_runner.h" 26 #include "base/sequenced_task_runner.h"
26 #include "base/synchronization/lock.h" 27 #include "base/synchronization/lock.h"
27 #include "crypto/mac_security_services_lock.h" 28 #include "crypto/mac_security_services_lock.h"
28 #include "crypto/openssl_util.h" 29 #include "crypto/openssl_util.h"
29 #include "crypto/scoped_openssl_types.h"
30 #include "net/base/net_errors.h" 30 #include "net/base/net_errors.h"
31 #include "net/cert/x509_certificate.h" 31 #include "net/cert/x509_certificate.h"
32 #include "net/ssl/ssl_platform_key_task_runner.h" 32 #include "net/ssl/ssl_platform_key_task_runner.h"
33 #include "net/ssl/ssl_private_key.h" 33 #include "net/ssl/ssl_private_key.h"
34 #include "net/ssl/threaded_ssl_private_key.h" 34 #include "net/ssl/threaded_ssl_private_key.h"
35 35
36 namespace net { 36 namespace net {
37 37
38 // CSSM functions are deprecated as of OSX 10.7, but have no replacement. 38 // CSSM functions are deprecated as of OSX 10.7, but have no replacement.
39 // https://bugs.chromium.org/p/chromium/issues/detail?id=590914#c1 39 // https://bugs.chromium.org/p/chromium/issues/detail?id=590914#c1
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 &cssm_signature_raw) != CSSM_OK) { 154 &cssm_signature_raw) != CSSM_OK) {
155 return ERR_SSL_CLIENT_AUTH_SIGNATURE_FAILED; 155 return ERR_SSL_CLIENT_AUTH_SIGNATURE_FAILED;
156 } 156 }
157 ScopedCSSM_CC_HANDLE cssm_signature(cssm_signature_raw); 157 ScopedCSSM_CC_HANDLE cssm_signature(cssm_signature_raw);
158 158
159 CSSM_DATA hash_data; 159 CSSM_DATA hash_data;
160 hash_data.Length = input.size(); 160 hash_data.Length = input.size();
161 hash_data.Data = 161 hash_data.Data =
162 const_cast<uint8_t*>(reinterpret_cast<const uint8_t*>(input.data())); 162 const_cast<uint8_t*>(reinterpret_cast<const uint8_t*>(input.data()));
163 163
164 crypto::ScopedOpenSSLBytes free_digest_info; 164 bssl::UniquePtr<uint8_t> free_digest_info;
165 if (cssm_key_->KeyHeader.AlgorithmId == CSSM_ALGID_RSA) { 165 if (cssm_key_->KeyHeader.AlgorithmId == CSSM_ALGID_RSA) {
166 // CSSM expects the caller to prepend the DigestInfo. 166 // CSSM expects the caller to prepend the DigestInfo.
167 int hash_nid = NID_undef; 167 int hash_nid = NID_undef;
168 switch (hash) { 168 switch (hash) {
169 case SSLPrivateKey::Hash::MD5_SHA1: 169 case SSLPrivateKey::Hash::MD5_SHA1:
170 hash_nid = NID_md5_sha1; 170 hash_nid = NID_md5_sha1;
171 break; 171 break;
172 case SSLPrivateKey::Hash::SHA1: 172 case SSLPrivateKey::Hash::SHA1:
173 hash_nid = NID_sha1; 173 hash_nid = NID_sha1;
174 break; 174 break;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 return nullptr; 243 return nullptr;
244 } 244 }
245 return make_scoped_refptr(new ThreadedSSLPrivateKey( 245 return make_scoped_refptr(new ThreadedSSLPrivateKey(
246 base::MakeUnique<SSLPlatformKeyMac>(private_key.get(), cssm_key), 246 base::MakeUnique<SSLPlatformKeyMac>(private_key.get(), cssm_key),
247 GetSSLPlatformKeyTaskRunner())); 247 GetSSLPlatformKeyTaskRunner()));
248 } 248 }
249 249
250 #pragma clang diagnostic pop // "-Wdeprecated-declarations" 250 #pragma clang diagnostic pop // "-Wdeprecated-declarations"
251 251
252 } // namespace net 252 } // namespace net
OLDNEW
« no previous file with comments | « net/ssl/ssl_platform_key_chromecast.cc ('k') | net/ssl/ssl_platform_key_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698