crypto/block: rename qcrypto_block_*crypt_helper
Rename qcrypto_block_*crypt_helper to qcrypto_block_cipher_*crypt_helper, as it's not about QCryptoBlock. This is needed to introduce qcrypto_block_*crypt_helper in the next commit, which will have QCryptoBlock pointer and than will be able to use additional fields of it, which in turn will be used to implement thread-safe QCryptoBlock 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
1dc57b6038
commit
0270417c87
@ -504,7 +504,7 @@ qcrypto_block_luks_load_key(QCryptoBlock *block,
|
|||||||
* to reset the encryption cipher every time the master
|
* to reset the encryption cipher every time the master
|
||||||
* key crosses a sector boundary.
|
* key crosses a sector boundary.
|
||||||
*/
|
*/
|
||||||
if (qcrypto_block_decrypt_helper(cipher,
|
if (qcrypto_block_cipher_decrypt_helper(cipher,
|
||||||
niv,
|
niv,
|
||||||
ivgen,
|
ivgen,
|
||||||
QCRYPTO_BLOCK_LUKS_SECTOR_SIZE,
|
QCRYPTO_BLOCK_LUKS_SECTOR_SIZE,
|
||||||
@ -1219,7 +1219,7 @@ qcrypto_block_luks_create(QCryptoBlock *block,
|
|||||||
|
|
||||||
/* Now we encrypt the split master key with the key generated
|
/* Now we encrypt the split master key with the key generated
|
||||||
* from the user's password, before storing it */
|
* from the user's password, before storing it */
|
||||||
if (qcrypto_block_encrypt_helper(cipher, block->niv, ivgen,
|
if (qcrypto_block_cipher_encrypt_helper(cipher, block->niv, ivgen,
|
||||||
QCRYPTO_BLOCK_LUKS_SECTOR_SIZE,
|
QCRYPTO_BLOCK_LUKS_SECTOR_SIZE,
|
||||||
0,
|
0,
|
||||||
splitkey,
|
splitkey,
|
||||||
@ -1409,7 +1409,7 @@ qcrypto_block_luks_decrypt(QCryptoBlock *block,
|
|||||||
{
|
{
|
||||||
assert(QEMU_IS_ALIGNED(offset, QCRYPTO_BLOCK_LUKS_SECTOR_SIZE));
|
assert(QEMU_IS_ALIGNED(offset, QCRYPTO_BLOCK_LUKS_SECTOR_SIZE));
|
||||||
assert(QEMU_IS_ALIGNED(len, QCRYPTO_BLOCK_LUKS_SECTOR_SIZE));
|
assert(QEMU_IS_ALIGNED(len, QCRYPTO_BLOCK_LUKS_SECTOR_SIZE));
|
||||||
return qcrypto_block_decrypt_helper(block->cipher,
|
return qcrypto_block_cipher_decrypt_helper(block->cipher,
|
||||||
block->niv, block->ivgen,
|
block->niv, block->ivgen,
|
||||||
QCRYPTO_BLOCK_LUKS_SECTOR_SIZE,
|
QCRYPTO_BLOCK_LUKS_SECTOR_SIZE,
|
||||||
offset, buf, len, errp);
|
offset, buf, len, errp);
|
||||||
@ -1425,7 +1425,7 @@ qcrypto_block_luks_encrypt(QCryptoBlock *block,
|
|||||||
{
|
{
|
||||||
assert(QEMU_IS_ALIGNED(offset, QCRYPTO_BLOCK_LUKS_SECTOR_SIZE));
|
assert(QEMU_IS_ALIGNED(offset, QCRYPTO_BLOCK_LUKS_SECTOR_SIZE));
|
||||||
assert(QEMU_IS_ALIGNED(len, QCRYPTO_BLOCK_LUKS_SECTOR_SIZE));
|
assert(QEMU_IS_ALIGNED(len, QCRYPTO_BLOCK_LUKS_SECTOR_SIZE));
|
||||||
return qcrypto_block_encrypt_helper(block->cipher,
|
return qcrypto_block_cipher_encrypt_helper(block->cipher,
|
||||||
block->niv, block->ivgen,
|
block->niv, block->ivgen,
|
||||||
QCRYPTO_BLOCK_LUKS_SECTOR_SIZE,
|
QCRYPTO_BLOCK_LUKS_SECTOR_SIZE,
|
||||||
offset, buf, len, errp);
|
offset, buf, len, errp);
|
||||||
|
@ -152,7 +152,7 @@ qcrypto_block_qcow_decrypt(QCryptoBlock *block,
|
|||||||
{
|
{
|
||||||
assert(QEMU_IS_ALIGNED(offset, QCRYPTO_BLOCK_QCOW_SECTOR_SIZE));
|
assert(QEMU_IS_ALIGNED(offset, QCRYPTO_BLOCK_QCOW_SECTOR_SIZE));
|
||||||
assert(QEMU_IS_ALIGNED(len, QCRYPTO_BLOCK_QCOW_SECTOR_SIZE));
|
assert(QEMU_IS_ALIGNED(len, QCRYPTO_BLOCK_QCOW_SECTOR_SIZE));
|
||||||
return qcrypto_block_decrypt_helper(block->cipher,
|
return qcrypto_block_cipher_decrypt_helper(block->cipher,
|
||||||
block->niv, block->ivgen,
|
block->niv, block->ivgen,
|
||||||
QCRYPTO_BLOCK_QCOW_SECTOR_SIZE,
|
QCRYPTO_BLOCK_QCOW_SECTOR_SIZE,
|
||||||
offset, buf, len, errp);
|
offset, buf, len, errp);
|
||||||
@ -168,7 +168,7 @@ qcrypto_block_qcow_encrypt(QCryptoBlock *block,
|
|||||||
{
|
{
|
||||||
assert(QEMU_IS_ALIGNED(offset, QCRYPTO_BLOCK_QCOW_SECTOR_SIZE));
|
assert(QEMU_IS_ALIGNED(offset, QCRYPTO_BLOCK_QCOW_SECTOR_SIZE));
|
||||||
assert(QEMU_IS_ALIGNED(len, QCRYPTO_BLOCK_QCOW_SECTOR_SIZE));
|
assert(QEMU_IS_ALIGNED(len, QCRYPTO_BLOCK_QCOW_SECTOR_SIZE));
|
||||||
return qcrypto_block_encrypt_helper(block->cipher,
|
return qcrypto_block_cipher_encrypt_helper(block->cipher,
|
||||||
block->niv, block->ivgen,
|
block->niv, block->ivgen,
|
||||||
QCRYPTO_BLOCK_QCOW_SECTOR_SIZE,
|
QCRYPTO_BLOCK_QCOW_SECTOR_SIZE,
|
||||||
offset, buf, len, errp);
|
offset, buf, len, errp);
|
||||||
|
@ -196,7 +196,7 @@ typedef int (*QCryptoCipherEncDecFunc)(QCryptoCipher *cipher,
|
|||||||
size_t len,
|
size_t len,
|
||||||
Error **errp);
|
Error **errp);
|
||||||
|
|
||||||
static int do_qcrypto_block_encdec(QCryptoCipher *cipher,
|
static int do_qcrypto_block_cipher_encdec(QCryptoCipher *cipher,
|
||||||
size_t niv,
|
size_t niv,
|
||||||
QCryptoIVGen *ivgen,
|
QCryptoIVGen *ivgen,
|
||||||
int sectorsize,
|
int sectorsize,
|
||||||
@ -249,7 +249,7 @@ static int do_qcrypto_block_encdec(QCryptoCipher *cipher,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int qcrypto_block_decrypt_helper(QCryptoCipher *cipher,
|
int qcrypto_block_cipher_decrypt_helper(QCryptoCipher *cipher,
|
||||||
size_t niv,
|
size_t niv,
|
||||||
QCryptoIVGen *ivgen,
|
QCryptoIVGen *ivgen,
|
||||||
int sectorsize,
|
int sectorsize,
|
||||||
@ -258,12 +258,13 @@ int qcrypto_block_decrypt_helper(QCryptoCipher *cipher,
|
|||||||
size_t len,
|
size_t len,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
return do_qcrypto_block_encdec(cipher, niv, ivgen, sectorsize, offset,
|
return do_qcrypto_block_cipher_encdec(cipher, niv, ivgen, sectorsize,
|
||||||
buf, len, qcrypto_cipher_decrypt, errp);
|
offset, buf, len,
|
||||||
|
qcrypto_cipher_decrypt, errp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int qcrypto_block_encrypt_helper(QCryptoCipher *cipher,
|
int qcrypto_block_cipher_encrypt_helper(QCryptoCipher *cipher,
|
||||||
size_t niv,
|
size_t niv,
|
||||||
QCryptoIVGen *ivgen,
|
QCryptoIVGen *ivgen,
|
||||||
int sectorsize,
|
int sectorsize,
|
||||||
@ -272,6 +273,7 @@ int qcrypto_block_encrypt_helper(QCryptoCipher *cipher,
|
|||||||
size_t len,
|
size_t len,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
return do_qcrypto_block_encdec(cipher, niv, ivgen, sectorsize, offset,
|
return do_qcrypto_block_cipher_encdec(cipher, niv, ivgen, sectorsize,
|
||||||
buf, len, qcrypto_cipher_encrypt, errp);
|
offset, buf, len,
|
||||||
|
qcrypto_cipher_encrypt, errp);
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ struct QCryptoBlockDriver {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
int qcrypto_block_decrypt_helper(QCryptoCipher *cipher,
|
int qcrypto_block_cipher_decrypt_helper(QCryptoCipher *cipher,
|
||||||
size_t niv,
|
size_t niv,
|
||||||
QCryptoIVGen *ivgen,
|
QCryptoIVGen *ivgen,
|
||||||
int sectorsize,
|
int sectorsize,
|
||||||
@ -87,7 +87,7 @@ int qcrypto_block_decrypt_helper(QCryptoCipher *cipher,
|
|||||||
size_t len,
|
size_t len,
|
||||||
Error **errp);
|
Error **errp);
|
||||||
|
|
||||||
int qcrypto_block_encrypt_helper(QCryptoCipher *cipher,
|
int qcrypto_block_cipher_encrypt_helper(QCryptoCipher *cipher,
|
||||||
size_t niv,
|
size_t niv,
|
||||||
QCryptoIVGen *ivgen,
|
QCryptoIVGen *ivgen,
|
||||||
int sectorsize,
|
int sectorsize,
|
||||||
|
Loading…
Reference in New Issue
Block a user