Index: chrome/browser/chromeos/login/easy_unlock/easy_unlock_create_keys_operation.cc |
diff --git a/chrome/browser/chromeos/login/easy_unlock/easy_unlock_create_keys_operation.cc b/chrome/browser/chromeos/login/easy_unlock/easy_unlock_create_keys_operation.cc |
index 21e7bedb46d149252baba07326a3223a424f1c5a..b98afec3de259cb4a994c67b7419fdb41bee85dc 100644 |
--- a/chrome/browser/chromeos/login/easy_unlock/easy_unlock_create_keys_operation.cc |
+++ b/chrome/browser/chromeos/login/easy_unlock/easy_unlock_create_keys_operation.cc |
@@ -354,9 +354,8 @@ void EasyUnlockCreateKeysOperation::OnGetSystemSalt( |
kEasyUnlockKeyMetaNamePubKey, device->public_key)); |
key_def.provider_data.push_back(cryptohome::KeyDefinition::ProviderData( |
kEasyUnlockKeyMetaNameChallenge, device->challenge)); |
- // TODO(xiyuan): Store wrapped secret when all pieces are in place. |
key_def.provider_data.push_back(cryptohome::KeyDefinition::ProviderData( |
- kEasyUnlockKeyMetaNameWrappedSecret, challenge_creator_->user_key())); |
+ kEasyUnlockKeyMetaNameWrappedSecret, device->wrapped_secret)); |
// Add cryptohome key. |
std::string canonicalized = |
@@ -371,11 +370,13 @@ void EasyUnlockCreateKeysOperation::OnGetSystemSalt( |
true, // clobber |
base::Bind(&EasyUnlockCreateKeysOperation::OnKeyCreated, |
weak_ptr_factory_.GetWeakPtr(), |
- index)); |
+ index, |
+ user_key)); |
} |
void EasyUnlockCreateKeysOperation::OnKeyCreated( |
size_t index, |
+ const Key& user_key, |
bool success, |
cryptohome::MountError return_code) { |
DCHECK_EQ(key_creation_index_, index); |
@@ -386,6 +387,14 @@ void EasyUnlockCreateKeysOperation::OnKeyCreated( |
return; |
} |
+ // If the key associated with the current context changed (i.e. in the case |
+ // the current signin flow was Easy signin), update the user context. |
+ if (user_context_.GetAuthFlow() == UserContext::AUTH_FLOW_EASY_UNLOCK && |
+ user_context_.GetKey()->GetLabel() == |
+ EasyUnlockKeyManager::GetKeyLabel(key_creation_index_)) { |
+ user_context_.SetKey(user_key); |
+ } |
+ |
++key_creation_index_; |
CreateKeyForDeviceAtIndex(key_creation_index_); |
} |