diff options
author | Radim Krčmář <rkrcmar@redhat.com> | 2015-07-10 19:18:01 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2015-07-16 20:00:21 +0200 |
commit | d3462e378f40ba6838b6c42584c30769ca633e6f (patch) | |
tree | 6c07f65460414fb2c9343fe6eb3ac4ed8bc66256 /target-mips/machine.c | |
parent | becaeb726ae7da4212a788773ebdfe87b4833f5c (diff) |
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>
Diffstat (limited to 'target-mips/machine.c')
0 files changed, 0 insertions, 0 deletions