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

Side by Side Diff: chromeos/dbus/cryptohome_client.cc

Issue 499303002: Increase DBus timeout in cryptohome calls to 2 minutes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2125
Patch Set: Created 6 years, 4 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chromeos/dbus/cryptohome_client.h" 5 #include "chromeos/dbus/cryptohome_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "chromeos/cryptohome/async_method_caller.h" 11 #include "chromeos/cryptohome/async_method_caller.h"
12 #include "chromeos/dbus/blocking_method_caller.h" 12 #include "chromeos/dbus/blocking_method_caller.h"
13 #include "chromeos/dbus/cryptohome/key.pb.h" 13 #include "chromeos/dbus/cryptohome/key.pb.h"
14 #include "chromeos/dbus/cryptohome/rpc.pb.h" 14 #include "chromeos/dbus/cryptohome/rpc.pb.h"
15 #include "dbus/bus.h" 15 #include "dbus/bus.h"
16 #include "dbus/message.h" 16 #include "dbus/message.h"
17 #include "dbus/object_path.h" 17 #include "dbus/object_path.h"
18 #include "dbus/object_proxy.h" 18 #include "dbus/object_proxy.h"
19 #include "third_party/cros_system_api/dbus/service_constants.h" 19 #include "third_party/cros_system_api/dbus/service_constants.h"
20 20
21 namespace chromeos { 21 namespace chromeos {
22 22
23 namespace { 23 namespace {
24 24
25 // This suffix is appended to user_id to get hash in stub implementation: 25 // This suffix is appended to user_id to get hash in stub implementation:
26 // stub_hash = "[user_id]-hash"; 26 // stub_hash = "[user_id]-hash";
27 static const char kUserIdStubHashSuffix[] = "-hash"; 27 static const char kUserIdStubHashSuffix[] = "-hash";
28 28
29 // Timeout for TPM operations. On slow machines it should be larger, than
30 // default DBus timeout. TPM operations can take up to 80 seconds, so limit
31 // is 2 minutes.
32 const int kTpmDBusTimeoutMs = 2 * 60 * 1000;
33
29 // The CryptohomeClient implementation. 34 // The CryptohomeClient implementation.
30 class CryptohomeClientImpl : public CryptohomeClient { 35 class CryptohomeClientImpl : public CryptohomeClient {
31 public: 36 public:
32 CryptohomeClientImpl() : proxy_(NULL), weak_ptr_factory_(this) {} 37 CryptohomeClientImpl() : proxy_(NULL), weak_ptr_factory_(this) {}
33 38
34 // CryptohomeClient override. 39 // CryptohomeClient override.
35 virtual void SetAsyncCallStatusHandlers( 40 virtual void SetAsyncCallStatusHandlers(
36 const AsyncCallStatusHandler& handler, 41 const AsyncCallStatusHandler& handler,
37 const AsyncCallStatusWithDataHandler& data_handler) OVERRIDE { 42 const AsyncCallStatusWithDataHandler& data_handler) OVERRIDE {
38 async_call_status_handler_ = handler; 43 async_call_status_handler_ = handler;
(...skipping 28 matching lines...) Expand all
67 72
68 // CryptohomeClient override. 73 // CryptohomeClient override.
69 virtual void AsyncCheckKey(const std::string& username, 74 virtual void AsyncCheckKey(const std::string& username,
70 const std::string& key, 75 const std::string& key,
71 const AsyncMethodCallback& callback) OVERRIDE { 76 const AsyncMethodCallback& callback) OVERRIDE {
72 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface, 77 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface,
73 cryptohome::kCryptohomeAsyncCheckKey); 78 cryptohome::kCryptohomeAsyncCheckKey);
74 dbus::MessageWriter writer(&method_call); 79 dbus::MessageWriter writer(&method_call);
75 writer.AppendString(username); 80 writer.AppendString(username);
76 writer.AppendString(key); 81 writer.AppendString(key);
77 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 82 proxy_->CallMethod(&method_call, kTpmDBusTimeoutMs ,
78 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall, 83 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall,
79 weak_ptr_factory_.GetWeakPtr(), 84 weak_ptr_factory_.GetWeakPtr(),
80 callback)); 85 callback));
81 } 86 }
82 87
83 // CryptohomeClient override. 88 // CryptohomeClient override.
84 virtual void AsyncMigrateKey(const std::string& username, 89 virtual void AsyncMigrateKey(const std::string& username,
85 const std::string& from_key, 90 const std::string& from_key,
86 const std::string& to_key, 91 const std::string& to_key,
87 const AsyncMethodCallback& callback) OVERRIDE { 92 const AsyncMethodCallback& callback) OVERRIDE {
88 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface, 93 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface,
89 cryptohome::kCryptohomeAsyncMigrateKey); 94 cryptohome::kCryptohomeAsyncMigrateKey);
90 dbus::MessageWriter writer(&method_call); 95 dbus::MessageWriter writer(&method_call);
91 writer.AppendString(username); 96 writer.AppendString(username);
92 writer.AppendString(from_key); 97 writer.AppendString(from_key);
93 writer.AppendString(to_key); 98 writer.AppendString(to_key);
94 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 99 proxy_->CallMethod(&method_call, kTpmDBusTimeoutMs ,
95 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall, 100 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall,
96 weak_ptr_factory_.GetWeakPtr(), 101 weak_ptr_factory_.GetWeakPtr(),
97 callback)); 102 callback));
98 } 103 }
99 104
100 // CryptohomeClient override. 105 // CryptohomeClient override.
101 virtual void AsyncRemove(const std::string& username, 106 virtual void AsyncRemove(const std::string& username,
102 const AsyncMethodCallback& callback) OVERRIDE { 107 const AsyncMethodCallback& callback) OVERRIDE {
103 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface, 108 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface,
104 cryptohome::kCryptohomeAsyncRemove); 109 cryptohome::kCryptohomeAsyncRemove);
105 dbus::MessageWriter writer(&method_call); 110 dbus::MessageWriter writer(&method_call);
106 writer.AppendString(username); 111 writer.AppendString(username);
107 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 112 proxy_->CallMethod(&method_call, kTpmDBusTimeoutMs ,
108 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall, 113 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall,
109 weak_ptr_factory_.GetWeakPtr(), 114 weak_ptr_factory_.GetWeakPtr(),
110 callback)); 115 callback));
111 } 116 }
112 117
113 // CryptohomeClient override. 118 // CryptohomeClient override.
114 virtual void GetSystemSalt(const GetSystemSaltCallback& callback) OVERRIDE { 119 virtual void GetSystemSalt(const GetSystemSaltCallback& callback) OVERRIDE {
115 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface, 120 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface,
116 cryptohome::kCryptohomeGetSystemSalt); 121 cryptohome::kCryptohomeGetSystemSalt);
117 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 122 proxy_->CallMethod(&method_call, kTpmDBusTimeoutMs ,
118 base::Bind(&CryptohomeClientImpl::OnGetSystemSalt, 123 base::Bind(&CryptohomeClientImpl::OnGetSystemSalt,
119 weak_ptr_factory_.GetWeakPtr(), 124 weak_ptr_factory_.GetWeakPtr(),
120 callback)); 125 callback));
121 } 126 }
122 127
123 // CryptohomeClient override, 128 // CryptohomeClient override,
124 virtual void GetSanitizedUsername( 129 virtual void GetSanitizedUsername(
125 const std::string& username, 130 const std::string& username,
126 const StringDBusMethodCallback& callback) OVERRIDE { 131 const StringDBusMethodCallback& callback) OVERRIDE {
127 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface, 132 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface,
128 cryptohome::kCryptohomeGetSanitizedUsername); 133 cryptohome::kCryptohomeGetSanitizedUsername);
129 dbus::MessageWriter writer(&method_call); 134 dbus::MessageWriter writer(&method_call);
130 writer.AppendString(username); 135 writer.AppendString(username);
131 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 136 proxy_->CallMethod(&method_call, kTpmDBusTimeoutMs ,
132 base::Bind(&CryptohomeClientImpl::OnStringMethod, 137 base::Bind(&CryptohomeClientImpl::OnStringMethod,
133 weak_ptr_factory_.GetWeakPtr(), 138 weak_ptr_factory_.GetWeakPtr(),
134 callback)); 139 callback));
135 } 140 }
136 141
137 // CryptohomeClient override. 142 // CryptohomeClient override.
138 virtual std::string BlockingGetSanitizedUsername( 143 virtual std::string BlockingGetSanitizedUsername(
139 const std::string& username) OVERRIDE { 144 const std::string& username) OVERRIDE {
140 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface, 145 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface,
141 cryptohome::kCryptohomeGetSanitizedUsername); 146 cryptohome::kCryptohomeGetSanitizedUsername);
(...skipping 19 matching lines...) Expand all
161 const AsyncMethodCallback& callback) OVERRIDE { 166 const AsyncMethodCallback& callback) OVERRIDE {
162 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface, 167 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface,
163 cryptohome::kCryptohomeAsyncMount); 168 cryptohome::kCryptohomeAsyncMount);
164 dbus::MessageWriter writer(&method_call); 169 dbus::MessageWriter writer(&method_call);
165 writer.AppendString(username); 170 writer.AppendString(username);
166 writer.AppendString(key); 171 writer.AppendString(key);
167 writer.AppendBool(flags & cryptohome::CREATE_IF_MISSING); 172 writer.AppendBool(flags & cryptohome::CREATE_IF_MISSING);
168 writer.AppendBool(flags & cryptohome::ENSURE_EPHEMERAL); 173 writer.AppendBool(flags & cryptohome::ENSURE_EPHEMERAL);
169 // deprecated_tracked_subdirectories 174 // deprecated_tracked_subdirectories
170 writer.AppendArrayOfStrings(std::vector<std::string>()); 175 writer.AppendArrayOfStrings(std::vector<std::string>());
171 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 176 proxy_->CallMethod(&method_call, kTpmDBusTimeoutMs ,
172 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall, 177 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall,
173 weak_ptr_factory_.GetWeakPtr(), 178 weak_ptr_factory_.GetWeakPtr(),
174 callback)); 179 callback));
175 } 180 }
176 181
177 // CryptohomeClient override. 182 // CryptohomeClient override.
178 virtual void AsyncAddKey(const std::string& username, 183 virtual void AsyncAddKey(const std::string& username,
179 const std::string& key, 184 const std::string& key,
180 const std::string& new_key, 185 const std::string& new_key,
181 const AsyncMethodCallback& callback) OVERRIDE { 186 const AsyncMethodCallback& callback) OVERRIDE {
182 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface, 187 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface,
183 cryptohome::kCryptohomeAsyncAddKey); 188 cryptohome::kCryptohomeAsyncAddKey);
184 dbus::MessageWriter writer(&method_call); 189 dbus::MessageWriter writer(&method_call);
185 writer.AppendString(username); 190 writer.AppendString(username);
186 writer.AppendString(key); 191 writer.AppendString(key);
187 writer.AppendString(new_key); 192 writer.AppendString(new_key);
188 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 193 proxy_->CallMethod(&method_call, kTpmDBusTimeoutMs ,
189 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall, 194 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall,
190 weak_ptr_factory_.GetWeakPtr(), 195 weak_ptr_factory_.GetWeakPtr(),
191 callback)); 196 callback));
192 } 197 }
193 198
194 // CryptohomeClient override. 199 // CryptohomeClient override.
195 virtual void AsyncMountGuest(const AsyncMethodCallback& callback) OVERRIDE { 200 virtual void AsyncMountGuest(const AsyncMethodCallback& callback) OVERRIDE {
196 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface, 201 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface,
197 cryptohome::kCryptohomeAsyncMountGuest); 202 cryptohome::kCryptohomeAsyncMountGuest);
198 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 203 proxy_->CallMethod(&method_call, kTpmDBusTimeoutMs ,
199 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall, 204 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall,
200 weak_ptr_factory_.GetWeakPtr(), 205 weak_ptr_factory_.GetWeakPtr(),
201 callback)); 206 callback));
202 } 207 }
203 208
204 // CryptohomeClient override. 209 // CryptohomeClient override.
205 virtual void AsyncMountPublic(const std::string& public_mount_id, 210 virtual void AsyncMountPublic(const std::string& public_mount_id,
206 int flags, 211 int flags,
207 const AsyncMethodCallback& callback) OVERRIDE { 212 const AsyncMethodCallback& callback) OVERRIDE {
208 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface, 213 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface,
209 cryptohome::kCryptohomeAsyncMountPublic); 214 cryptohome::kCryptohomeAsyncMountPublic);
210 dbus::MessageWriter writer(&method_call); 215 dbus::MessageWriter writer(&method_call);
211 writer.AppendString(public_mount_id); 216 writer.AppendString(public_mount_id);
212 writer.AppendBool(flags & cryptohome::CREATE_IF_MISSING); 217 writer.AppendBool(flags & cryptohome::CREATE_IF_MISSING);
213 writer.AppendBool(flags & cryptohome::ENSURE_EPHEMERAL); 218 writer.AppendBool(flags & cryptohome::ENSURE_EPHEMERAL);
214 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 219 proxy_->CallMethod(&method_call, kTpmDBusTimeoutMs ,
215 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall, 220 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall,
216 weak_ptr_factory_.GetWeakPtr(), 221 weak_ptr_factory_.GetWeakPtr(),
217 callback)); 222 callback));
218 } 223 }
219 224
220 // CryptohomeClient override. 225 // CryptohomeClient override.
221 virtual void TpmIsReady(const BoolDBusMethodCallback& callback) OVERRIDE { 226 virtual void TpmIsReady(const BoolDBusMethodCallback& callback) OVERRIDE {
222 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface, 227 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface,
223 cryptohome::kCryptohomeTpmIsReady); 228 cryptohome::kCryptohomeTpmIsReady);
224 CallBoolMethod(&method_call, callback); 229 CallBoolMethod(&method_call, callback);
(...skipping 13 matching lines...) Expand all
238 cryptohome::kCryptohomeTpmIsEnabled); 243 cryptohome::kCryptohomeTpmIsEnabled);
239 return CallBoolMethodAndBlock(&method_call, enabled); 244 return CallBoolMethodAndBlock(&method_call, enabled);
240 } 245 }
241 246
242 // CryptohomeClient override. 247 // CryptohomeClient override.
243 virtual void TpmGetPassword( 248 virtual void TpmGetPassword(
244 const StringDBusMethodCallback& callback) OVERRIDE { 249 const StringDBusMethodCallback& callback) OVERRIDE {
245 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface, 250 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface,
246 cryptohome::kCryptohomeTpmGetPassword); 251 cryptohome::kCryptohomeTpmGetPassword);
247 proxy_->CallMethod( 252 proxy_->CallMethod(
248 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 253 &method_call, kTpmDBusTimeoutMs ,
249 base::Bind(&CryptohomeClientImpl::OnStringMethod, 254 base::Bind(&CryptohomeClientImpl::OnStringMethod,
250 weak_ptr_factory_.GetWeakPtr(), 255 weak_ptr_factory_.GetWeakPtr(),
251 callback)); 256 callback));
252 } 257 }
253 258
254 // CryptohomeClient override. 259 // CryptohomeClient override.
255 virtual void TpmIsOwned(const BoolDBusMethodCallback& callback) OVERRIDE { 260 virtual void TpmIsOwned(const BoolDBusMethodCallback& callback) OVERRIDE {
256 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface, 261 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface,
257 cryptohome::kCryptohomeTpmIsOwned); 262 cryptohome::kCryptohomeTpmIsOwned);
258 CallBoolMethod(&method_call, callback); 263 CallBoolMethod(&method_call, callback);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 cryptohome::kCryptohomePkcs11IsTpmTokenReady); 320 cryptohome::kCryptohomePkcs11IsTpmTokenReady);
316 CallBoolMethod(&method_call, callback); 321 CallBoolMethod(&method_call, callback);
317 } 322 }
318 323
319 // CryptohomeClient override. 324 // CryptohomeClient override.
320 virtual void Pkcs11GetTpmTokenInfo( 325 virtual void Pkcs11GetTpmTokenInfo(
321 const Pkcs11GetTpmTokenInfoCallback& callback) OVERRIDE { 326 const Pkcs11GetTpmTokenInfoCallback& callback) OVERRIDE {
322 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface, 327 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface,
323 cryptohome::kCryptohomePkcs11GetTpmTokenInfo); 328 cryptohome::kCryptohomePkcs11GetTpmTokenInfo);
324 proxy_->CallMethod( 329 proxy_->CallMethod(
325 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 330 &method_call, kTpmDBusTimeoutMs ,
326 base::Bind( 331 base::Bind(
327 &CryptohomeClientImpl::OnPkcs11GetTpmTokenInfo, 332 &CryptohomeClientImpl::OnPkcs11GetTpmTokenInfo,
328 weak_ptr_factory_.GetWeakPtr(), 333 weak_ptr_factory_.GetWeakPtr(),
329 callback)); 334 callback));
330 } 335 }
331 336
332 // CryptohomeClient override. 337 // CryptohomeClient override.
333 virtual void Pkcs11GetTpmTokenInfoForUser( 338 virtual void Pkcs11GetTpmTokenInfoForUser(
334 const std::string& user_email, 339 const std::string& user_email,
335 const Pkcs11GetTpmTokenInfoCallback& callback) OVERRIDE { 340 const Pkcs11GetTpmTokenInfoCallback& callback) OVERRIDE {
336 dbus::MethodCall method_call( 341 dbus::MethodCall method_call(
337 cryptohome::kCryptohomeInterface, 342 cryptohome::kCryptohomeInterface,
338 cryptohome::kCryptohomePkcs11GetTpmTokenInfoForUser); 343 cryptohome::kCryptohomePkcs11GetTpmTokenInfoForUser);
339 dbus::MessageWriter writer(&method_call); 344 dbus::MessageWriter writer(&method_call);
340 writer.AppendString(user_email); 345 writer.AppendString(user_email);
341 proxy_->CallMethod( 346 proxy_->CallMethod(
342 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 347 &method_call, kTpmDBusTimeoutMs ,
343 base::Bind( 348 base::Bind(
344 &CryptohomeClientImpl::OnPkcs11GetTpmTokenInfoForUser, 349 &CryptohomeClientImpl::OnPkcs11GetTpmTokenInfoForUser,
345 weak_ptr_factory_.GetWeakPtr(), 350 weak_ptr_factory_.GetWeakPtr(),
346 callback)); 351 callback));
347 } 352 }
348 353
349 // CryptohomeClient override. 354 // CryptohomeClient override.
350 virtual bool InstallAttributesGet(const std::string& name, 355 virtual bool InstallAttributesGet(const std::string& name,
351 std::vector<uint8>* value, 356 std::vector<uint8>* value,
352 bool* successful) OVERRIDE { 357 bool* successful) OVERRIDE {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 439
435 // CryptohomeClient override. 440 // CryptohomeClient override.
436 virtual void AsyncTpmAttestationCreateEnrollRequest( 441 virtual void AsyncTpmAttestationCreateEnrollRequest(
437 attestation::PrivacyCAType pca_type, 442 attestation::PrivacyCAType pca_type,
438 const AsyncMethodCallback& callback) OVERRIDE { 443 const AsyncMethodCallback& callback) OVERRIDE {
439 dbus::MethodCall method_call( 444 dbus::MethodCall method_call(
440 cryptohome::kCryptohomeInterface, 445 cryptohome::kCryptohomeInterface,
441 cryptohome::kCryptohomeAsyncTpmAttestationCreateEnrollRequest); 446 cryptohome::kCryptohomeAsyncTpmAttestationCreateEnrollRequest);
442 dbus::MessageWriter writer(&method_call); 447 dbus::MessageWriter writer(&method_call);
443 writer.AppendInt32(pca_type); 448 writer.AppendInt32(pca_type);
444 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 449 proxy_->CallMethod(&method_call, kTpmDBusTimeoutMs ,
445 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall, 450 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall,
446 weak_ptr_factory_.GetWeakPtr(), 451 weak_ptr_factory_.GetWeakPtr(),
447 callback)); 452 callback));
448 } 453 }
449 454
450 // CryptohomeClient override. 455 // CryptohomeClient override.
451 virtual void AsyncTpmAttestationEnroll( 456 virtual void AsyncTpmAttestationEnroll(
452 attestation::PrivacyCAType pca_type, 457 attestation::PrivacyCAType pca_type,
453 const std::string& pca_response, 458 const std::string& pca_response,
454 const AsyncMethodCallback& callback) OVERRIDE { 459 const AsyncMethodCallback& callback) OVERRIDE {
455 dbus::MethodCall method_call( 460 dbus::MethodCall method_call(
456 cryptohome::kCryptohomeInterface, 461 cryptohome::kCryptohomeInterface,
457 cryptohome::kCryptohomeAsyncTpmAttestationEnroll); 462 cryptohome::kCryptohomeAsyncTpmAttestationEnroll);
458 dbus::MessageWriter writer(&method_call); 463 dbus::MessageWriter writer(&method_call);
459 writer.AppendInt32(pca_type); 464 writer.AppendInt32(pca_type);
460 writer.AppendArrayOfBytes( 465 writer.AppendArrayOfBytes(
461 reinterpret_cast<const uint8*>(pca_response.data()), 466 reinterpret_cast<const uint8*>(pca_response.data()),
462 pca_response.size()); 467 pca_response.size());
463 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 468 proxy_->CallMethod(&method_call, kTpmDBusTimeoutMs ,
464 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall, 469 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall,
465 weak_ptr_factory_.GetWeakPtr(), 470 weak_ptr_factory_.GetWeakPtr(),
466 callback)); 471 callback));
467 } 472 }
468 473
469 // CryptohomeClient override. 474 // CryptohomeClient override.
470 virtual void AsyncTpmAttestationCreateCertRequest( 475 virtual void AsyncTpmAttestationCreateCertRequest(
471 attestation::PrivacyCAType pca_type, 476 attestation::PrivacyCAType pca_type,
472 attestation::AttestationCertificateProfile certificate_profile, 477 attestation::AttestationCertificateProfile certificate_profile,
473 const std::string& user_id, 478 const std::string& user_id,
474 const std::string& request_origin, 479 const std::string& request_origin,
475 const AsyncMethodCallback& callback) OVERRIDE { 480 const AsyncMethodCallback& callback) OVERRIDE {
476 dbus::MethodCall method_call( 481 dbus::MethodCall method_call(
477 cryptohome::kCryptohomeInterface, 482 cryptohome::kCryptohomeInterface,
478 cryptohome::kCryptohomeAsyncTpmAttestationCreateCertRequest); 483 cryptohome::kCryptohomeAsyncTpmAttestationCreateCertRequest);
479 dbus::MessageWriter writer(&method_call); 484 dbus::MessageWriter writer(&method_call);
480 writer.AppendInt32(pca_type); 485 writer.AppendInt32(pca_type);
481 writer.AppendInt32(certificate_profile); 486 writer.AppendInt32(certificate_profile);
482 writer.AppendString(user_id); 487 writer.AppendString(user_id);
483 writer.AppendString(request_origin); 488 writer.AppendString(request_origin);
484 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 489 proxy_->CallMethod(&method_call, kTpmDBusTimeoutMs ,
485 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall, 490 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall,
486 weak_ptr_factory_.GetWeakPtr(), 491 weak_ptr_factory_.GetWeakPtr(),
487 callback)); 492 callback));
488 } 493 }
489 494
490 // CryptohomeClient override. 495 // CryptohomeClient override.
491 virtual void AsyncTpmAttestationFinishCertRequest( 496 virtual void AsyncTpmAttestationFinishCertRequest(
492 const std::string& pca_response, 497 const std::string& pca_response,
493 attestation::AttestationKeyType key_type, 498 attestation::AttestationKeyType key_type,
494 const std::string& user_id, 499 const std::string& user_id,
495 const std::string& key_name, 500 const std::string& key_name,
496 const AsyncMethodCallback& callback) OVERRIDE { 501 const AsyncMethodCallback& callback) OVERRIDE {
497 dbus::MethodCall method_call( 502 dbus::MethodCall method_call(
498 cryptohome::kCryptohomeInterface, 503 cryptohome::kCryptohomeInterface,
499 cryptohome::kCryptohomeAsyncTpmAttestationFinishCertRequest); 504 cryptohome::kCryptohomeAsyncTpmAttestationFinishCertRequest);
500 dbus::MessageWriter writer(&method_call); 505 dbus::MessageWriter writer(&method_call);
501 writer.AppendArrayOfBytes( 506 writer.AppendArrayOfBytes(
502 reinterpret_cast<const uint8*>(pca_response.data()), 507 reinterpret_cast<const uint8*>(pca_response.data()),
503 pca_response.size()); 508 pca_response.size());
504 bool is_user_specific = (key_type == attestation::KEY_USER); 509 bool is_user_specific = (key_type == attestation::KEY_USER);
505 writer.AppendBool(is_user_specific); 510 writer.AppendBool(is_user_specific);
506 writer.AppendString(user_id); 511 writer.AppendString(user_id);
507 writer.AppendString(key_name); 512 writer.AppendString(key_name);
508 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 513 proxy_->CallMethod(&method_call, kTpmDBusTimeoutMs ,
509 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall, 514 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall,
510 weak_ptr_factory_.GetWeakPtr(), 515 weak_ptr_factory_.GetWeakPtr(),
511 callback)); 516 callback));
512 } 517 }
513 518
514 // CryptohomeClient override. 519 // CryptohomeClient override.
515 virtual void TpmAttestationDoesKeyExist( 520 virtual void TpmAttestationDoesKeyExist(
516 attestation::AttestationKeyType key_type, 521 attestation::AttestationKeyType key_type,
517 const std::string& user_id, 522 const std::string& user_id,
518 const std::string& key_name, 523 const std::string& key_name,
(...skipping 16 matching lines...) Expand all
535 const std::string& key_name, 540 const std::string& key_name,
536 const DataMethodCallback& callback) OVERRIDE { 541 const DataMethodCallback& callback) OVERRIDE {
537 dbus::MethodCall method_call( 542 dbus::MethodCall method_call(
538 cryptohome::kCryptohomeInterface, 543 cryptohome::kCryptohomeInterface,
539 cryptohome::kCryptohomeTpmAttestationGetCertificate); 544 cryptohome::kCryptohomeTpmAttestationGetCertificate);
540 dbus::MessageWriter writer(&method_call); 545 dbus::MessageWriter writer(&method_call);
541 bool is_user_specific = (key_type == attestation::KEY_USER); 546 bool is_user_specific = (key_type == attestation::KEY_USER);
542 writer.AppendBool(is_user_specific); 547 writer.AppendBool(is_user_specific);
543 writer.AppendString(user_id); 548 writer.AppendString(user_id);
544 writer.AppendString(key_name); 549 writer.AppendString(key_name);
545 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 550 proxy_->CallMethod(&method_call, kTpmDBusTimeoutMs ,
546 base::Bind(&CryptohomeClientImpl::OnDataMethod, 551 base::Bind(&CryptohomeClientImpl::OnDataMethod,
547 weak_ptr_factory_.GetWeakPtr(), 552 weak_ptr_factory_.GetWeakPtr(),
548 callback)); 553 callback));
549 } 554 }
550 555
551 // CryptohomeClient override. 556 // CryptohomeClient override.
552 virtual void TpmAttestationGetPublicKey( 557 virtual void TpmAttestationGetPublicKey(
553 attestation::AttestationKeyType key_type, 558 attestation::AttestationKeyType key_type,
554 const std::string& user_id, 559 const std::string& user_id,
555 const std::string& key_name, 560 const std::string& key_name,
556 const DataMethodCallback& callback) OVERRIDE { 561 const DataMethodCallback& callback) OVERRIDE {
557 dbus::MethodCall method_call( 562 dbus::MethodCall method_call(
558 cryptohome::kCryptohomeInterface, 563 cryptohome::kCryptohomeInterface,
559 cryptohome::kCryptohomeTpmAttestationGetPublicKey); 564 cryptohome::kCryptohomeTpmAttestationGetPublicKey);
560 dbus::MessageWriter writer(&method_call); 565 dbus::MessageWriter writer(&method_call);
561 bool is_user_specific = (key_type == attestation::KEY_USER); 566 bool is_user_specific = (key_type == attestation::KEY_USER);
562 writer.AppendBool(is_user_specific); 567 writer.AppendBool(is_user_specific);
563 writer.AppendString(user_id); 568 writer.AppendString(user_id);
564 writer.AppendString(key_name); 569 writer.AppendString(key_name);
565 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 570 proxy_->CallMethod(&method_call, kTpmDBusTimeoutMs ,
566 base::Bind(&CryptohomeClientImpl::OnDataMethod, 571 base::Bind(&CryptohomeClientImpl::OnDataMethod,
567 weak_ptr_factory_.GetWeakPtr(), 572 weak_ptr_factory_.GetWeakPtr(),
568 callback)); 573 callback));
569 } 574 }
570 575
571 // CryptohomeClient override. 576 // CryptohomeClient override.
572 virtual void TpmAttestationRegisterKey( 577 virtual void TpmAttestationRegisterKey(
573 attestation::AttestationKeyType key_type, 578 attestation::AttestationKeyType key_type,
574 const std::string& user_id, 579 const std::string& user_id,
575 const std::string& key_name, 580 const std::string& key_name,
576 const AsyncMethodCallback& callback) OVERRIDE { 581 const AsyncMethodCallback& callback) OVERRIDE {
577 dbus::MethodCall method_call( 582 dbus::MethodCall method_call(
578 cryptohome::kCryptohomeInterface, 583 cryptohome::kCryptohomeInterface,
579 cryptohome::kCryptohomeTpmAttestationRegisterKey); 584 cryptohome::kCryptohomeTpmAttestationRegisterKey);
580 dbus::MessageWriter writer(&method_call); 585 dbus::MessageWriter writer(&method_call);
581 bool is_user_specific = (key_type == attestation::KEY_USER); 586 bool is_user_specific = (key_type == attestation::KEY_USER);
582 writer.AppendBool(is_user_specific); 587 writer.AppendBool(is_user_specific);
583 writer.AppendString(user_id); 588 writer.AppendString(user_id);
584 writer.AppendString(key_name); 589 writer.AppendString(key_name);
585 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 590 proxy_->CallMethod(&method_call, kTpmDBusTimeoutMs ,
586 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall, 591 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall,
587 weak_ptr_factory_.GetWeakPtr(), 592 weak_ptr_factory_.GetWeakPtr(),
588 callback)); 593 callback));
589 } 594 }
590 595
591 // CryptohomeClient override. 596 // CryptohomeClient override.
592 virtual void TpmAttestationSignEnterpriseChallenge( 597 virtual void TpmAttestationSignEnterpriseChallenge(
593 attestation::AttestationKeyType key_type, 598 attestation::AttestationKeyType key_type,
594 const std::string& user_id, 599 const std::string& user_id,
595 const std::string& key_name, 600 const std::string& key_name,
(...skipping 11 matching lines...) Expand all
607 writer.AppendString(user_id); 612 writer.AppendString(user_id);
608 writer.AppendString(key_name); 613 writer.AppendString(key_name);
609 writer.AppendString(domain); 614 writer.AppendString(domain);
610 writer.AppendArrayOfBytes(reinterpret_cast<const uint8*>(device_id.data()), 615 writer.AppendArrayOfBytes(reinterpret_cast<const uint8*>(device_id.data()),
611 device_id.size()); 616 device_id.size());
612 bool include_signed_public_key = 617 bool include_signed_public_key =
613 (options & attestation::CHALLENGE_INCLUDE_SIGNED_PUBLIC_KEY); 618 (options & attestation::CHALLENGE_INCLUDE_SIGNED_PUBLIC_KEY);
614 writer.AppendBool(include_signed_public_key); 619 writer.AppendBool(include_signed_public_key);
615 writer.AppendArrayOfBytes(reinterpret_cast<const uint8*>(challenge.data()), 620 writer.AppendArrayOfBytes(reinterpret_cast<const uint8*>(challenge.data()),
616 challenge.size()); 621 challenge.size());
617 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 622 proxy_->CallMethod(&method_call, kTpmDBusTimeoutMs ,
618 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall, 623 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall,
619 weak_ptr_factory_.GetWeakPtr(), 624 weak_ptr_factory_.GetWeakPtr(),
620 callback)); 625 callback));
621 } 626 }
622 627
623 // CryptohomeClient override. 628 // CryptohomeClient override.
624 virtual void TpmAttestationSignSimpleChallenge( 629 virtual void TpmAttestationSignSimpleChallenge(
625 attestation::AttestationKeyType key_type, 630 attestation::AttestationKeyType key_type,
626 const std::string& user_id, 631 const std::string& user_id,
627 const std::string& key_name, 632 const std::string& key_name,
628 const std::string& challenge, 633 const std::string& challenge,
629 const AsyncMethodCallback& callback) OVERRIDE { 634 const AsyncMethodCallback& callback) OVERRIDE {
630 dbus::MethodCall method_call( 635 dbus::MethodCall method_call(
631 cryptohome::kCryptohomeInterface, 636 cryptohome::kCryptohomeInterface,
632 cryptohome::kCryptohomeTpmAttestationSignSimpleChallenge); 637 cryptohome::kCryptohomeTpmAttestationSignSimpleChallenge);
633 dbus::MessageWriter writer(&method_call); 638 dbus::MessageWriter writer(&method_call);
634 bool is_user_specific = (key_type == attestation::KEY_USER); 639 bool is_user_specific = (key_type == attestation::KEY_USER);
635 writer.AppendBool(is_user_specific); 640 writer.AppendBool(is_user_specific);
636 writer.AppendString(user_id); 641 writer.AppendString(user_id);
637 writer.AppendString(key_name); 642 writer.AppendString(key_name);
638 writer.AppendArrayOfBytes(reinterpret_cast<const uint8*>(challenge.data()), 643 writer.AppendArrayOfBytes(reinterpret_cast<const uint8*>(challenge.data()),
639 challenge.size()); 644 challenge.size());
640 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 645 proxy_->CallMethod(&method_call, kTpmDBusTimeoutMs ,
641 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall, 646 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall,
642 weak_ptr_factory_.GetWeakPtr(), 647 weak_ptr_factory_.GetWeakPtr(),
643 callback)); 648 callback));
644 } 649 }
645 650
646 // CryptohomeClient override. 651 // CryptohomeClient override.
647 virtual void TpmAttestationGetKeyPayload( 652 virtual void TpmAttestationGetKeyPayload(
648 attestation::AttestationKeyType key_type, 653 attestation::AttestationKeyType key_type,
649 const std::string& user_id, 654 const std::string& user_id,
650 const std::string& key_name, 655 const std::string& key_name,
651 const DataMethodCallback& callback) OVERRIDE { 656 const DataMethodCallback& callback) OVERRIDE {
652 dbus::MethodCall method_call( 657 dbus::MethodCall method_call(
653 cryptohome::kCryptohomeInterface, 658 cryptohome::kCryptohomeInterface,
654 cryptohome::kCryptohomeTpmAttestationGetKeyPayload); 659 cryptohome::kCryptohomeTpmAttestationGetKeyPayload);
655 dbus::MessageWriter writer(&method_call); 660 dbus::MessageWriter writer(&method_call);
656 bool is_user_specific = (key_type == attestation::KEY_USER); 661 bool is_user_specific = (key_type == attestation::KEY_USER);
657 writer.AppendBool(is_user_specific); 662 writer.AppendBool(is_user_specific);
658 writer.AppendString(user_id); 663 writer.AppendString(user_id);
659 writer.AppendString(key_name); 664 writer.AppendString(key_name);
660 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 665 proxy_->CallMethod(&method_call, kTpmDBusTimeoutMs ,
661 base::Bind(&CryptohomeClientImpl::OnDataMethod, 666 base::Bind(&CryptohomeClientImpl::OnDataMethod,
662 weak_ptr_factory_.GetWeakPtr(), 667 weak_ptr_factory_.GetWeakPtr(),
663 callback)); 668 callback));
664 } 669 }
665 670
666 // CryptohomeClient override. 671 // CryptohomeClient override.
667 virtual void TpmAttestationSetKeyPayload( 672 virtual void TpmAttestationSetKeyPayload(
668 attestation::AttestationKeyType key_type, 673 attestation::AttestationKeyType key_type,
669 const std::string& user_id, 674 const std::string& user_id,
670 const std::string& key_name, 675 const std::string& key_name,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 const ProtobufMethodCallback& callback) OVERRIDE { 712 const ProtobufMethodCallback& callback) OVERRIDE {
708 const char* method_name = cryptohome::kCryptohomeCheckKeyEx; 713 const char* method_name = cryptohome::kCryptohomeCheckKeyEx;
709 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface, 714 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface,
710 method_name); 715 method_name);
711 716
712 dbus::MessageWriter writer(&method_call); 717 dbus::MessageWriter writer(&method_call);
713 writer.AppendProtoAsArrayOfBytes(id); 718 writer.AppendProtoAsArrayOfBytes(id);
714 writer.AppendProtoAsArrayOfBytes(auth); 719 writer.AppendProtoAsArrayOfBytes(auth);
715 writer.AppendProtoAsArrayOfBytes(request); 720 writer.AppendProtoAsArrayOfBytes(request);
716 721
717 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 722 proxy_->CallMethod(&method_call, kTpmDBusTimeoutMs ,
718 base::Bind(&CryptohomeClientImpl::OnBaseReplyMethod, 723 base::Bind(&CryptohomeClientImpl::OnBaseReplyMethod,
719 weak_ptr_factory_.GetWeakPtr(), 724 weak_ptr_factory_.GetWeakPtr(),
720 callback)); 725 callback));
721 } 726 }
722 727
723 virtual void MountEx( 728 virtual void MountEx(
724 const cryptohome::AccountIdentifier& id, 729 const cryptohome::AccountIdentifier& id,
725 const cryptohome::AuthorizationRequest& auth, 730 const cryptohome::AuthorizationRequest& auth,
726 const cryptohome::MountRequest& request, 731 const cryptohome::MountRequest& request,
727 const ProtobufMethodCallback& callback) OVERRIDE { 732 const ProtobufMethodCallback& callback) OVERRIDE {
728 const char* method_name = cryptohome::kCryptohomeMountEx; 733 const char* method_name = cryptohome::kCryptohomeMountEx;
729 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface, 734 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface,
730 method_name); 735 method_name);
731 736
732 dbus::MessageWriter writer(&method_call); 737 dbus::MessageWriter writer(&method_call);
733 writer.AppendProtoAsArrayOfBytes(id); 738 writer.AppendProtoAsArrayOfBytes(id);
734 writer.AppendProtoAsArrayOfBytes(auth); 739 writer.AppendProtoAsArrayOfBytes(auth);
735 writer.AppendProtoAsArrayOfBytes(request); 740 writer.AppendProtoAsArrayOfBytes(request);
736 741
737 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 742 proxy_->CallMethod(&method_call, kTpmDBusTimeoutMs ,
738 base::Bind(&CryptohomeClientImpl::OnBaseReplyMethod, 743 base::Bind(&CryptohomeClientImpl::OnBaseReplyMethod,
739 weak_ptr_factory_.GetWeakPtr(), 744 weak_ptr_factory_.GetWeakPtr(),
740 callback)); 745 callback));
741 } 746 }
742 747
743 virtual void AddKeyEx( 748 virtual void AddKeyEx(
744 const cryptohome::AccountIdentifier& id, 749 const cryptohome::AccountIdentifier& id,
745 const cryptohome::AuthorizationRequest& auth, 750 const cryptohome::AuthorizationRequest& auth,
746 const cryptohome::AddKeyRequest& request, 751 const cryptohome::AddKeyRequest& request,
747 const ProtobufMethodCallback& callback) OVERRIDE { 752 const ProtobufMethodCallback& callback) OVERRIDE {
748 const char* method_name = cryptohome::kCryptohomeAddKeyEx; 753 const char* method_name = cryptohome::kCryptohomeAddKeyEx;
749 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface, 754 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface,
750 method_name); 755 method_name);
751 756
752 dbus::MessageWriter writer(&method_call); 757 dbus::MessageWriter writer(&method_call);
753 writer.AppendProtoAsArrayOfBytes(id); 758 writer.AppendProtoAsArrayOfBytes(id);
754 writer.AppendProtoAsArrayOfBytes(auth); 759 writer.AppendProtoAsArrayOfBytes(auth);
755 writer.AppendProtoAsArrayOfBytes(request); 760 writer.AppendProtoAsArrayOfBytes(request);
756 761
757 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 762 proxy_->CallMethod(&method_call, kTpmDBusTimeoutMs,
758 base::Bind(&CryptohomeClientImpl::OnBaseReplyMethod, 763 base::Bind(&CryptohomeClientImpl::OnBaseReplyMethod,
759 weak_ptr_factory_.GetWeakPtr(), 764 weak_ptr_factory_.GetWeakPtr(),
760 callback)); 765 callback));
761 } 766 }
762 767
763 virtual void UpdateKeyEx( 768 virtual void UpdateKeyEx(
764 const cryptohome::AccountIdentifier& id, 769 const cryptohome::AccountIdentifier& id,
765 const cryptohome::AuthorizationRequest& auth, 770 const cryptohome::AuthorizationRequest& auth,
766 const cryptohome::UpdateKeyRequest& request, 771 const cryptohome::UpdateKeyRequest& request,
767 const ProtobufMethodCallback& callback) OVERRIDE { 772 const ProtobufMethodCallback& callback) OVERRIDE {
768 const char* method_name = cryptohome::kCryptohomeUpdateKeyEx; 773 const char* method_name = cryptohome::kCryptohomeUpdateKeyEx;
769 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface, 774 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface,
770 method_name); 775 method_name);
771 776
772 dbus::MessageWriter writer(&method_call); 777 dbus::MessageWriter writer(&method_call);
773 writer.AppendProtoAsArrayOfBytes(id); 778 writer.AppendProtoAsArrayOfBytes(id);
774 writer.AppendProtoAsArrayOfBytes(auth); 779 writer.AppendProtoAsArrayOfBytes(auth);
775 writer.AppendProtoAsArrayOfBytes(request); 780 writer.AppendProtoAsArrayOfBytes(request);
776 781
777 proxy_->CallMethod(&method_call, 782 proxy_->CallMethod(&method_call,
778 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 783 kTpmDBusTimeoutMs ,
779 base::Bind(&CryptohomeClientImpl::OnBaseReplyMethod, 784 base::Bind(&CryptohomeClientImpl::OnBaseReplyMethod,
780 weak_ptr_factory_.GetWeakPtr(), 785 weak_ptr_factory_.GetWeakPtr(),
781 callback)); 786 callback));
782 } 787 }
783 788
784 virtual void RemoveKeyEx(const cryptohome::AccountIdentifier& id, 789 virtual void RemoveKeyEx(const cryptohome::AccountIdentifier& id,
785 const cryptohome::AuthorizationRequest& auth, 790 const cryptohome::AuthorizationRequest& auth,
786 const cryptohome::RemoveKeyRequest& request, 791 const cryptohome::RemoveKeyRequest& request,
787 const ProtobufMethodCallback& callback) OVERRIDE { 792 const ProtobufMethodCallback& callback) OVERRIDE {
788 const char* method_name = cryptohome::kCryptohomeRemoveKeyEx; 793 const char* method_name = cryptohome::kCryptohomeRemoveKeyEx;
789 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface, method_name); 794 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface, method_name);
790 795
791 dbus::MessageWriter writer(&method_call); 796 dbus::MessageWriter writer(&method_call);
792 writer.AppendProtoAsArrayOfBytes(id); 797 writer.AppendProtoAsArrayOfBytes(id);
793 writer.AppendProtoAsArrayOfBytes(auth); 798 writer.AppendProtoAsArrayOfBytes(auth);
794 writer.AppendProtoAsArrayOfBytes(request); 799 writer.AppendProtoAsArrayOfBytes(request);
795 800
796 proxy_->CallMethod(&method_call, 801 proxy_->CallMethod(&method_call,
797 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 802 kTpmDBusTimeoutMs ,
798 base::Bind(&CryptohomeClientImpl::OnBaseReplyMethod, 803 base::Bind(&CryptohomeClientImpl::OnBaseReplyMethod,
799 weak_ptr_factory_.GetWeakPtr(), 804 weak_ptr_factory_.GetWeakPtr(),
800 callback)); 805 callback));
801 } 806 }
802 807
803 virtual void GetBootAttribute( 808 virtual void GetBootAttribute(
804 const cryptohome::GetBootAttributeRequest& request, 809 const cryptohome::GetBootAttributeRequest& request,
805 const ProtobufMethodCallback& callback) OVERRIDE { 810 const ProtobufMethodCallback& callback) OVERRIDE {
806 const char* method_name = cryptohome::kCryptohomeGetBootAttribute; 811 const char* method_name = cryptohome::kCryptohomeGetBootAttribute;
807 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface, method_name); 812 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface, method_name);
808 813
809 dbus::MessageWriter writer(&method_call); 814 dbus::MessageWriter writer(&method_call);
810 writer.AppendProtoAsArrayOfBytes(request); 815 writer.AppendProtoAsArrayOfBytes(request);
811 816
812 proxy_->CallMethod(&method_call, 817 proxy_->CallMethod(&method_call,
813 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 818 kTpmDBusTimeoutMs ,
814 base::Bind(&CryptohomeClientImpl::OnBaseReplyMethod, 819 base::Bind(&CryptohomeClientImpl::OnBaseReplyMethod,
815 weak_ptr_factory_.GetWeakPtr(), 820 weak_ptr_factory_.GetWeakPtr(),
816 callback)); 821 callback));
817 } 822 }
818 823
819 virtual void SetBootAttribute( 824 virtual void SetBootAttribute(
820 const cryptohome::SetBootAttributeRequest& request, 825 const cryptohome::SetBootAttributeRequest& request,
821 const ProtobufMethodCallback& callback) OVERRIDE { 826 const ProtobufMethodCallback& callback) OVERRIDE {
822 const char* method_name = cryptohome::kCryptohomeSetBootAttribute; 827 const char* method_name = cryptohome::kCryptohomeSetBootAttribute;
823 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface, method_name); 828 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface, method_name);
824 829
825 dbus::MessageWriter writer(&method_call); 830 dbus::MessageWriter writer(&method_call);
826 writer.AppendProtoAsArrayOfBytes(request); 831 writer.AppendProtoAsArrayOfBytes(request);
827 832
828 proxy_->CallMethod(&method_call, 833 proxy_->CallMethod(&method_call,
829 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 834 kTpmDBusTimeoutMs ,
830 base::Bind(&CryptohomeClientImpl::OnBaseReplyMethod, 835 base::Bind(&CryptohomeClientImpl::OnBaseReplyMethod,
831 weak_ptr_factory_.GetWeakPtr(), 836 weak_ptr_factory_.GetWeakPtr(),
832 callback)); 837 callback));
833 } 838 }
834 839
835 virtual void FlushAndSignBootAttributes( 840 virtual void FlushAndSignBootAttributes(
836 const cryptohome::FlushAndSignBootAttributesRequest& request, 841 const cryptohome::FlushAndSignBootAttributesRequest& request,
837 const ProtobufMethodCallback& callback) OVERRIDE { 842 const ProtobufMethodCallback& callback) OVERRIDE {
838 const char* method_name = cryptohome::kCryptohomeFlushAndSignBootAttributes; 843 const char* method_name = cryptohome::kCryptohomeFlushAndSignBootAttributes;
839 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface, method_name); 844 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface, method_name);
840 845
841 dbus::MessageWriter writer(&method_call); 846 dbus::MessageWriter writer(&method_call);
842 writer.AppendProtoAsArrayOfBytes(request); 847 writer.AppendProtoAsArrayOfBytes(request);
843 848
844 proxy_->CallMethod(&method_call, 849 proxy_->CallMethod(&method_call,
845 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 850 kTpmDBusTimeoutMs ,
846 base::Bind(&CryptohomeClientImpl::OnBaseReplyMethod, 851 base::Bind(&CryptohomeClientImpl::OnBaseReplyMethod,
847 weak_ptr_factory_.GetWeakPtr(), 852 weak_ptr_factory_.GetWeakPtr(),
848 callback)); 853 callback));
849 } 854 }
850 855
851 protected: 856 protected:
852 virtual void Init(dbus::Bus* bus) OVERRIDE { 857 virtual void Init(dbus::Bus* bus) OVERRIDE {
853 proxy_ = bus->GetObjectProxy( 858 proxy_ = bus->GetObjectProxy(
854 cryptohome::kCryptohomeServiceName, 859 cryptohome::kCryptohomeServiceName,
855 dbus::ObjectPath(cryptohome::kCryptohomeServicePath)); 860 dbus::ObjectPath(cryptohome::kCryptohomeServicePath));
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 callback.Run(DBUS_METHOD_CALL_FAILURE, std::vector<uint8>()); 905 callback.Run(DBUS_METHOD_CALL_FAILURE, std::vector<uint8>());
901 return; 906 return;
902 } 907 }
903 callback.Run(DBUS_METHOD_CALL_SUCCESS, 908 callback.Run(DBUS_METHOD_CALL_SUCCESS,
904 std::vector<uint8>(bytes, bytes + length)); 909 std::vector<uint8>(bytes, bytes + length));
905 } 910 }
906 911
907 // Calls a method without result values. 912 // Calls a method without result values.
908 void CallVoidMethod(dbus::MethodCall* method_call, 913 void CallVoidMethod(dbus::MethodCall* method_call,
909 const VoidDBusMethodCallback& callback) { 914 const VoidDBusMethodCallback& callback) {
910 proxy_->CallMethod(method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 915 proxy_->CallMethod(method_call, kTpmDBusTimeoutMs ,
911 base::Bind(&CryptohomeClientImpl::OnVoidMethod, 916 base::Bind(&CryptohomeClientImpl::OnVoidMethod,
912 weak_ptr_factory_.GetWeakPtr(), 917 weak_ptr_factory_.GetWeakPtr(),
913 callback)); 918 callback));
914 } 919 }
915 920
916 void OnVoidMethod(const VoidDBusMethodCallback& callback, 921 void OnVoidMethod(const VoidDBusMethodCallback& callback,
917 dbus::Response* response) { 922 dbus::Response* response) {
918 if (!response) { 923 if (!response) {
919 callback.Run(DBUS_METHOD_CALL_FAILURE); 924 callback.Run(DBUS_METHOD_CALL_FAILURE);
920 return; 925 return;
921 } 926 }
922 callback.Run(DBUS_METHOD_CALL_SUCCESS); 927 callback.Run(DBUS_METHOD_CALL_SUCCESS);
923 } 928 }
924 929
925 // Calls a method with a bool value reult and block. 930 // Calls a method with a bool value reult and block.
926 bool CallBoolMethodAndBlock(dbus::MethodCall* method_call, 931 bool CallBoolMethodAndBlock(dbus::MethodCall* method_call,
927 bool* result) { 932 bool* result) {
928 scoped_ptr<dbus::Response> response( 933 scoped_ptr<dbus::Response> response(
929 blocking_method_caller_->CallMethodAndBlock(method_call)); 934 blocking_method_caller_->CallMethodAndBlock(method_call));
930 if (!response.get()) 935 if (!response.get())
931 return false; 936 return false;
932 dbus::MessageReader reader(response.get()); 937 dbus::MessageReader reader(response.get());
933 return reader.PopBool(result); 938 return reader.PopBool(result);
934 } 939 }
935 940
936 // Calls a method with a bool value result. 941 // Calls a method with a bool value result.
937 void CallBoolMethod(dbus::MethodCall* method_call, 942 void CallBoolMethod(dbus::MethodCall* method_call,
938 const BoolDBusMethodCallback& callback) { 943 const BoolDBusMethodCallback& callback) {
939 proxy_->CallMethod(method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 944 proxy_->CallMethod(method_call, kTpmDBusTimeoutMs ,
940 base::Bind( 945 base::Bind(
941 &CryptohomeClientImpl::OnBoolMethod, 946 &CryptohomeClientImpl::OnBoolMethod,
942 weak_ptr_factory_.GetWeakPtr(), 947 weak_ptr_factory_.GetWeakPtr(),
943 callback)); 948 callback));
944 } 949 }
945 950
946 // Handles responses for methods with a bool value result. 951 // Handles responses for methods with a bool value result.
947 void OnBoolMethod(const BoolDBusMethodCallback& callback, 952 void OnBoolMethod(const BoolDBusMethodCallback& callback,
948 dbus::Response* response) { 953 dbus::Response* response) {
949 if (!response) { 954 if (!response) {
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 return new CryptohomeClientImpl(); 1127 return new CryptohomeClientImpl();
1123 } 1128 }
1124 1129
1125 // static 1130 // static
1126 std::string CryptohomeClient::GetStubSanitizedUsername( 1131 std::string CryptohomeClient::GetStubSanitizedUsername(
1127 const std::string& username) { 1132 const std::string& username) {
1128 return username + kUserIdStubHashSuffix; 1133 return username + kUserIdStubHashSuffix;
1129 } 1134 }
1130 1135
1131 } // namespace chromeos 1136 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698