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

Side by Side Diff: chromeos/cert_loader.cc

Issue 26407002: Add support for the Pkcs11GetTpmTokenInfoForUser cryptohome call. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/cert_loader.h" 5 #include "chromeos/cert_loader.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "base/observer_list.h" 10 #include "base/observer_list.h"
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 RetryTokenInitializationLater(); 290 RetryTokenInitializationLater();
291 return; 291 return;
292 } 292 }
293 293
294 tpm_token_state_ = TPM_TOKEN_READY; 294 tpm_token_state_ = TPM_TOKEN_READY;
295 InitializeTokenAndLoadCertificates(); 295 InitializeTokenAndLoadCertificates();
296 } 296 }
297 297
298 void CertLoader::OnPkcs11GetTpmTokenInfo(DBusMethodCallStatus call_status, 298 void CertLoader::OnPkcs11GetTpmTokenInfo(DBusMethodCallStatus call_status,
299 const std::string& token_name, 299 const std::string& token_name,
300 const std::string& user_pin) { 300 const std::string& user_pin,
301 int token_slot) {
301 VLOG(1) << "OnPkcs11GetTpmTokenInfo: " << token_name; 302 VLOG(1) << "OnPkcs11GetTpmTokenInfo: " << token_name;
302 303
303 if (call_status == DBUS_METHOD_CALL_FAILURE) { 304 if (call_status == DBUS_METHOD_CALL_FAILURE) {
304 RetryTokenInitializationLater(); 305 RetryTokenInitializationLater();
305 return; 306 return;
306 } 307 }
307 308
308 tpm_token_name_ = token_name; 309 tpm_token_name_ = token_name;
309 // TODO(stevenjb): The network code expects a slot ID, not a label. See 310 tpm_token_slot_ = base::IntToString(token_slot);
310 // crbug.com/201101. For now, use a hard coded, well known slot instead.
311 const char kHardcodedTpmSlot[] = "0";
312 tpm_token_slot_ = kHardcodedTpmSlot;
313 tpm_user_pin_ = user_pin; 311 tpm_user_pin_ = user_pin;
314 tpm_token_state_ = TPM_TOKEN_INFO_RECEIVED; 312 tpm_token_state_ = TPM_TOKEN_INFO_RECEIVED;
315 313
316 InitializeTokenAndLoadCertificates(); 314 InitializeTokenAndLoadCertificates();
317 } 315 }
318 316
319 void CertLoader::OnTPMTokenInitialized(bool success) { 317 void CertLoader::OnTPMTokenInitialized(bool success) {
320 VLOG(1) << "OnTPMTokenInitialized: " << success; 318 VLOG(1) << "OnTPMTokenInitialized: " << success;
321 if (!success) { 319 if (!success) {
322 RetryTokenInitializationLater(); 320 RetryTokenInitializationLater();
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 VLOG(1) << "OnCertRemoved"; 388 VLOG(1) << "OnCertRemoved";
391 LoadCertificates(); 389 LoadCertificates();
392 } 390 }
393 391
394 void CertLoader::LoggedInStateChanged() { 392 void CertLoader::LoggedInStateChanged() {
395 VLOG(1) << "LoggedInStateChanged"; 393 VLOG(1) << "LoggedInStateChanged";
396 MaybeRequestCertificates(); 394 MaybeRequestCertificates();
397 } 395 }
398 396
399 } // namespace chromeos 397 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698