Fix ciphering of partial blocks.

This commit is contained in:
Vitaly Baranov 2021-07-12 23:15:58 +03:00
parent 0f9ace257f
commit 767f1352eb

View File

@ -151,7 +151,7 @@ public:
throw DB::Exception("Expected key with size " + std::to_string(CipherKeyLength(evp_cipher)) + ", got iv with size " + std::to_string(key_.Size()), throw DB::Exception("Expected key with size " + std::to_string(CipherKeyLength(evp_cipher)) + ", got iv with size " + std::to_string(key_.Size()),
DB::ErrorCodes::DATA_ENCRYPTION_ERROR); DB::ErrorCodes::DATA_ENCRYPTION_ERROR);
offset = BlockOffset(offset_); offset = offset_;
} }
protected: protected:
@ -202,7 +202,6 @@ public:
buf.write(EncryptPartialBlock(plaintext, part_size, iv, off).data(), part_size); buf.write(EncryptPartialBlock(plaintext, part_size, iv, off).data(), part_size);
offset += part_size; offset += part_size;
size -= part_size; size -= part_size;
plaintext += part_size;
iv.Inc(); iv.Inc();
} }