| 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 "chrome/browser/chromeos/login/easy_unlock/easy_unlock_create_keys_oper
ation.h" | 5 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_create_keys_oper
ation.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 return; | 284 return; |
| 285 } | 285 } |
| 286 | 286 |
| 287 EasyUnlockDeviceKeyData* device = &devices_[index]; | 287 EasyUnlockDeviceKeyData* device = &devices_[index]; |
| 288 if (!encryptor.Encrypt(user_key, &device->wrapped_secret)) { | 288 if (!encryptor.Encrypt(user_key, &device->wrapped_secret)) { |
| 289 PA_LOG(ERROR) << "Easy unlock failed to encrypt user key for key creation."; | 289 PA_LOG(ERROR) << "Easy unlock failed to encrypt user key for key creation."; |
| 290 callback_.Run(false); | 290 callback_.Run(false); |
| 291 return; | 291 return; |
| 292 } | 292 } |
| 293 | 293 |
| 294 std::string raw_session_key; | |
| 295 session_key->GetRawKey(&raw_session_key); | |
| 296 | |
| 297 challenge_creator_.reset(new ChallengeCreator( | 294 challenge_creator_.reset(new ChallengeCreator( |
| 298 user_key, | 295 user_key, session_key->key(), tpm_public_key_, device, |
| 299 raw_session_key, | |
| 300 tpm_public_key_, | |
| 301 device, | |
| 302 base::Bind(&EasyUnlockCreateKeysOperation::OnChallengeCreated, | 296 base::Bind(&EasyUnlockCreateKeysOperation::OnChallengeCreated, |
| 303 weak_ptr_factory_.GetWeakPtr(), | 297 weak_ptr_factory_.GetWeakPtr(), index))); |
| 304 index))); | |
| 305 challenge_creator_->Start(); | 298 challenge_creator_->Start(); |
| 306 } | 299 } |
| 307 | 300 |
| 308 void EasyUnlockCreateKeysOperation::OnChallengeCreated(size_t index, | 301 void EasyUnlockCreateKeysOperation::OnChallengeCreated(size_t index, |
| 309 bool success) { | 302 bool success) { |
| 310 DCHECK_EQ(key_creation_index_, index); | 303 DCHECK_EQ(key_creation_index_, index); |
| 311 | 304 |
| 312 if (!success) { | 305 if (!success) { |
| 313 PA_LOG(ERROR) << "Easy unlock failed to create challenge for key creation."; | 306 PA_LOG(ERROR) << "Easy unlock failed to create challenge for key creation."; |
| 314 callback_.Run(false); | 307 callback_.Run(false); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 user_context_.GetKey()->GetLabel() == | 388 user_context_.GetKey()->GetLabel() == |
| 396 EasyUnlockKeyManager::GetKeyLabel(key_creation_index_)) { | 389 EasyUnlockKeyManager::GetKeyLabel(key_creation_index_)) { |
| 397 user_context_.SetKey(user_key); | 390 user_context_.SetKey(user_key); |
| 398 } | 391 } |
| 399 | 392 |
| 400 ++key_creation_index_; | 393 ++key_creation_index_; |
| 401 CreateKeyForDeviceAtIndex(key_creation_index_); | 394 CreateKeyForDeviceAtIndex(key_creation_index_); |
| 402 } | 395 } |
| 403 | 396 |
| 404 } // namespace chromeos | 397 } // namespace chromeos |
| OLD | NEW |