On Jan 27, 2014, at 2:07 PM, Peter Maydell <peter.mayd...@linaro.org> wrote:
> On 17 December 2013 11:52, Stacey Son <s...@freebsd.org> wrote: >> FreeBSD has it's own AES_set_decrypt_key, etc. in libcrypto. This >> change fixes these conflicts and allows statically linking BSD >> user mode qemu. >> --- >> include/qemu/aes.h | 9 +++++++++ >> 1 files changed, 9 insertions(+), 0 deletions(-) >> >> diff --git a/include/qemu/aes.h b/include/qemu/aes.h >> index e79c707..6d253a3 100644 >> --- a/include/qemu/aes.h >> +++ b/include/qemu/aes.h >> @@ -10,6 +10,15 @@ struct aes_key_st { >> }; >> typedef struct aes_key_st AES_KEY; >> >> +/* FreeBSD has it's own AES_set_decrypt_key in -lcrypto, avoid conflicts. */ >> +#ifdef __FreeBSD__ >> +#define AES_set_encrypt_key QEMU_AES_set_encrypt_key >> +#define AES_set_decrypt_key QEMU_AES_set_decrypt_key >> +#define AES_encrypt QEMU_AES_encrypt >> +#define AES_decrypt QEMU_AES_decrypt >> +#define AES_cbc_encrypt QEMU_AES_cbc_encrypt >> +#endif > > You never answered Paolo's question about this patch, I think: > "What is the error? Do the functions have different signatures > or semantics between QEMU and FreeBSD?" > > If we need to resolve a clash, maybe we should just rename > the QEMU versions. Paolo? I must have missed Paolo's question. The linker error (during a static build of qemu bsd-user)... /usr/lib/libcrypto.a(aes-x86_64.o): In function `asm_AES_cbc_encrypt': (.text+0xfa0): multiple definition of `AES_cbc_encrypt' libqemuutil.a(aes.o):/home/sson/src/qemu/util/aes.c:1263: first defined here /usr/lib/libcrypto.a(aes-x86_64.o): In function `asm_AES_decrypt': (.text+0x9f0): multiple definition of `AES_decrypt' libqemuutil.a(aes.o):/home/sson/src/qemu/util/aes.c:1072: first defined here /usr/lib/libcrypto.a(aes-x86_64.o): In function `asm_AES_encrypt': (.text+0x460): multiple definition of `AES_encrypt' -stacey.