diff options
author | Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | 2018-12-07 19:13:50 +0300 |
---|---|---|
committer | Daniel P. Berrangé <berrange@redhat.com> | 2018-12-12 11:16:49 +0000 |
commit | 0f0d596cb16a43314c8bc4a9afa2f966203fb05f (patch) | |
tree | e8ea8ed66f59c74dc717ee8b34fc019b9a3085f0 /crypto/block-luks.c | |
parent | 0270417c87d330243eb713a3312ea5e39e192994 (diff) |
crypto/block: introduce qcrypto_block_*crypt_helper functions
Introduce QCryptoBlock-based functions and use them where possible.
This is needed to implement thread-safe encrypt/decrypt operations.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'crypto/block-luks.c')
-rw-r--r-- | crypto/block-luks.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/crypto/block-luks.c b/crypto/block-luks.c index 353a400595..e486e7ee94 100644 --- a/crypto/block-luks.c +++ b/crypto/block-luks.c @@ -1409,10 +1409,9 @@ qcrypto_block_luks_decrypt(QCryptoBlock *block, { assert(QEMU_IS_ALIGNED(offset, QCRYPTO_BLOCK_LUKS_SECTOR_SIZE)); assert(QEMU_IS_ALIGNED(len, QCRYPTO_BLOCK_LUKS_SECTOR_SIZE)); - return qcrypto_block_cipher_decrypt_helper(block->cipher, - block->niv, block->ivgen, - QCRYPTO_BLOCK_LUKS_SECTOR_SIZE, - offset, buf, len, errp); + return qcrypto_block_decrypt_helper(block, + QCRYPTO_BLOCK_LUKS_SECTOR_SIZE, + offset, buf, len, errp); } @@ -1425,10 +1424,9 @@ qcrypto_block_luks_encrypt(QCryptoBlock *block, { assert(QEMU_IS_ALIGNED(offset, QCRYPTO_BLOCK_LUKS_SECTOR_SIZE)); assert(QEMU_IS_ALIGNED(len, QCRYPTO_BLOCK_LUKS_SECTOR_SIZE)); - return qcrypto_block_cipher_encrypt_helper(block->cipher, - block->niv, block->ivgen, - QCRYPTO_BLOCK_LUKS_SECTOR_SIZE, - offset, buf, len, errp); + return qcrypto_block_encrypt_helper(block, + QCRYPTO_BLOCK_LUKS_SECTOR_SIZE, + offset, buf, len, errp); } |