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 | #define OPENSSL_NO_DEPRECATED 0
|
---|
24 |
|
---|
25 | #include <openssl/opensslv.h>
|
---|
26 |
|
---|
27 | #if OPENSSL_VERSION_NUMBER < 0x10100000L
|
---|
28 | #define OBJ_get0_data(o) ((o)->data)
|
---|
29 | #define OBJ_length(o) ((o)->length)
|
---|
30 | #endif
|
---|
31 |
|
---|
32 | /**
|
---|
33 | Check input P7Data is a wrapped ContentInfo structure or not. If not construct
|
---|
34 | a new structure to wrap P7Data.
|
---|
35 |
|
---|
36 | Caution: This function may receive untrusted input.
|
---|
37 | UEFI Authenticated Variable is external input, so this function will do basic
|
---|
38 | check for PKCS#7 data structure.
|
---|
39 |
|
---|
40 | @param[in] P7Data Pointer to the PKCS#7 message to verify.
|
---|
41 | @param[in] P7Length Length of the PKCS#7 message in bytes.
|
---|
42 | @param[out] WrapFlag If TRUE P7Data is a ContentInfo structure, otherwise
|
---|
43 | return FALSE.
|
---|
44 | @param[out] WrapData If return status of this function is TRUE:
|
---|
45 | 1) when WrapFlag is TRUE, pointer to P7Data.
|
---|
46 | 2) when WrapFlag is FALSE, pointer to a new ContentInfo
|
---|
47 | structure. It's caller's responsibility to free this
|
---|
48 | buffer.
|
---|
49 | @param[out] WrapDataSize Length of ContentInfo structure in bytes.
|
---|
50 |
|
---|
51 | @retval TRUE The operation is finished successfully.
|
---|
52 | @retval FALSE The operation is failed due to lack of resources.
|
---|
53 |
|
---|
54 | **/
|
---|
55 | BOOLEAN
|
---|
56 | WrapPkcs7Data (
|
---|
57 | IN CONST UINT8 *P7Data,
|
---|
58 | IN UINTN P7Length,
|
---|
59 | OUT BOOLEAN *WrapFlag,
|
---|
60 | OUT UINT8 **WrapData,
|
---|
61 | OUT UINTN *WrapDataSize
|
---|
62 | );
|
---|
63 |
|
---|
64 | #endif
|
---|