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

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

Issue 554043003: cros: Create cryptohome keys for Easy sign-in. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: for #6 Created 6 years, 3 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
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 "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 cryptohome::MountError return_code, 183 cryptohome::MountError return_code,
184 ScopedVector<cryptohome::RetrievedKeyData> key_data) { 184 ScopedVector<cryptohome::RetrievedKeyData> key_data) {
185 if (success) { 185 if (success) {
186 if (key_data.size() == 1) { 186 if (key_data.size() == 1) {
187 cryptohome::RetrievedKeyData* key_data_entry = key_data.front(); 187 cryptohome::RetrievedKeyData* key_data_entry = key_data.front();
188 DCHECK_EQ(kCryptohomeGAIAKeyLabel, key_data_entry->label); 188 DCHECK_EQ(kCryptohomeGAIAKeyLabel, key_data_entry->label);
189 189
190 // Extract the key type and salt from |key_data|, if present. 190 // Extract the key type and salt from |key_data|, if present.
191 scoped_ptr<int64> type; 191 scoped_ptr<int64> type;
192 scoped_ptr<std::string> salt; 192 scoped_ptr<std::string> salt;
193 for (ScopedVector<cryptohome::RetrievedKeyData::ProviderData>:: 193 for (std::vector<cryptohome::ProviderDataEntry>::
194 const_iterator it = key_data_entry->provider_data.begin(); 194 const_iterator it = key_data_entry->provider_data.begin();
195 it != key_data_entry->provider_data.end(); ++it) { 195 it != key_data_entry->provider_data.end(); ++it) {
196 if ((*it)->name == kKeyProviderDataTypeName) { 196 if (it->name == kKeyProviderDataTypeName) {
197 if ((*it)->number) 197 if (it->has_number)
198 type.reset(new int64(*(*it)->number)); 198 type.reset(new int64(it->number));
199 else 199 else
200 NOTREACHED(); 200 NOTREACHED();
201 } else if ((*it)->name == kKeyProviderDataSaltName) { 201 } else if (it->name == kKeyProviderDataSaltName) {
202 if ((*it)->bytes) 202 if (it->has_bytes)
203 salt.reset(new std::string(*(*it)->bytes)); 203 salt.reset(new std::string(it->bytes));
204 else 204 else
205 NOTREACHED(); 205 NOTREACHED();
206 } 206 }
207 } 207 }
208 208
209 if (type) { 209 if (type) {
210 if (*type < 0 || *type >= Key::KEY_TYPE_COUNT) { 210 if (*type < 0 || *type >= Key::KEY_TYPE_COUNT) {
211 LOG(ERROR) << "Invalid key type: " << *type; 211 LOG(ERROR) << "Invalid key type: " << *type;
212 RecordKeyErrorAndResolve(attempt, resolver); 212 RecordKeyErrorAndResolve(attempt, resolver);
213 return; 213 return;
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 Resolve(); 918 Resolve();
919 } 919 }
920 920
921 void CryptohomeAuthenticator::SetOwnerState(bool owner_check_finished, 921 void CryptohomeAuthenticator::SetOwnerState(bool owner_check_finished,
922 bool check_result) { 922 bool check_result) {
923 owner_is_verified_ = owner_check_finished; 923 owner_is_verified_ = owner_check_finished;
924 user_can_login_ = check_result; 924 user_can_login_ = check_result;
925 } 925 }
926 926
927 } // namespace chromeos 927 } // namespace chromeos
OLDNEW
« chromeos/cryptohome/homedir_methods.cc ('K') | « chromeos/cryptohome/homedir_methods_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698