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

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

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