06.12.2018 13:36, Daniel P. Berrangé wrote: > On Wed, Dec 05, 2018 at 05:46:57PM +0300, Vladimir Sementsov-Ogievskiy wrote: >> qcrypto_block_encrypt_helper and qcrypto_block_decrypt_helper are >> almost identical, let's reduce code duplication and simplify further >> improvements. >> >> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsement...@virtuozzo.com> >> --- >> crypto/block.c | 81 +++++++++++++++++++------------------------------- >> 1 file changed, 31 insertions(+), 50 deletions(-) >> >> diff --git a/crypto/block.c b/crypto/block.c >> index e59d1140fe..f4101f0841 100644 >> --- a/crypto/block.c >> +++ b/crypto/block.c >> @@ -190,14 +190,21 @@ void qcrypto_block_free(QCryptoBlock *block) >> } >> >> >> -int qcrypto_block_decrypt_helper(QCryptoCipher *cipher, >> - size_t niv, >> - QCryptoIVGen *ivgen, >> - int sectorsize, >> - uint64_t offset, >> - uint8_t *buf, >> - size_t len, >> - Error **errp) >> +typedef int (*QCryptoCipherEncryptFunc)(QCryptoCipher *cipher, >> + const void *in, >> + void *out, >> + size_t len, >> + Error **errp); >> + >> +static int do_qcrypto_block_encrypt(QCryptoCipher *cipher, > > Can we call this functuon 'encdec', since it is misleading to call > it just 'encrypt' when its used for decrypt too.
Maybe just _crypt ?) -- Best regards, Vladimir