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

Unified Diff: chromeos/login/auth/key.cc

Issue 378513005: [Athena] Extract Chrome OS authentication stack (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix includes in one more test Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/login/auth/key.h ('k') | chromeos/login/auth/key_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/login/auth/key.cc
diff --git a/chrome/browser/chromeos/login/auth/key.cc b/chromeos/login/auth/key.cc
similarity index 81%
rename from chrome/browser/chromeos/login/auth/key.cc
rename to chromeos/login/auth/key.cc
index ab6abd86500843945a3494a6fb07542188f0f651..099659b99079fbb7ada342973fbdc381a706b16a 100644
--- a/chrome/browser/chromeos/login/auth/key.cc
+++ b/chromeos/login/auth/key.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/chromeos/login/auth/key.h"
+#include "chromeos/login/auth/key.h"
#include "base/base64.h"
#include "base/logging.h"
@@ -25,32 +25,27 @@ const int kKeySizeInBits = 256;
Key::Key() : key_type_(KEY_TYPE_PASSWORD_PLAIN) {
}
-Key::Key(const Key& other) : key_type_(other.key_type_),
- salt_(other.salt_),
- secret_(other.secret_),
- label_(other.label_) {
+Key::Key(const Key& other)
+ : key_type_(other.key_type_),
+ salt_(other.salt_),
+ secret_(other.secret_),
+ label_(other.label_) {
}
Key::Key(const std::string& plain_text_password)
- : key_type_(KEY_TYPE_PASSWORD_PLAIN),
- secret_(plain_text_password) {
+ : key_type_(KEY_TYPE_PASSWORD_PLAIN), secret_(plain_text_password) {
}
Key::Key(KeyType key_type, const std::string& salt, const std::string& secret)
- : key_type_(key_type),
- salt_(salt),
- secret_(secret) {
-
+ : key_type_(key_type), salt_(salt), secret_(secret) {
}
Key::~Key() {
}
bool Key::operator==(const Key& other) const {
- return other.key_type_ == key_type_ &&
- other.salt_ == salt_ &&
- other.secret_ == secret_ &&
- other.label_ == label_;
+ return other.key_type_ == key_type_ && other.salt_ == salt_ &&
+ other.secret_ == secret_ && other.label_ == label_;
}
Key::KeyType Key::GetKeyType() const {
@@ -92,7 +87,8 @@ void Key::Transform(KeyType target_key_type, const std::string& salt) {
secret_ = StringToLowerASCII(base::HexEncode(
reinterpret_cast<const void*>(hash), sizeof(hash) / 2));
break;
- } case KEY_TYPE_SALTED_PBKDF2_AES256_1234: {
+ }
+ case KEY_TYPE_SALTED_PBKDF2_AES256_1234: {
scoped_ptr<crypto::SymmetricKey> key(
crypto::SymmetricKey::DeriveKeyFromPassword(crypto::SymmetricKey::AES,
secret_,
@@ -103,7 +99,8 @@ void Key::Transform(KeyType target_key_type, const std::string& salt) {
key->GetRawKey(&raw_secret);
base::Base64Encode(raw_secret, &secret_);
break;
- } default:
+ }
+ default:
// The resulting key will be sent to cryptohomed. It should always be
// hashed. If hashing fails, crash instead of sending a plain-text key.
CHECK(false);
« no previous file with comments | « chromeos/login/auth/key.h ('k') | chromeos/login/auth/key_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698