From: "Daniel P. Berrange" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Mike Frysinger <vapier@chromium.org>,
"Daniel P. Berrange" <berrange@redhat.com>
Subject: [Qemu-devel] [PULL v1 4/4] crypto: aes: always rename internal symbols
Date: Mon, 13 Jun 2016 12:45:37 +0100 [thread overview]
Message-ID: <1465818337-30627-5-git-send-email-berrange@redhat.com> (raw)
In-Reply-To: <1465818337-30627-1-git-send-email-berrange@redhat.com>
From: Mike Frysinger <vapier@chromium.org>
OpenSSL's libcrypto always defines AES symbols with the same names as
qemu's local aes code. This is problematic when enabling at least curl
as that frequently also uses libcrypto. It might not be noticed when
running, but if you try to statically link, everything falls down.
An example snippet:
LINK qemu-nbd
.../libcrypto.a(aes-x86_64.o): In function 'AES_encrypt':
(.text+0x460): multiple definition of 'AES_encrypt'
crypto/aes.o:aes.c:(.text+0x670): first defined here
.../libcrypto.a(aes-x86_64.o): In function 'AES_decrypt':
(.text+0x9f0): multiple definition of 'AES_decrypt'
crypto/aes.o:aes.c:(.text+0xb30): first defined here
.../libcrypto.a(aes-x86_64.o): In function 'AES_cbc_encrypt':
(.text+0xf90): multiple definition of 'AES_cbc_encrypt'
crypto/aes.o:aes.c:(.text+0xff0): first defined here
collect2: error: ld returned 1 exit status
.../qemu-2.6.0/rules.mak:105: recipe for target 'qemu-nbd' failed
make: *** [qemu-nbd] Error 1
The aes.h header has redefines already for FreeBSD, but go ahead and
enable that for everyone since there's no real good reason to not use
a namespace all the time.
Signed-off-by: Mike Frysinger <vapier@chromium.org>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
---
include/crypto/aes.h | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/include/crypto/aes.h b/include/crypto/aes.h
index a006da2..12fb321 100644
--- a/include/crypto/aes.h
+++ b/include/crypto/aes.h
@@ -10,14 +10,13 @@ struct aes_key_st {
};
typedef struct aes_key_st AES_KEY;
-/* FreeBSD has its own AES_set_decrypt_key in -lcrypto, avoid conflicts */
-#ifdef __FreeBSD__
+/* FreeBSD/OpenSSL have their own AES functions with the same names in -lcrypto
+ * (which might be pulled in via curl), so redefine to avoid conflicts. */
#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
int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
AES_KEY *key);
--
2.5.5
next prev parent reply other threads:[~2016-06-13 11:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-13 11:45 [Qemu-devel] [PULL v1 0/4] Merge qcrypto-next 2016/06/13 Daniel P. Berrange
2016-06-13 11:45 ` [Qemu-devel] [PULL v1 1/4] TLS: provide slightly more information when TLS certificate loading fails Daniel P. Berrange
2016-06-13 11:45 ` [Qemu-devel] [PULL v1 2/4] crypto: remove temp files on completion of secrets test Daniel P. Berrange
2016-06-13 11:45 ` [Qemu-devel] [PULL v1 3/4] crypto: assert that qcrypto_hash_digest_len is in range Daniel P. Berrange
2016-06-13 11:45 ` Daniel P. Berrange [this message]
2016-06-13 13:20 ` [Qemu-devel] [PULL v1 0/4] Merge qcrypto-next 2016/06/13 Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1465818337-30627-5-git-send-email-berrange@redhat.com \
--to=berrange@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=vapier@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).