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

Side by Side Diff: chromeos/login/auth/cryptohome_authenticator.cc

Issue 2801873007: Resume encryption migration immediately if the previous migration is incomplete. (Closed)
Patch Set: Created 3 years, 8 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 | « chromeos/login/auth/cryptohome_authenticator.h ('k') | chromeos/login/auth/login_performer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chromeos/login/auth/cryptohome_authenticator.h" 5 #include "chromeos/login/auth/cryptohome_authenticator.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 if (consumer_) 653 if (consumer_)
654 consumer_->OnOffTheRecordAuthSuccess(); 654 consumer_->OnOffTheRecordAuthSuccess();
655 } 655 }
656 656
657 void CryptohomeAuthenticator::OnPasswordChangeDetected() { 657 void CryptohomeAuthenticator::OnPasswordChangeDetected() {
658 DCHECK(task_runner_->RunsTasksOnCurrentThread()); 658 DCHECK(task_runner_->RunsTasksOnCurrentThread());
659 if (consumer_) 659 if (consumer_)
660 consumer_->OnPasswordChangeDetected(); 660 consumer_->OnPasswordChangeDetected();
661 } 661 }
662 662
663 void CryptohomeAuthenticator::OnOldEncryptionDetected() { 663 void CryptohomeAuthenticator::OnOldEncryptionDetected(
664 bool has_incomplete_migration) {
664 DCHECK(task_runner_->RunsTasksOnCurrentThread()); 665 DCHECK(task_runner_->RunsTasksOnCurrentThread());
665 if (consumer_) 666 if (consumer_) {
666 consumer_->OnOldEncryptionDetected(current_state_->user_context); 667 consumer_->OnOldEncryptionDetected(current_state_->user_context,
668 has_incomplete_migration);
669 }
667 } 670 }
668 671
669 void CryptohomeAuthenticator::OnAuthFailure(const AuthFailure& error) { 672 void CryptohomeAuthenticator::OnAuthFailure(const AuthFailure& error) {
670 DCHECK(task_runner_->RunsTasksOnCurrentThread()); 673 DCHECK(task_runner_->RunsTasksOnCurrentThread());
671 674
672 // OnAuthFailure will be called again with the same |error| 675 // OnAuthFailure will be called again with the same |error|
673 // after the cryptohome has been removed. 676 // after the cryptohome has been removed.
674 if (remove_user_data_on_failure_) { 677 if (remove_user_data_on_failure_) {
675 delayed_login_failure_ = &error; 678 delayed_login_failure_ = &error;
676 RemoveEncryptedData(); 679 RemoveEncryptedData();
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 this, 861 this,
859 current_state_->online_outcome())); 862 current_state_->online_outcome()));
860 break; 863 break;
861 case OWNER_REQUIRED: { 864 case OWNER_REQUIRED: {
862 current_state_->ResetCryptohomeStatus(); 865 current_state_->ResetCryptohomeStatus();
863 DBusThreadManager::Get()->GetCryptohomeClient()->Unmount( 866 DBusThreadManager::Get()->GetCryptohomeClient()->Unmount(
864 base::Bind(&CryptohomeAuthenticator::OnUnmount, this)); 867 base::Bind(&CryptohomeAuthenticator::OnUnmount, this));
865 break; 868 break;
866 } 869 }
867 case FAILED_OLD_ENCRYPTION: 870 case FAILED_OLD_ENCRYPTION:
871 case FAILED_PREVIOUS_MIGRATION_INCOMPLETE:
868 // In this case, we tried to create/mount cryptohome and failed 872 // In this case, we tried to create/mount cryptohome and failed
869 // because the file system is encrypted in old format. 873 // because the file system is encrypted in old format.
870 // Chrome will show a screen which asks user to migrate the encryption. 874 // Chrome will show a screen which asks user to migrate the encryption.
871 task_runner_->PostTask( 875 task_runner_->PostTask(
872 FROM_HERE, 876 FROM_HERE,
873 base::Bind(&CryptohomeAuthenticator::OnOldEncryptionDetected, this)); 877 base::Bind(&CryptohomeAuthenticator::OnOldEncryptionDetected, this,
878 state == FAILED_PREVIOUS_MIGRATION_INCOMPLETE));
874 break; 879 break;
875 default: 880 default:
876 NOTREACHED(); 881 NOTREACHED();
877 break; 882 break;
878 } 883 }
879 } 884 }
880 885
881 CryptohomeAuthenticator::~CryptohomeAuthenticator() { 886 CryptohomeAuthenticator::~CryptohomeAuthenticator() {
882 } 887 }
883 888
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 if (current_state_->cryptohome_code() == 946 if (current_state_->cryptohome_code() ==
942 cryptohome::MOUNT_ERROR_TPM_NEEDS_REBOOT) { 947 cryptohome::MOUNT_ERROR_TPM_NEEDS_REBOOT) {
943 // Critical TPM error detected, reboot needed. 948 // Critical TPM error detected, reboot needed.
944 return FAILED_TPM; 949 return FAILED_TPM;
945 } 950 }
946 951
947 if (current_state_->cryptohome_code() == 952 if (current_state_->cryptohome_code() ==
948 cryptohome::MOUNT_ERROR_OLD_ENCRYPTION) { 953 cryptohome::MOUNT_ERROR_OLD_ENCRYPTION) {
949 return FAILED_OLD_ENCRYPTION; 954 return FAILED_OLD_ENCRYPTION;
950 } 955 }
956 if (current_state_->cryptohome_code() ==
957 cryptohome::MOUNT_ERROR_PREVIOUS_MIGRATION_INCOMPLETE) {
958 return FAILED_PREVIOUS_MIGRATION_INCOMPLETE;
959 }
951 960
952 // Return intermediate states in the following case: 961 // Return intermediate states in the following case:
953 // when there is an online result to use; 962 // when there is an online result to use;
954 // This is the case after user finishes Gaia login; 963 // This is the case after user finishes Gaia login;
955 if (current_state_->online_complete()) { 964 if (current_state_->online_complete()) {
956 if (current_state_->cryptohome_code() == 965 if (current_state_->cryptohome_code() ==
957 cryptohome::MOUNT_ERROR_KEY_FAILURE) { 966 cryptohome::MOUNT_ERROR_KEY_FAILURE) {
958 // If we tried a mount but they used the wrong key, we may need to 967 // If we tried a mount but they used the wrong key, we may need to
959 // ask the user for their old password. We'll only know once we've 968 // ask the user for their old password. We'll only know once we've
960 // done the online check. 969 // done the online check.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1025 Resolve(); 1034 Resolve();
1026 } 1035 }
1027 1036
1028 void CryptohomeAuthenticator::SetOwnerState(bool owner_check_finished, 1037 void CryptohomeAuthenticator::SetOwnerState(bool owner_check_finished,
1029 bool check_result) { 1038 bool check_result) {
1030 owner_is_verified_ = owner_check_finished; 1039 owner_is_verified_ = owner_check_finished;
1031 user_can_login_ = check_result; 1040 user_can_login_ = check_result;
1032 } 1041 }
1033 1042
1034 } // namespace chromeos 1043 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/login/auth/cryptohome_authenticator.h ('k') | chromeos/login/auth/login_performer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698