On Thu, Jul 16, 2015 at 06:04:00PM +0200, Radim Krčmář wrote:
> 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 <peter.mayd...@linaro.org>
> Signed-off-by: Radim Krčmář <rkrc...@redhat.com>
> ---
>  v3: make wrappers 'static'
>  v2: new [Peter]
> 
>  crypto/cipher-nettle.c | 43 +++++++++++++++++++++++++++++++++++++++----
>  1 file changed, 39 insertions(+), 4 deletions(-)

Reviewed-by: Daniel P. Berrange <berra...@redhat.com>

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

Reply via email to