]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | Internal include file for BaseCryptLib.\r | |
3 | \r | |
4 | Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>\r | |
5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
6 | \r | |
7 | **/\r | |
8 | \r | |
9 | #ifndef __INTERNAL_CRYPT_LIB_H__\r | |
10 | #define __INTERNAL_CRYPT_LIB_H__\r | |
11 | \r | |
12 | #undef _WIN32\r | |
13 | #undef _WIN64\r | |
14 | \r | |
15 | #include <Library/BaseLib.h>\r | |
16 | #include <Library/BaseMemoryLib.h>\r | |
17 | #include <Library/MemoryAllocationLib.h>\r | |
18 | #include <Library/DebugLib.h>\r | |
19 | #include <Library/BaseCryptLib.h>\r | |
20 | \r | |
21 | #include "CrtLibSupport.h"\r | |
22 | \r | |
23 | #include <openssl/opensslv.h>\r | |
24 | \r | |
25 | #if OPENSSL_VERSION_NUMBER < 0x10100000L\r | |
26 | #define OBJ_get0_data(o) ((o)->data)\r | |
27 | #define OBJ_length(o) ((o)->length)\r | |
28 | #endif\r | |
29 | \r | |
30 | /**\r | |
31 | Check input P7Data is a wrapped ContentInfo structure or not. If not construct\r | |
32 | a new structure to wrap P7Data.\r | |
33 | \r | |
34 | Caution: This function may receive untrusted input.\r | |
35 | UEFI Authenticated Variable is external input, so this function will do basic\r | |
36 | check for PKCS#7 data structure.\r | |
37 | \r | |
38 | @param[in] P7Data Pointer to the PKCS#7 message to verify.\r | |
39 | @param[in] P7Length Length of the PKCS#7 message in bytes.\r | |
40 | @param[out] WrapFlag If TRUE P7Data is a ContentInfo structure, otherwise\r | |
41 | return FALSE.\r | |
42 | @param[out] WrapData If return status of this function is TRUE:\r | |
43 | 1) when WrapFlag is TRUE, pointer to P7Data.\r | |
44 | 2) when WrapFlag is FALSE, pointer to a new ContentInfo\r | |
45 | structure. It's caller's responsibility to free this\r | |
46 | buffer.\r | |
47 | @param[out] WrapDataSize Length of ContentInfo structure in bytes.\r | |
48 | \r | |
49 | @retval TRUE The operation is finished successfully.\r | |
50 | @retval FALSE The operation is failed due to lack of resources.\r | |
51 | \r | |
52 | **/\r | |
53 | BOOLEAN\r | |
54 | WrapPkcs7Data (\r | |
55 | IN CONST UINT8 *P7Data,\r | |
56 | IN UINTN P7Length,\r | |
57 | OUT BOOLEAN *WrapFlag,\r | |
58 | OUT UINT8 **WrapData,\r | |
59 | OUT UINTN *WrapDataSize\r | |
60 | );\r | |
61 | \r | |
62 | #endif\r |