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

Side by Side Diff: tpm.cc

Issue 3135016: Commit the change that I forgot to commit. (Closed) Base URL: http://src.chromium.org/git/tpm_init.git
Patch Set: Created 10 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) 2009-2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2009-2010 The Chromium OS 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 // Contains the implementation of class Tpm 5 // Contains the implementation of class Tpm
6 6
7 #include "tpm.h" 7 #include "tpm.h"
8 8
9 #include <base/file_util.h> 9 #include <base/file_util.h>
10 #include <base/platform_thread.h> 10 #include <base/platform_thread.h>
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 default_owner_password)) { 534 default_owner_password)) {
535 LOG(ERROR) << "Take Ownership failed"; 535 LOG(ERROR) << "Take Ownership failed";
536 return false; 536 return false;
537 } 537 }
538 538
539 is_owned_ = true; 539 is_owned_ = true;
540 took_ownership = true; 540 took_ownership = true;
541 } 541 }
542 542
543 // Ensure the SRK is available 543 // Ensure the SRK is available
544 TSS_RESULT result;
544 TSS_HKEY srk_handle; 545 TSS_HKEY srk_handle;
545 TSS_UUID SRK_UUID = TSS_UUID_SRK; 546 TSS_UUID SRK_UUID = TSS_UUID_SRK;
546 if ((result = Tspi_Context_LoadKeyByUUID(context_handle, TSS_PS_TYPE_SYSTEM, 547 if ((result = Tspi_Context_LoadKeyByUUID(context_handle_, TSS_PS_TYPE_SYSTEM,
547 SRK_UUID, &srk_handle))) { 548 SRK_UUID, &srk_handle))) {
548 is_srk_available_ = false; 549 is_srk_available_ = false;
549 } else { 550 } else {
550 Tspi_Context_CloseObject(context_handle, srk_handle); 551 Tspi_Context_CloseObject(context_handle_, srk_handle);
551 is_srk_available_ = true; 552 is_srk_available_ = true;
552 } 553 }
553 554
554 // If we can open the TPM with the default password, then we still need to 555 // If we can open the TPM with the default password, then we still need to
555 // zero the SRK password and unrestrict it, then change the owner password. 556 // zero the SRK password and unrestrict it, then change the owner password.
556 TSS_HTPM tpm_handle; 557 TSS_HTPM tpm_handle;
557 if (GetTpmWithAuth(context_handle_, default_owner_password, &tpm_handle) && 558 if (GetTpmWithAuth(context_handle_, default_owner_password, &tpm_handle) &&
558 TestTpmAuth(tpm_handle)) { 559 TestTpmAuth(tpm_handle)) {
559 if (!ZeroSrkPassword(context_handle_, default_owner_password)) { 560 if (!ZeroSrkPassword(context_handle_, default_owner_password)) {
560 LOG(ERROR) << "Couldn't zero SRK password"; 561 LOG(ERROR) << "Couldn't zero SRK password";
(...skipping 17 matching lines...) Expand all
578 owner_password_.assign(owner_password.begin(), owner_password.end()); 579 owner_password_.assign(owner_password.begin(), owner_password.end());
579 password_sync_lock_.Release(); 580 password_sync_lock_.Release();
580 581
581 file_util::WriteFile(FilePath(kTpmOwnedFile), NULL, 0); 582 file_util::WriteFile(FilePath(kTpmOwnedFile), NULL, 0);
582 } 583 }
583 584
584 return took_ownership; 585 return took_ownership;
585 } 586 }
586 587
587 } // namespace tpm_init 588 } // namespace tpm_init
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