]> git.proxmox.com Git - mirror_edk2.git/blame - CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c
CryptoPkg:SmmCryptLib: Add real Pkcs5Pbkdf2.c.
[mirror_edk2.git] / CryptoPkg / Library / IntrinsicLib / MemoryIntrinsics.c
CommitLineData
97f98500
HT
1/** @file\r
2 Intrinsic Memory Routines Wrapper Implementation for OpenSSL-based\r
3 Cryptographic Library.\r
4\r
1b98d6ce 5Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>\r
97f98500
HT
6This program and the accompanying materials\r
7are licensed and made available under the terms and conditions of the BSD License\r
8which accompanies this distribution. The full text of the license may be found at\r
9http://opensource.org/licenses/bsd-license.php\r
10\r
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#include <Base.h>\r
17#include <Library/BaseMemoryLib.h>\r
18\r
19/* OpenSSL will use floating point support, and C compiler produces the _fltused\r
20 symbol by default. Simply define this symbol here to satisfy the linker. */\r
21int _fltused = 1;\r
22\r
23/* Sets buffers to a specified character */\r
24void * memset (void *dest, char ch, unsigned int count)\r
25{\r
1b98d6ce
LQ
26 //\r
27 // NOTE: Here we use one base implementation for memset, instead of the direct\r
28 // optimized SetMem() wrapper. Because the IntrinsicLib has to be built \r
29 // without whole program optimization option, and there will be some \r
30 // potential register usage errors when calling other optimized codes.\r
31 //\r
32\r
4a567c96 33 //\r
34 // Declare the local variables that actually move the data elements as\r
35 // volatile to prevent the optimizer from replacing this function with\r
36 // the intrinsic memset()\r
37 //\r
38 volatile UINT8 *Pointer;\r
39\r
40 Pointer = (UINT8 *)dest;\r
41 while (count-- != 0) {\r
42 *(Pointer++) = ch;\r
43 }\r
44 \r
45 return dest;\r
97f98500 46}\r