qemu-devel
[Top][All Lists]
Advanced

[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 :|




reply via email to

[Prev in Thread] Current Thread [Next in Thread]