summaryrefslogtreecommitdiffstats
path: root/sync
diff options
context:
space:
mode:
authorzea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-10 19:47:42 +0000
committerzea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-10 19:47:42 +0000
commit76e06bfa4c369635604468aa81e6e1594a79abf0 (patch)
treea001bd1f2b75b51587f384d5d86347d0f4b29460 /sync
parenta11e160f0ed1cdf1bd3b7bf658449109717a440b (diff)
downloadchromium_src-76e06bfa4c369635604468aa81e6e1594a79abf0.zip
chromium_src-76e06bfa4c369635604468aa81e6e1594a79abf0.tar.gz
chromium_src-76e06bfa4c369635604468aa81e6e1594a79abf0.tar.bz2
[Sync] Add password support to sync api
This change modifies the password protobuf definition and the sync generic change processor in order to support passwords custom encryption scheme. BUG=117445 Review URL: https://chromiumcodereview.appspot.com/18551007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210915 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync')
-rw-r--r--sync/engine/build_commit_command.cc1
-rw-r--r--sync/internal_api/write_node.cc1
-rw-r--r--sync/protocol/password_specifics.proto8
-rw-r--r--sync/syncable/mutable_entry.cc1
-rw-r--r--sync/test/fake_sync_encryption_handler.cc4
5 files changed, 12 insertions, 3 deletions
diff --git a/sync/engine/build_commit_command.cc b/sync/engine/build_commit_command.cc
index 0f16b80..a846cfd 100644
--- a/sync/engine/build_commit_command.cc
+++ b/sync/engine/build_commit_command.cc
@@ -104,6 +104,7 @@ void SetEntrySpecifics(Entry* meta_entry,
sync_entry->mutable_specifics()->CopyFrom(meta_entry->Get(SPECIFICS));
sync_entry->set_folder(meta_entry->Get(syncable::IS_DIR));
+ CHECK(!sync_entry->specifics().password().has_client_only_encrypted_data());
DCHECK_EQ(meta_entry->GetModelType(), GetModelType(*sync_entry));
}
} // namespace
diff --git a/sync/internal_api/write_node.cc b/sync/internal_api/write_node.cc
index 44a2a50..17a7fdb 100644
--- a/sync/internal_api/write_node.cc
+++ b/sync/internal_api/write_node.cc
@@ -225,6 +225,7 @@ void WriteNode::SetEntitySpecifics(
const sync_pb::EntitySpecifics& new_value) {
ModelType new_specifics_type =
GetModelTypeFromSpecifics(new_value);
+ CHECK(!new_value.password().has_client_only_encrypted_data());
DCHECK_NE(new_specifics_type, UNSPECIFIED);
DVLOG(1) << "Writing entity specifics of type "
<< ModelTypeToString(new_specifics_type);
diff --git a/sync/protocol/password_specifics.proto b/sync/protocol/password_specifics.proto
index 769914433..ad5a512 100644
--- a/sync/protocol/password_specifics.proto
+++ b/sync/protocol/password_specifics.proto
@@ -33,9 +33,13 @@ message PasswordSpecificsData {
optional bool blacklisted = 12;
}
-// Properties of password sync objects. The actual password data is held in a
-// PasswordSpecificsData that is encrypted into |encrypted|.
+// Properties of password sync objects.
message PasswordSpecifics {
+ // The actual password data. Contains an encrypted PasswordSpecificsData
+ // message.
optional EncryptedData encrypted = 1;
+ // An unsynced field for use internally on the client. This field should
+ // never be set in any network-based communications.
+ optional PasswordSpecificsData client_only_encrypted_data = 2;
}
diff --git a/sync/syncable/mutable_entry.cc b/sync/syncable/mutable_entry.cc
index 1d5524d..9562f31 100644
--- a/sync/syncable/mutable_entry.cc
+++ b/sync/syncable/mutable_entry.cc
@@ -261,6 +261,7 @@ bool MutableEntry::Put(StringField field, const string& value) {
bool MutableEntry::Put(ProtoField field,
const sync_pb::EntitySpecifics& value) {
DCHECK(kernel_);
+ CHECK(!value.password().has_client_only_encrypted_data());
write_transaction_->SaveOriginal(kernel_);
// TODO(ncarter): This is unfortunately heavyweight. Can we do
// better?
diff --git a/sync/test/fake_sync_encryption_handler.cc b/sync/test/fake_sync_encryption_handler.cc
index 1a83e55..3a60b07 100644
--- a/sync/test/fake_sync_encryption_handler.cc
+++ b/sync/test/fake_sync_encryption_handler.cc
@@ -18,7 +18,9 @@ FakeSyncEncryptionHandler::FakeSyncEncryptionHandler()
FakeSyncEncryptionHandler::~FakeSyncEncryptionHandler() {}
void FakeSyncEncryptionHandler::Init() {
- // Do nothing.
+ // Set up a basic cryptographer.
+ KeyParams keystore_params = {"localhost", "dummy", "keystore_key"};
+ cryptographer_.AddKey(keystore_params);
}
void FakeSyncEncryptionHandler::ApplyNigoriUpdate(