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

Side by Side Diff: net/ssl/ssl_platform_key_chromecast.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_android.cc ('k') | net/ssl/ssl_platform_key_mac.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <keyhi.h> 5 #include <keyhi.h>
6 #include <openssl/mem.h>
7 #include <openssl/nid.h>
6 #include <openssl/rsa.h> 8 #include <openssl/rsa.h>
7 #include <pk11pub.h> 9 #include <pk11pub.h>
8 #include <prerror.h> 10 #include <prerror.h>
9 11
10 #include "base/logging.h" 12 #include "base/logging.h"
11 #include "base/macros.h" 13 #include "base/macros.h"
12 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
13 #include "base/sequenced_task_runner.h" 15 #include "base/sequenced_task_runner.h"
14 #include "crypto/scoped_nss_types.h" 16 #include "crypto/scoped_nss_types.h"
15 #include "crypto/scoped_openssl_types.h"
16 #include "net/cert/x509_certificate.h" 17 #include "net/cert/x509_certificate.h"
17 #include "net/ssl/client_key_store.h" 18 #include "net/ssl/client_key_store.h"
18 #include "net/ssl/ssl_platform_key.h" 19 #include "net/ssl/ssl_platform_key.h"
19 #include "net/ssl/ssl_platform_key_task_runner.h" 20 #include "net/ssl/ssl_platform_key_task_runner.h"
20 #include "net/ssl/ssl_private_key.h" 21 #include "net/ssl/ssl_private_key.h"
21 #include "net/ssl/threaded_ssl_private_key.h" 22 #include "net/ssl/threaded_ssl_private_key.h"
22 23
23 namespace net { 24 namespace net {
24 25
25 namespace { 26 namespace {
(...skipping 30 matching lines...) Expand all
56 } 57 }
57 58
58 Error SignDigest(SSLPrivateKey::Hash hash, 59 Error SignDigest(SSLPrivateKey::Hash hash,
59 const base::StringPiece& input, 60 const base::StringPiece& input,
60 std::vector<uint8_t>* signature) override { 61 std::vector<uint8_t>* signature) override {
61 SECItem digest_item; 62 SECItem digest_item;
62 digest_item.data = 63 digest_item.data =
63 const_cast<uint8_t*>(reinterpret_cast<const uint8_t*>(input.data())); 64 const_cast<uint8_t*>(reinterpret_cast<const uint8_t*>(input.data()));
64 digest_item.len = input.size(); 65 digest_item.len = input.size();
65 66
66 crypto::ScopedOpenSSLBytes free_digest_info; 67 bssl::UniquePtr<uint8_t> free_digest_info;
67 // PK11_Sign expects the caller to prepend the DigestInfo. 68 // PK11_Sign expects the caller to prepend the DigestInfo.
68 int hash_nid = NID_undef; 69 int hash_nid = NID_undef;
69 switch (hash) { 70 switch (hash) {
70 case SSLPrivateKey::Hash::MD5_SHA1: 71 case SSLPrivateKey::Hash::MD5_SHA1:
71 hash_nid = NID_md5_sha1; 72 hash_nid = NID_md5_sha1;
72 break; 73 break;
73 case SSLPrivateKey::Hash::SHA1: 74 case SSLPrivateKey::Hash::SHA1:
74 hash_nid = NID_sha1; 75 hash_nid = NID_sha1;
75 break; 76 break;
76 case SSLPrivateKey::Hash::SHA256: 77 case SSLPrivateKey::Hash::SHA256:
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 return ClientKeyStore::GetInstance()->FetchClientCertPrivateKey( 127 return ClientKeyStore::GetInstance()->FetchClientCertPrivateKey(
127 *certificate); 128 *certificate);
128 } 129 }
129 130
130 return make_scoped_refptr(new ThreadedSSLPrivateKey( 131 return make_scoped_refptr(new ThreadedSSLPrivateKey(
131 base::MakeUnique<SSLPlatformKeyChromecast>(std::move(key)), 132 base::MakeUnique<SSLPlatformKeyChromecast>(std::move(key)),
132 GetSSLPlatformKeyTaskRunner())); 133 GetSSLPlatformKeyTaskRunner()));
133 } 134 }
134 135
135 } // namespace net 136 } // namespace net
OLDNEW
« no previous file with comments | « net/ssl/ssl_platform_key_android.cc ('k') | net/ssl/ssl_platform_key_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698