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

Unified Diff: chrome/browser/sync/util/cryptographer.cc

Issue 7108067: [Sync] Ensure cryptographer ready before encrypting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years, 6 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 | « chrome/browser/sync/glue/sync_backend_host.cc ('k') | chrome/browser/sync/util/cryptographer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/util/cryptographer.cc
diff --git a/chrome/browser/sync/util/cryptographer.cc b/chrome/browser/sync/util/cryptographer.cc
index 01f7eb2a01a6ff99cda7142d26a65c6f9e099f57..7ee8c19ceff317f6ca79ef2665e037cd15e0a518 100644
--- a/chrome/browser/sync/util/cryptographer.cc
+++ b/chrome/browser/sync/util/cryptographer.cc
@@ -44,19 +44,21 @@ bool Cryptographer::CanDecryptUsingDefaultKey(
bool Cryptographer::Encrypt(const ::google::protobuf::MessageLite& message,
sync_pb::EncryptedData* encrypted) const {
- DCHECK(encrypted);
- DCHECK(default_nigori_);
+ if (!encrypted || !default_nigori_) {
+ LOG(ERROR) << "Cryptographer not ready, failed to encrypt.";
+ return false;
+ }
std::string serialized;
if (!message.SerializeToString(&serialized)) {
- NOTREACHED(); // |message| is invalid/missing a required field.
+ LOG(ERROR) << "Message is invalid/missing a required field.";
return false;
}
encrypted->set_key_name(default_nigori_->first);
if (!default_nigori_->second->Encrypt(serialized,
encrypted->mutable_blob())) {
- NOTREACHED(); // Encrypt should not fail.
+ LOG(ERROR) << "Failed to encrypt data.";
return false;
}
return true;
« no previous file with comments | « chrome/browser/sync/glue/sync_backend_host.cc ('k') | chrome/browser/sync/util/cryptographer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698