OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |