diff options
author | Daniel P. Berrange | 2017-06-23 18:24:09 +0200 |
---|---|---|
committer | Max Reitz | 2017-07-11 17:44:56 +0200 |
commit | 446d306d23c8b568affec104d74f84f48d5eaa24 (patch) | |
tree | 3c9ee21b370901005a9bdf35fd92f3281f803300 /block/qcow2.c | |
parent | qcow: convert QCow to use QCryptoBlock for encryption (diff) | |
download | qemu-446d306d23c8b568affec104d74f84f48d5eaa24.tar.gz qemu-446d306d23c8b568affec104d74f84f48d5eaa24.tar.xz qemu-446d306d23c8b568affec104d74f84f48d5eaa24.zip |
qcow2: make qcow2_encrypt_sectors encrypt in place
Instead of requiring separate input/output buffers for
encrypting data, change qcow2_encrypt_sectors() to assume
use of a single buffer, encrypting in place. The current
callers all used the same buffer for input/output already.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-id: 20170623162419.26068-11-berrange@redhat.com
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block/qcow2.c')
-rw-r--r-- | block/qcow2.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/block/qcow2.c b/block/qcow2.c index 8f1822c195..df9caa8773 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1543,7 +1543,7 @@ static coroutine_fn int qcow2_co_preadv(BlockDriverState *bs, uint64_t offset, assert((cur_bytes & (BDRV_SECTOR_SIZE - 1)) == 0); Error *err = NULL; if (qcow2_encrypt_sectors(s, offset >> BDRV_SECTOR_BITS, - cluster_data, cluster_data, + cluster_data, cur_bytes >> BDRV_SECTOR_BITS, false, &err) < 0) { error_free(err); @@ -1677,7 +1677,7 @@ static coroutine_fn int qcow2_co_pwritev(BlockDriverState *bs, uint64_t offset, qemu_iovec_to_buf(&hd_qiov, 0, cluster_data, hd_qiov.size); if (qcow2_encrypt_sectors(s, offset >> BDRV_SECTOR_BITS, - cluster_data, cluster_data, + cluster_data, cur_bytes >>BDRV_SECTOR_BITS, true, &err) < 0) { error_free(err); |