Cleaning-up CRT Library Wrapper for the third-party cryptography library building. The changes includes 1. Rename OpenSslSupport.h to CrtLibSupport.h for future alternative crypto provider support. 2. Remove all un-referenced CRT APIs and headers. (NOTE: More cleans-up could be possible after OpenSSL integrate the extra PR request: https://github.com/openssl/openssl/pull/2961) Cc: Ting Ye <ting.ye@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Gary Lin <glin@suse.com> Cc: Ronald Cron <ronald.cron@arm.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Qin Long <qin.long@intel.com> Reviewed-by: Ting Ye <ting.ye@intel.com> Tested-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Gary Lin <glin@suse.com>
50 lines
1.3 KiB
C
50 lines
1.3 KiB
C
/** @file
|
|
Base Memory Allocation Routines Wrapper for Crypto library over OpenSSL
|
|
during PEI & DXE phases.
|
|
|
|
Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
|
|
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
|
|
http://opensource.org/licenses/bsd-license.php
|
|
|
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
**/
|
|
|
|
#include <CrtLibSupport.h>
|
|
#include <Library/MemoryAllocationLib.h>
|
|
|
|
//
|
|
// -- Memory-Allocation Routines --
|
|
//
|
|
|
|
/* Allocates memory blocks */
|
|
void *malloc (size_t size)
|
|
{
|
|
return AllocatePool ((UINTN) size);
|
|
}
|
|
|
|
/* Reallocate memory blocks */
|
|
void *realloc (void *ptr, size_t size)
|
|
{
|
|
//
|
|
// BUG: hardcode OldSize == size! We have no any knowledge about
|
|
// memory size of original pointer ptr.
|
|
//
|
|
return ReallocatePool ((UINTN) size, (UINTN) size, ptr);
|
|
}
|
|
|
|
/* De-allocates or frees a memory block */
|
|
void free (void *ptr)
|
|
{
|
|
//
|
|
// In Standard C, free() handles a null pointer argument transparently. This
|
|
// is not true of FreePool() below, so protect it.
|
|
//
|
|
if (ptr != NULL) {
|
|
FreePool (ptr);
|
|
}
|
|
}
|