mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
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>
This commit is contained in:
parent
0270417c87
commit
0f0d596cb1
4 changed files with 54 additions and 16 deletions
|
@ -277,3 +277,31 @@ int qcrypto_block_cipher_encrypt_helper(QCryptoCipher *cipher,
|
|||
offset, buf, len,
|
||||
qcrypto_cipher_encrypt, errp);
|
||||
}
|
||||
|
||||
|
||||
int qcrypto_block_decrypt_helper(QCryptoBlock *block,
|
||||
int sectorsize,
|
||||
uint64_t offset,
|
||||
uint8_t *buf,
|
||||
size_t len,
|
||||
Error **errp)
|
||||
{
|
||||
return do_qcrypto_block_cipher_encdec(block->cipher, block->niv,
|
||||
block->ivgen,
|
||||
sectorsize, offset, buf, len,
|
||||
qcrypto_cipher_decrypt, errp);
|
||||
}
|
||||
|
||||
|
||||
int qcrypto_block_encrypt_helper(QCryptoBlock *block,
|
||||
int sectorsize,
|
||||
uint64_t offset,
|
||||
uint8_t *buf,
|
||||
size_t len,
|
||||
Error **errp)
|
||||
{
|
||||
return do_qcrypto_block_cipher_encdec(block->cipher, block->niv,
|
||||
block->ivgen,
|
||||
sectorsize, offset, buf, len,
|
||||
qcrypto_cipher_encrypt, errp);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue