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

Side by Side Diff: components/ownership/owner_settings_service.cc

Issue 1552023002: Convert Pass()→std::move() in //components (CrOS edition) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/ownership/owner_settings_service.h" 5 #include "components/ownership/owner_settings_service.h"
6 6
7 #include <cryptohi.h> 7 #include <cryptohi.h>
8 #include <keyhi.h> 8 #include <keyhi.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 19 matching lines...) Expand all
30 crypto::NSSDestroyer1<SGNContext, SGN_DestroyContext, PR_TRUE>>; 30 crypto::NSSDestroyer1<SGNContext, SGN_DestroyContext, PR_TRUE>>;
31 31
32 scoped_ptr<em::PolicyFetchResponse> AssembleAndSignPolicy( 32 scoped_ptr<em::PolicyFetchResponse> AssembleAndSignPolicy(
33 scoped_ptr<em::PolicyData> policy, 33 scoped_ptr<em::PolicyData> policy,
34 SECKEYPrivateKey* private_key) { 34 SECKEYPrivateKey* private_key) {
35 // Assemble the policy. 35 // Assemble the policy.
36 scoped_ptr<em::PolicyFetchResponse> policy_response( 36 scoped_ptr<em::PolicyFetchResponse> policy_response(
37 new em::PolicyFetchResponse()); 37 new em::PolicyFetchResponse());
38 if (!policy->SerializeToString(policy_response->mutable_policy_data())) { 38 if (!policy->SerializeToString(policy_response->mutable_policy_data())) {
39 LOG(ERROR) << "Failed to encode policy payload."; 39 LOG(ERROR) << "Failed to encode policy payload.";
40 return scoped_ptr<em::PolicyFetchResponse>(nullptr).Pass(); 40 return scoped_ptr<em::PolicyFetchResponse>(nullptr);
41 } 41 }
42 42
43 ScopedSGNContext sign_context( 43 ScopedSGNContext sign_context(
44 SGN_NewContext(SEC_OID_PKCS1_SHA1_WITH_RSA_ENCRYPTION, private_key)); 44 SGN_NewContext(SEC_OID_PKCS1_SHA1_WITH_RSA_ENCRYPTION, private_key));
45 if (!sign_context) { 45 if (!sign_context) {
46 NOTREACHED(); 46 NOTREACHED();
47 return nullptr; 47 return nullptr;
48 } 48 }
49 49
50 SECItem signature_item; 50 SECItem signature_item;
51 if (SGN_Begin(sign_context.get()) != SECSuccess || 51 if (SGN_Begin(sign_context.get()) != SECSuccess ||
52 SGN_Update(sign_context.get(), 52 SGN_Update(sign_context.get(),
53 reinterpret_cast<const uint8_t*>( 53 reinterpret_cast<const uint8_t*>(
54 policy_response->policy_data().c_str()), 54 policy_response->policy_data().c_str()),
55 policy_response->policy_data().size()) != SECSuccess || 55 policy_response->policy_data().size()) != SECSuccess ||
56 SGN_End(sign_context.get(), &signature_item) != SECSuccess) { 56 SGN_End(sign_context.get(), &signature_item) != SECSuccess) {
57 LOG(ERROR) << "Failed to create policy signature."; 57 LOG(ERROR) << "Failed to create policy signature.";
58 return nullptr; 58 return nullptr;
59 } 59 }
60 60
61 policy_response->mutable_policy_data_signature()->assign( 61 policy_response->mutable_policy_data_signature()->assign(
62 reinterpret_cast<const char*>(signature_item.data), signature_item.len); 62 reinterpret_cast<const char*>(signature_item.data), signature_item.len);
63 SECITEM_FreeItem(&signature_item, PR_FALSE); 63 SECITEM_FreeItem(&signature_item, PR_FALSE);
64 64
65 return policy_response.Pass(); 65 return policy_response;
66 } 66 }
67 67
68 } // namepace 68 } // namepace
69 69
70 OwnerSettingsService::OwnerSettingsService( 70 OwnerSettingsService::OwnerSettingsService(
71 const scoped_refptr<ownership::OwnerKeyUtil>& owner_key_util) 71 const scoped_refptr<ownership::OwnerKeyUtil>& owner_key_util)
72 : owner_key_util_(owner_key_util), weak_factory_(this) { 72 : owner_key_util_(owner_key_util), weak_factory_(this) {
73 } 73 }
74 74
75 OwnerSettingsService::~OwnerSettingsService() { 75 OwnerSettingsService::~OwnerSettingsService() {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 for (std::vector<IsOwnerCallback>::iterator it(is_owner_callbacks.begin()); 159 for (std::vector<IsOwnerCallback>::iterator it(is_owner_callbacks.begin());
160 it != is_owner_callbacks.end(); 160 it != is_owner_callbacks.end();
161 ++it) { 161 ++it) {
162 it->Run(is_owner); 162 it->Run(is_owner);
163 } 163 }
164 164
165 OnPostKeypairLoadedActions(); 165 OnPostKeypairLoadedActions();
166 } 166 }
167 167
168 } // namespace ownership 168 } // namespace ownership
OLDNEW
« no previous file with comments | « components/ownership/owner_key_util_impl.cc ('k') | components/pairing/bluetooth_controller_pairing_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698