CryptoPkg: Fix OpenSSL BN wordsize and OPENSSL_SYS_UEFI handling
We were manually setting -DSIXTY_FOUR_BIT_LONG or -DTHIRTY_TWO_BIT on the compiler command line when building OpensslLib itself, but not when building BaseCryptLib. But when building BaseCryptLib, we weren't setting OPENSSL_SYS_UEFI *either*. This meant that *that* build was picking up the definition from <openssl/opensslconf.h>, and was thus *different* to the version the library was built with, in some cases. So set OPENSSL_SYS_UEFI consistently in OpensslSupport.h and *also* define either SIXTY_FOUR_BIT or THIRTY_TWO_BIT there too. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Tested-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Qin Long <qin.long@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18706 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -23,6 +23,31 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
#define MAX_STRING_SIZE 0x1000
|
||||
|
||||
//
|
||||
// OpenSSL relies on explicit configuration for word size in crypto/bn,
|
||||
// but we want it to be automatically inferred from the target. So we
|
||||
// bypass what's in <openssl/opensslconf.h> for OPENSSL_SYS_UEFI, and
|
||||
// define our own here.
|
||||
//
|
||||
#ifdef CONFIG_HEADER_BN_H
|
||||
#error CONFIG_HEADER_BN_H already defined
|
||||
#endif
|
||||
|
||||
#define CONFIG_HEADER_BN_H
|
||||
|
||||
#if defined(MDE_CPU_X64) || defined(MDE_CPU_AARCH64) || defined(MDE_CPU_IA64)
|
||||
//
|
||||
// With GCC we would normally use SIXTY_FOUR_BIT_LONG, but MSVC needs
|
||||
// SIXTY_FOUR_BIT, because 'long' is 32-bit and only 'long long' is
|
||||
// 64-bit. Since using 'long long' works fine on GCC too, just do that.
|
||||
//
|
||||
#define SIXTY_FOUR_BIT
|
||||
#elif defined(MDE_CPU_IA32) || defined(MDE_CPU_ARM) || defined(MDE_CPU_EBC)
|
||||
#define THIRTY_TWO_BIT
|
||||
#else
|
||||
#error Unknown target architecture
|
||||
#endif
|
||||
|
||||
//
|
||||
// File operations are not required for building Open SSL,
|
||||
// so FILE is mapped to VOID * to pass build
|
||||
|
Reference in New Issue
Block a user