]> git.proxmox.com Git - mirror_edk2.git/blame - CryptoPkg/Include/OpenSslSupport.h
Use SmmStatusCode protocol in EfiInitializeSmmDriverLib() funciton.
[mirror_edk2.git] / CryptoPkg / Include / OpenSslSupport.h
CommitLineData
97f98500
HT
1/** @file\r
2 Root include file to support building OpenSSL Crypto Library.\r
3\r
4Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
5This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#ifndef __OPEN_SSL_SUPPORT_H__\r
16#define __OPEN_SSL_SUPPORT_H__\r
17\r
18#include <Base.h>\r
19#include <Library/BaseLib.h>\r
20#include <Library/BaseMemoryLib.h>\r
21#include <Library/MemoryAllocationLib.h>\r
22#include <Library/DebugLib.h>\r
23\r
24//\r
25// File operations are not required for building Open SSL, \r
26// so FILE is mapped to VOID * to pass build\r
27//\r
28typedef VOID *FILE;\r
29\r
30//\r
31// Map all va_xxxx elements to VA_xxx defined in MdePkg/Include/Base.h\r
32//\r
33#define va_list VA_LIST\r
34#define va_arg VA_ARG\r
35#define va_start VA_START\r
36#define va_end VA_END\r
37\r
38//\r
39// #defines from EFI Application Toolkit required to buiild Open SSL\r
40//\r
41#define ENOMEM 12 /* Cannot allocate memory */\r
42#define EINVAL 22 /* Invalid argument */\r
43#define BUFSIZ 1024 /* size of buffer used by setbuf */\r
44#define INT_MAX 2147483647 /* max value for an int */\r
45#define INT_MIN (-2147483647-1) /* min value for an int */\r
46#define LONG_MAX 2147483647L /* max value for a long */\r
47#define LONG_MIN (-2147483647-1) /* min value for a long */\r
48#define ULONG_MAX 0xffffffff /* max value for an unsigned long */\r
49#define LOG_DAEMON (3<<3) /* system daemons */\r
50#define LOG_EMERG 0 /* system is unusable */\r
51#define LOG_ALERT 1 /* action must be taken immediately */\r
52#define LOG_CRIT 2 /* critical conditions */\r
53#define LOG_ERR 3 /* error conditions */\r
54#define LOG_WARNING 4 /* warning conditions */\r
55#define LOG_NOTICE 5 /* normal but significant condition */\r
56#define LOG_INFO 6 /* informational */\r
57#define LOG_DEBUG 7 /* debug-level messages */\r
58#define LOG_PID 0x01 /* log the pid with each message */\r
59#define LOG_CONS 0x02 /* log on the console if errors in sending */\r
60\r
61//\r
62// Macros from EFI Application Toolkit required to buiild Open SSL\r
63//\r
64/* The offsetof() macro calculates the offset of a structure member\r
65 in its structure. Unfortunately this cannot be written down\r
66 portably, hence it is provided by a Standard C header file.\r
67 For pre-Standard C compilers, here is a version that usually works\r
68 (but watch out!): */\r
69#define offsetof(type, member) ( (int) & ((type*)0) -> member )\r
70\r
71//\r
72// Basic types from EFI Application Toolkit required to buiild Open SSL\r
73//\r
74typedef UINTN size_t;\r
75typedef INTN ssize_t;\r
76typedef INT64 off_t;\r
77typedef UINT16 mode_t;\r
78typedef long time_t;\r
79typedef unsigned long clock_t;\r
80typedef UINT32 uid_t;\r
81typedef UINT32 gid_t;\r
82typedef UINT32 ino_t;\r
83typedef UINT32 dev_t;\r
84typedef UINT16 nlink_t;\r
85typedef int pid_t;\r
86typedef void *DIR;\r
87typedef void __sighandler_t (int);\r
88\r
89//\r
90// Structures from EFI Application Toolkit required to buiild Open SSL\r
91//\r
92struct tm {\r
93 int tm_sec; /* seconds after the minute [0-60] */\r
94 int tm_min; /* minutes after the hour [0-59] */\r
95 int tm_hour; /* hours since midnight [0-23] */\r
96 int tm_mday; /* day of the month [1-31] */\r
97 int tm_mon; /* months since January [0-11] */\r
98 int tm_year; /* years since 1900 */\r
99 int tm_wday; /* days since Sunday [0-6] */\r
100 int tm_yday; /* days since January 1 [0-365] */\r
101 int tm_isdst; /* Daylight Savings Time flag */\r
102 long tm_gmtoff; /* offset from CUT in seconds */\r
103 char *tm_zone; /* timezone abbreviation */\r
104};\r
105\r
106struct dirent {\r
107 UINT32 d_fileno; /* file number of entry */\r
108 UINT16 d_reclen; /* length of this record */\r
109 UINT8 d_type; /* file type, see below */\r
110 UINT8 d_namlen; /* length of string in d_name */\r
111 char d_name[255 + 1]; /* name must be no longer than this */\r
112};\r
113\r
114struct stat {\r
115 dev_t st_dev; /* inode's device */\r
116 ino_t st_ino; /* inode's number */\r
117 mode_t st_mode; /* inode protection mode */\r
118 nlink_t st_nlink; /* number of hard links */\r
119 uid_t st_uid; /* user ID of the file's owner */\r
120 gid_t st_gid; /* group ID of the file's group */\r
121 dev_t st_rdev; /* device type */\r
122 time_t st_atime; /* time of last access */\r
123 long st_atimensec; /* nsec of last access */\r
124 time_t st_mtime; /* time of last data modification */\r
125 long st_mtimensec; /* nsec of last data modification */\r
126 time_t st_ctime; /* time of last file status change */\r
127 long st_ctimensec; /* nsec of last file status change */\r
128 off_t st_size; /* file size, in bytes */\r
129 INT64 st_blocks; /* blocks allocated for file */\r
130 UINT32 st_blksize; /* optimal blocksize for I/O */\r
131 UINT32 st_flags; /* user defined flags for file */\r
132 UINT32 st_gen; /* file generation number */\r
133 INT32 st_lspare;\r
134 INT64 st_qspare[2];\r
135};\r
136\r
137//\r
138// Externs from EFI Application Toolkit required to buiild Open SSL\r
139//\r
140extern int errno;\r
141\r
142//\r
143// Function prototypes from EFI Application Toolkit required to buiild Open SSL\r
144//\r
145void *malloc (size_t);\r
146void *realloc (void *, size_t);\r
147void free (void *);\r
148int isdigit (int);\r
149int isspace (int);\r
150int tolower (int);\r
151int isupper (int);\r
152int isxdigit (int);\r
153int isalnum (int);\r
154void *memcpy (void *, const void *, size_t);\r
155void *memset (void *, int, size_t);\r
156void *memchr (const void *, int, size_t);\r
157int memcmp (const void *, const void *, size_t);\r
158void *memmove (void *, const void *, size_t);\r
159int strcmp (const char *, const char *);\r
160int strncmp (const char *, const char *, size_t);\r
161char *strcpy (char *, const char *);\r
162char *strncpy (char *, const char *, size_t);\r
163size_t strlen (const char *);\r
164char *strcat (char *, const char *);\r
165char *strchr (const char *, int);\r
166int strcasecmp (const char *, const char *);\r
167int strncasecmp (const char *, const char *, size_t);\r
168char *strncpy (char *, const char *, size_t);\r
169int strncmp (const char *, const char *, size_t);\r
170char *strrchr (const char *, int);\r
171unsigned long strtoul (const char *, char **, int);\r
172long strtol (const char *, char **, int);\r
173int printf (const char *, ...);\r
174int sscanf (const char *, const char *, ...);\r
175int open (const char *, int, ...);\r
176int chmod (const char *, mode_t);\r
177int stat (const char *, struct stat *);\r
178off_t lseek (int, off_t, int);\r
179ssize_t read (int, void *, size_t);\r
180ssize_t write (int, const void *, size_t);\r
181int close (int);\r
182FILE *fopen (const char *, const char *);\r
183size_t fread (void *, size_t, size_t, FILE *);\r
184size_t fwrite (const void *, size_t, size_t, FILE *);\r
185char *fgets (char *, int, FILE *);\r
186int fputs (const char *, FILE *);\r
187int fprintf (FILE *, const char *, ...);\r
188int vfprintf (FILE *, const char *, VA_LIST);\r
189int fflush (FILE *);\r
190int fclose (FILE *);\r
191DIR *opendir (const char *);\r
192struct dirent *readdir (DIR *);\r
193int closedir (DIR *);\r
194void openlog (const char *, int, int);\r
195void closelog (void);\r
196void syslog (int, const char *, ...);\r
197time_t time (time_t *);\r
198struct tm *localtime (const time_t *);\r
199struct tm *gmtime (const time_t *);\r
200struct tm *gmtime_r (const time_t *, struct tm *);\r
201uid_t getuid (void);\r
202uid_t geteuid (void);\r
203gid_t getgid (void);\r
204gid_t getegid (void);\r
205void qsort (void *, size_t, size_t, int (*)(const void *, const void *));\r
206char *getenv (const char *);\r
207void exit (int);\r
208void abort (void);\r
209__sighandler_t *signal (int, __sighandler_t *);\r
210\r
211//\r
212// Global variables from EFI Application Toolkit required to buiild Open SSL\r
213//\r
214FILE *stderr;\r
215FILE *stdin;\r
216FILE *stdout;\r
217\r
218//\r
219// Macros that directly map functions to BaseLib, BaseMemoryLib, and DebugLib functions\r
220//\r
221#define memcpy(dest,source,count) CopyMem(dest,source,(UINTN)(count))\r
222#define memset(dest,ch,count) SetMem(dest,(UINTN)(count),(UINT8)(ch))\r
223#define memchr(buf,ch,count) ScanMem8(buf,(UINTN)(count),(UINT8)ch)\r
224#define memcmp(buf1,buf2,count) (int)(CompareMem(buf1,buf2,(UINTN)(count)))\r
225#define strcmp AsciiStrCmp\r
226#define strncmp(string1,string2,count) (int)(AsciiStrnCmp(string1,string2,(UINTN)(count)))\r
227#define strcpy(strDest,strSource) AsciiStrCpy(strDest,strSource)\r
228#define strncpy(strDest,strSource,count) AsciiStrnCpy(strDest,strSource,(UINTN)count)\r
229#define strlen(str) (size_t)(AsciiStrLen(str))\r
230#define strcat(strDest,strSource) AsciiStrCat(strDest,strSource)\r
231#define strchr(str,ch) ScanMem8((VOID *)(str),AsciiStrSize(str),(UINT8)ch)\r
232#define abort() ASSERT (FALSE)\r
233#define assert(expression)\r
234#define localtime(timer) NULL\r
235#define gmtime(timer) NULL\r
236#define gmtime_r(timer,result) (result = NULL)\r
237\r
238#endif\r