]>
Commit | Line | Data |
---|---|---|
97f98500 HT |
1 | /** @file\r |
2 | Base Memory Allocation Routines Wrapper for Crypto library over OpenSSL\r | |
3 | during PEI & DXE phases.\r | |
4 | \r | |
6b8ebcb8 | 5 | Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r |
97f98500 HT |
6 | This program and the accompanying materials\r |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | #include <OpenSslSupport.h>\r | |
17 | \r | |
18 | //\r | |
19 | // -- Memory-Allocation Routines --\r | |
20 | //\r | |
21 | \r | |
22 | /* Allocates memory blocks */\r | |
23 | void *malloc (size_t size)\r | |
24 | {\r | |
6b8ebcb8 | 25 | return AllocatePool ((UINTN) size);\r |
97f98500 HT |
26 | }\r |
27 | \r | |
28 | /* Reallocate memory blocks */\r | |
29 | void *realloc (void *ptr, size_t size)\r | |
30 | {\r | |
31 | //\r | |
32 | // BUG: hardcode OldSize == size! We have no any knowledge about\r | |
33 | // memory size of original pointer ptr.\r | |
34 | //\r | |
6b8ebcb8 | 35 | return ReallocatePool ((UINTN) size, (UINTN) size, ptr);\r |
97f98500 HT |
36 | }\r |
37 | \r | |
38 | /* De-allocates or frees a memory block */\r | |
39 | void free (void *ptr)\r | |
40 | {\r | |
211372d6 LE |
41 | //\r |
42 | // In Standard C, free() handles a null pointer argument transparently. This\r | |
43 | // is not true of FreePool() below, so protect it.\r | |
44 | //\r | |
45 | if (ptr != NULL) {\r | |
46 | FreePool (ptr);\r | |
47 | }\r | |
97f98500 | 48 | }\r |