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

Unified Diff: components/sync/base/nigori.cc

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 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 | « components/sync/base/nigori.h ('k') | components/sync/base/nigori_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/base/nigori.cc
diff --git a/sync/util/nigori.cc b/components/sync/base/nigori.cc
similarity index 93%
rename from sync/util/nigori.cc
rename to components/sync/base/nigori.cc
index 78ed2876e6537b0d08c8ae797fd2a497d7d370e8..20e75ca7cc79559cda8601c4ffa6c1600b7f2b77 100644
--- a/sync/util/nigori.cc
+++ b/components/sync/base/nigori.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 "sync/util/nigori.h"
+#include "components/sync/base/nigori.h"
#include <stdint.h>
@@ -50,9 +50,7 @@ class NigoriStream {
return *this;
}
- std::string str() {
- return stream_.str();
- }
+ std::string str() { return stream_.str(); }
private:
std::ostringstream stream_;
@@ -61,11 +59,9 @@ class NigoriStream {
// static
const char Nigori::kSaltSalt[] = "saltsalt";
-Nigori::Nigori() {
-}
+Nigori::Nigori() {}
-Nigori::~Nigori() {
-}
+Nigori::~Nigori() {}
bool Nigori::InitByDerivation(const std::string& hostname,
const std::string& username,
@@ -120,7 +116,8 @@ bool Nigori::InitByImport(const std::string& user_key,
}
// Permute[Kenc,Kmac](type || name)
-bool Nigori::Permute(Type type, const std::string& name,
+bool Nigori::Permute(Type type,
+ const std::string& name,
std::string* permuted) const {
DCHECK_LT(0U, name.size());
@@ -206,8 +203,8 @@ bool Nigori::Decrypt(const std::string& encrypted, std::string* value) const {
// * ciphertext (multiple of 16 bytes)
// * hash (32 bytes)
std::string iv(input.substr(0, kIvSize));
- std::string ciphertext(input.substr(kIvSize,
- input.size() - (kIvSize + kHashSize)));
+ std::string ciphertext(
+ input.substr(kIvSize, input.size() - (kIvSize + kHashSize)));
std::string hash(input.substr(input.size() - kHashSize, kHashSize));
std::string raw_mac_key;
@@ -222,8 +219,7 @@ bool Nigori::Decrypt(const std::string& encrypted, std::string* value) const {
if (!hmac.Sign(ciphertext, &expected[0], expected.size()))
return false;
- if (hash.compare(0, hash.size(),
- reinterpret_cast<char *>(&expected[0]),
+ if (hash.compare(0, hash.size(), reinterpret_cast<char*>(&expected[0]),
expected.size()))
return false;
@@ -245,8 +241,8 @@ bool Nigori::ExportKeys(std::string* user_key,
DCHECK(mac_key);
return user_key_->GetRawKey(user_key) &&
- encryption_key_->GetRawKey(encryption_key) &&
- mac_key_->GetRawKey(mac_key);
+ encryption_key_->GetRawKey(encryption_key) &&
+ mac_key_->GetRawKey(mac_key);
}
} // namespace syncer
« no previous file with comments | « components/sync/base/nigori.h ('k') | components/sync/base/nigori_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698