Re: [Qemu-devel] [PATCH v3 5/5] crypto: support multiple threads accessing one QCryptoBlock

2018-12-10 Thread Alberto Garcia
On Mon 10 Dec 2018 04:16:48 PM CET, Daniel P. Berrangé wrote: >> In other words, the cleanup code won't touch uninitialized elements >> because it cannot even tell the difference between an index that >> points to an uninitialized element of the array and an index that >> points beyond the allocate

Re: [Qemu-devel] [PATCH v3 5/5] crypto: support multiple threads accessing one QCryptoBlock

2018-12-10 Thread Daniel P . Berrangé
On Mon, Dec 10, 2018 at 04:09:31PM +0100, Alberto Garcia wrote: > On Mon 10 Dec 2018 03:52:03 PM CET, Daniel P. Berrangé wrote: > >> > +int qcrypto_block_init_cipher(QCryptoBlock *block, > >> > + QCryptoCipherAlgorithm alg, > >> > + QCryptoC

Re: [Qemu-devel] [PATCH v3 5/5] crypto: support multiple threads accessing one QCryptoBlock

2018-12-10 Thread Alberto Garcia
On Mon 10 Dec 2018 03:52:03 PM CET, Daniel P. Berrangé wrote: >> > +int qcrypto_block_init_cipher(QCryptoBlock *block, >> > + QCryptoCipherAlgorithm alg, >> > + QCryptoCipherMode mode, >> > + const uint8_t *key,

Re: [Qemu-devel] [PATCH v3 5/5] crypto: support multiple threads accessing one QCryptoBlock

2018-12-10 Thread Daniel P . Berrangé
On Mon, Dec 10, 2018 at 03:06:59PM +0100, Alberto Garcia wrote: > On Fri 07 Dec 2018 05:13:51 PM CET, Vladimir Sementsov-Ogievskiy wrote: > > @@ -148,12 +154,97 @@ int qcrypto_block_encrypt(QCryptoBlock *block, > > > > QCryptoCipher *qcrypto_block_get_cipher(QCryptoBlock *block) > > { > > -

Re: [Qemu-devel] [PATCH v3 5/5] crypto: support multiple threads accessing one QCryptoBlock

2018-12-10 Thread Alberto Garcia
On Fri 07 Dec 2018 05:13:51 PM CET, Vladimir Sementsov-Ogievskiy wrote: > @@ -148,12 +154,97 @@ int qcrypto_block_encrypt(QCryptoBlock *block, > > QCryptoCipher *qcrypto_block_get_cipher(QCryptoBlock *block) > { > -return block->cipher; > +/* Ciphers should be accessed through pop/push

[Qemu-devel] [PATCH v3 5/5] crypto: support multiple threads accessing one QCryptoBlock

2018-12-07 Thread Vladimir Sementsov-Ogievskiy
The two thing that should be handled are cipher and ivgen. For ivgen the solution is just mutex, as iv calculations should not be long in comparison with encryption/decryption. And for cipher let's just keep per-thread ciphers. Signed-off-by: Vladimir Sementsov-Ogievskiy --- crypto/blockpriv.h