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