qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 2/3] crypto: avoid undefined behavior in nett


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH v3 2/3] crypto: avoid undefined behavior in nettle calls
Date: Fri, 17 Jul 2015 19:43:39 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Am 16.07.2015 um 18:04 hat Radim Krčmář geschrieben:
> Calling a function pointer that was cast from an incompatible function
> results in undefined behavior.  'void *' isn't compatible with 'struct
> XXX *', so we can't cast to nettle_cipher_func, but have to provide a
> wrapper.  (Conversion from 'void *' to 'struct XXX *' might require
> computation, which won't be done if we drop argument's true type and
> pointers can have different sizes so passing arguments on stack would
> bug.)
> 
> Having two different prototypes based on nettle version doesn't make
> this solution any nicer.
> 
> Reported-by: Peter Maydell <address@hidden>
> Signed-off-by: Radim Krčmář <address@hidden>

git bisect says that it's this commit which broke qemu-iotests 134.

> +static void aes_decrypt_wrapper(cipher_ctx_t ctx, cipher_length_t length,
> +                         uint8_t *dst, const uint8_t *src)
> +{
> +    aes_encrypt(ctx, length, dst, src);
> +}

And this is why (decrypt -> encrypt). I'll send a fix.

Kevin



reply via email to

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