Re: [Qemu-devel] [PATCH v2 2/3] crypto: avoid undefined behavior in nettle calls

2015-07-11 Thread Radim Krčmář
2015-07-10 19:18+0200, Radim Krčmář: > diff --git a/crypto/cipher-nettle.c b/crypto/cipher-nettle.c > +void aes_encrypt_wrapper(cipher_ctx_t ctx, cipher_length_t length, > + uint8_t *dst, const uint8_t *src) Wrappers should be static (rushed posting). I'll send v3 on Wed/T

[Qemu-devel] [PATCH v2 2/3] crypto: avoid undefined behavior in nettle calls

2015-07-10 Thread Radim Krčmář
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