Commit cd722c54 authored by Mikel Astiz's avatar Mikel Astiz Committed by Commit Bot

Store sync directory entities unencrypted locally if pending keys

If the cryptographer initialized but has pending keys, the whole content
of the Directory will be reencrypted when pending keys gets resolved.
Hence, let's simplify the logic and store the data unencrypted
meanwhile.

Avoiding special-treatment for this case unblocks redesigning a simpler
cryptographer API.

Bug: 967417
Change-Id: Ib3894bb454dbe2a0d877e7c06e5186f59806d3d6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1819250Reviewed-by: default avatarMaksim Moskvitin <mmoskvitin@google.com>
Commit-Queue: Mikel Astiz <mastiz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#699265}
parent 6b81c48a
......@@ -169,10 +169,14 @@ bool UpdateEntryWithEncryption(BaseTransaction* const trans,
NOTREACHED() << "New specifics already has an encrypted blob.";
return false;
}
if ((!SpecificsNeedsEncryption(encrypted_types, new_specifics) &&
!was_encrypted) ||
!cryptographer || !cryptographer->is_initialized()) {
// No encryption required or we are unable to encrypt.
if (!SpecificsNeedsEncryption(encrypted_types, new_specifics) &&
!was_encrypted) {
// No encryption required.
generated_specifics.CopyFrom(new_specifics);
} else if (!cryptographer || !cryptographer->is_ready()) {
// We are currently unable to encrypt, so store unencrypted. The data will
// be reencrypted when the encryption key becomes available, via
// SyncEncryptionHandlerImpl::ReEncryptEverything().
generated_specifics.CopyFrom(new_specifics);
} else {
// Encrypt new_specifics into generated_specifics.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment