qemu/crypto
Radim Krčmář d3462e378f crypto: avoid undefined behavior in nettle calls
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.maydell@linaro.org>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Message-Id: <1437062641-12684-3-git-send-email-rkrcmar@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-07-16 20:00:21 +02:00
..
aes.c crypto: move built-in AES implementation into crypto/ 2015-07-07 12:04:13 +02:00
cipher-builtin.c crypto: fix builtin qcrypto_cipher_free 2015-07-09 16:53:45 +02:00
cipher-gcrypt.c crypto: add a gcrypt cipher implementation 2015-07-08 13:11:01 +02:00
cipher-nettle.c crypto: avoid undefined behavior in nettle calls 2015-07-16 20:00:21 +02:00
cipher.c crypto: add a nettle cipher implementation 2015-07-08 13:11:01 +02:00
desrfb.c crypto: move built-in D3DES implementation into crypto/ 2015-07-07 12:04:31 +02:00
hash.c crypto: introduce new module for computing hash digests 2015-07-07 12:04:07 +02:00
init.c crypto: add a gcrypt cipher implementation 2015-07-08 13:11:01 +02:00
Makefile.objs crypto: introduce generic cipher API & built-in implementation 2015-07-08 13:11:01 +02:00