X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=CryptoPkg%2FInclude%2FOpenSslSupport.h;h=64bef42d0595c33f281834d6f9489116cc9c68d1;hp=33eda7dd50e1457c58bf8fb0be59b897a276e485;hb=3b21958bf2a3eca22a0e3af4001df441a317f24a;hpb=b7d320f8117ed2fffe001b1a0b7bfcd4f40fafc4 diff --git a/CryptoPkg/Include/OpenSslSupport.h b/CryptoPkg/Include/OpenSslSupport.h index 33eda7dd50..64bef42d05 100644 --- a/CryptoPkg/Include/OpenSslSupport.h +++ b/CryptoPkg/Include/OpenSslSupport.h @@ -1,7 +1,7 @@ /** @file Root include file to support building OpenSSL Crypto Library. -Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -21,6 +21,33 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include +#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 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 @@ -72,7 +99,7 @@ typedef VOID *FILE; portably, hence it is provided by a Standard C header file. For pre-Standard C compilers, here is a version that usually works (but watch out!): */ -#define offsetof(type, member) ( (int) & ((type*)0) -> member ) +#define offsetof(type, member) OFFSET_OF (type, member) // // Basic types from EFI Application Toolkit required to buiild Open SSL @@ -109,6 +136,11 @@ struct tm { char *tm_zone; /* timezone abbreviation */ }; +struct timeval { + long tv_sec; /* time value, in seconds */ + long tv_usec; /* time value, in microseconds */ +} timeval; + struct dirent { UINT32 d_fileno; /* file number of entry */ UINT16 d_reclen; /* length of this record */ @@ -231,14 +263,15 @@ extern FILE *stdout; #define memmove(dest,source,count) CopyMem(dest,source,(UINTN)(count)) #define strcmp AsciiStrCmp #define strncmp(string1,string2,count) (int)(AsciiStrnCmp(string1,string2,(UINTN)(count))) -#define strcpy(strDest,strSource) AsciiStrCpy(strDest,strSource) -#define strncpy(strDest,strSource,count) AsciiStrnCpy(strDest,strSource,(UINTN)count) -#define strlen(str) (size_t)(AsciiStrLen(str)) -#define strcat(strDest,strSource) AsciiStrCat(strDest,strSource) +#define strcpy(strDest,strSource) AsciiStrCpyS(strDest,MAX_STRING_SIZE,strSource) +#define strncpy(strDest,strSource,count) AsciiStrnCpyS(strDest,MAX_STRING_SIZE,strSource,(UINTN)count) +#define strlen(str) (size_t)(AsciiStrnLenS(str,MAX_STRING_SIZE)) +#define strcat(strDest,strSource) AsciiStrCatS(strDest,MAX_STRING_SIZE,strSource) #define strchr(str,ch) ScanMem8((VOID *)(str),AsciiStrSize(str),(UINT8)ch) #define abort() ASSERT (FALSE) #define assert(expression) #define localtime(timer) NULL #define gmtime_r(timer,result) (result = NULL) +#define atoi(nptr) AsciiStrDecimalToUintn(nptr) #endif