diff options
author | bartfab <bartfab@chromium.org> | 2014-09-15 07:40:04 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-15 15:02:23 +0000 |
commit | e7e066d00108649cb3761fc5f450a8d9068fa8b3 (patch) | |
tree | 6e8ef2a5cddda660e8a9535176400fd492682f9c /chromeos/login | |
parent | 908d52405f9961fd87d3b65287ab50f67a1d7c1b (diff) | |
download | chromium_src-e7e066d00108649cb3761fc5f450a8d9068fa8b3.zip chromium_src-e7e066d00108649cb3761fc5f450a8d9068fa8b3.tar.gz chromium_src-e7e066d00108649cb3761fc5f450a8d9068fa8b3.tar.bz2 |
Merge cryptohome::RetrievedKeyData with cryptohome::KeyDefinition
cryptohome::RetrievedKeyData and cryptohome::KeyDefinition both represent
subsets of the Key protobuf. This CL merges the two classes and makes the
resulting cryptohome::KeyDefinition contain all of Key's fields.
TBR=pamg (manager_password_service.cc)
BUG=367847
TEST=Updated unit tests
Review URL: https://codereview.chromium.org/526353002
Cr-Commit-Position: refs/heads/master@{#294823}
Diffstat (limited to 'chromeos/login')
-rw-r--r-- | chromeos/login/auth/cryptohome_authenticator.cc | 45 | ||||
-rw-r--r-- | chromeos/login/auth/extended_authenticator.cc | 2 |
2 files changed, 25 insertions, 22 deletions
diff --git a/chromeos/login/auth/cryptohome_authenticator.cc b/chromeos/login/auth/cryptohome_authenticator.cc index d00cf29..0c3c162 100644 --- a/chromeos/login/auth/cryptohome_authenticator.cc +++ b/chromeos/login/auth/cryptohome_authenticator.cc @@ -4,6 +4,8 @@ #include "chromeos/login/auth/cryptohome_authenticator.h" +#include <vector> + #include "base/basictypes.h" #include "base/bind.h" #include "base/files/file_path.h" @@ -175,32 +177,33 @@ void OnGetSystemSalt(AuthAttemptState* attempt, // |attempt->user_context| can be transformed with Chrome's default hashing // algorithm and the system salt. // The resulting key is then passed to cryptohome's MountEx(). -void OnGetKeyDataEx(AuthAttemptState* attempt, - scoped_refptr<CryptohomeAuthenticator> resolver, - bool ephemeral, - bool create_if_nonexistent, - bool success, - cryptohome::MountError return_code, - ScopedVector<cryptohome::RetrievedKeyData> key_data) { +void OnGetKeyDataEx( + AuthAttemptState* attempt, + scoped_refptr<CryptohomeAuthenticator> resolver, + bool ephemeral, + bool create_if_nonexistent, + bool success, + cryptohome::MountError return_code, + const std::vector<cryptohome::KeyDefinition>& key_definitions) { if (success) { - if (key_data.size() == 1) { - cryptohome::RetrievedKeyData* key_data_entry = key_data.front(); - DCHECK_EQ(kCryptohomeGAIAKeyLabel, key_data_entry->label); + if (key_definitions.size() == 1) { + const cryptohome::KeyDefinition& key_definition = key_definitions.front(); + DCHECK_EQ(kCryptohomeGAIAKeyLabel, key_definition.label); - // Extract the key type and salt from |key_data|, if present. + // Extract the key type and salt from |key_definition|, if present. scoped_ptr<int64> type; scoped_ptr<std::string> salt; - for (ScopedVector<cryptohome::RetrievedKeyData::ProviderData>:: - const_iterator it = key_data_entry->provider_data.begin(); - it != key_data_entry->provider_data.end(); ++it) { - if ((*it)->name == kKeyProviderDataTypeName) { - if ((*it)->number) - type.reset(new int64(*(*it)->number)); + for (std::vector<cryptohome::KeyDefinition::ProviderData>:: + const_iterator it = key_definition.provider_data.begin(); + it != key_definition.provider_data.end(); ++it) { + if (it->name == kKeyProviderDataTypeName) { + if (it->number) + type.reset(new int64(*it->number)); else NOTREACHED(); - } else if ((*it)->name == kKeyProviderDataSaltName) { - if ((*it)->bytes) - salt.reset(new std::string(*(*it)->bytes)); + } else if (it->name == kKeyProviderDataSaltName) { + if (it->bytes) + salt.reset(new std::string(*it->bytes)); else NOTREACHED(); } @@ -226,7 +229,7 @@ void OnGetKeyDataEx(AuthAttemptState* attempt, return; } } else { - LOG(ERROR) << "GetKeyDataEx() returned " << key_data.size() + LOG(ERROR) << "GetKeyDataEx() returned " << key_definitions.size() << " entries."; } } diff --git a/chromeos/login/auth/extended_authenticator.cc b/chromeos/login/auth/extended_authenticator.cc index 7a99d72..0b81439 100644 --- a/chromeos/login/auth/extended_authenticator.cc +++ b/chromeos/login/auth/extended_authenticator.cc @@ -89,7 +89,7 @@ void ExtendedAuthenticator::CreateMount( mount.create_keys.push_back(keys[i]); } UserContext context(user_id); - Key key(keys.front().key); + Key key(keys.front().secret); key.SetLabel(keys.front().label); context.SetKey(key); |