[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 17/17] crypto/gcrypt: Split QCryptoCipherGcrypt into subclass
From: |
Daniel P . Berrangé |
Subject: |
Re: [PATCH 17/17] crypto/gcrypt: Split QCryptoCipherGcrypt into subclasses |
Date: |
Fri, 28 Aug 2020 14:52:58 +0100 |
User-agent: |
Mutt/1.14.6 (2020-07-11) |
On Wed, Aug 12, 2020 at 08:25:37PM -0700, Richard Henderson wrote:
> With gcrypt, most of the dispatch happens in the library,
> so there aren't many classes to create. However, we can
> still create separate dispatch for CTR mode, and for
> CONFIG_QEMU_PRIVATE_XTS, which avoids needing to check
> for these modes at runtime.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> crypto/cipher-gcrypt.inc.c | 512 ++++++++++++++++++-------------------
> 1 file changed, 250 insertions(+), 262 deletions(-)
>
> diff --git a/crypto/cipher-gcrypt.inc.c b/crypto/cipher-gcrypt.inc.c
> index 7a1fbc9745..1f9d08a7fa 100644
> --- a/crypto/cipher-gcrypt.inc.c
> +++ b/crypto/cipher-gcrypt.inc.c
> @@ -24,8 +24,6 @@
>
>
> - error:
> - qcrypto_gcrypt_cipher_free_ctx(ctx, mode);
> + error3:
> +#ifdef CONFIG_QEMU_PRIVATE_XTS
> + gcry_cipher_close(ctx->tweakhandle);
> + error2:
> +#endif
> + gcry_cipher_close(ctx->handle);
> + error1:
> + g_free(ctx);
gcry_cipher_close is a no-op if the handle is NULL, so I don't
think we need to have a chain of jump targets, just a single
"error:".
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
- Re: [PATCH 12/17] crypto/builtin: Merge qcrypto_cipher_aes_{ecb, xts}_{en, de}crypt, (continued)
- [PATCH 13/17] crypto/builtin: Move AES_cbc_encrypt into cipher-builtin.inc.c, Richard Henderson, 2020/08/12
- [PATCH 14/17] crypto/builtin: Split and simplify AES_encrypt_cbc, Richard Henderson, 2020/08/12
- [PATCH 15/17] crypto/builtin: Split QCryptoCipherBuiltin into subclasses, Richard Henderson, 2020/08/12
- [PATCH 17/17] crypto/gcrypt: Split QCryptoCipherGcrypt into subclasses, Richard Henderson, 2020/08/12
- Re: [PATCH 17/17] crypto/gcrypt: Split QCryptoCipherGcrypt into subclasses,
Daniel P . Berrangé <=
- [PATCH 16/17] crypto/nettle: Split QCryptoCipherNettle into subclasses, Richard Henderson, 2020/08/12
- Re: [PATCH 00/17] crypto/cipher: Class hierarchy cleanups, Philippe Mathieu-Daudé, 2020/08/13
- Re: [PATCH 00/17] crypto/cipher: Class hierarchy cleanups, no-reply, 2020/08/13
- Re: [PATCH 00/17] crypto/cipher: Class hierarchy cleanups, no-reply, 2020/08/13
- Re: [PATCH 00/17] crypto/cipher: Class hierarchy cleanups, Daniel P . Berrangé, 2020/08/17