]>
Commit | Line | Data |
---|---|---|
3743e71a JW |
1 | /** @file\r |
2 | Definitions for OBB FVs verification.\r | |
3 | \r | |
4 | Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\r | |
5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
6 | \r | |
7 | **/\r | |
8 | \r | |
9 | #ifndef __FV_REPORT_PEI_H__\r | |
10 | #define __FV_REPORT_PEI_H__\r | |
11 | \r | |
12 | #include <PiPei.h>\r | |
13 | \r | |
14 | #include <IndustryStandard/Tpm20.h>\r | |
15 | \r | |
16 | #include <Ppi/FirmwareVolumeInfoStoredHashFv.h>\r | |
17 | \r | |
18 | #include <Library/PeiServicesLib.h>\r | |
19 | #include <Library/PcdLib.h>\r | |
20 | #include <Library/HobLib.h>\r | |
21 | #include <Library/DebugLib.h>\r | |
22 | #include <Library/BaseMemoryLib.h>\r | |
23 | #include <Library/MemoryAllocationLib.h>\r | |
24 | #include <Library/BaseCryptLib.h>\r | |
25 | #include <Library/ReportStatusCodeLib.h>\r | |
26 | \r | |
27 | #define HASH_INFO_PTR(PreHashedFvPpi) \\r | |
28 | (HASH_INFO *)((UINT8 *)(PreHashedFvPpi) + sizeof (EDKII_PEI_FIRMWARE_VOLUME_INFO_PREHASHED_FV_PPI))\r | |
29 | \r | |
30 | #define HASH_VALUE_PTR(HashInfo) \\r | |
31 | (VOID *)((UINT8 *)(HashInfo) + sizeof (HASH_INFO))\r | |
32 | \r | |
33 | /**\r | |
34 | Computes the message digest of a input data buffer.\r | |
35 | \r | |
36 | This function performs message digest of a given data buffer, and places\r | |
37 | the digest value into the specified memory.\r | |
38 | \r | |
39 | If this interface is not supported, then return FALSE.\r | |
40 | \r | |
41 | @param[in] Data Pointer to the buffer containing the data to be hashed.\r | |
42 | @param[in] DataSize Size of Data buffer in bytes.\r | |
43 | @param[out] HashValue Pointer to a buffer that receives digest value.\r | |
44 | \r | |
45 | @retval TRUE The digest computation succeeded.\r | |
46 | @retval FALSE The digest computation failed.\r | |
47 | \r | |
48 | **/\r | |
49 | typedef\r | |
50 | BOOLEAN\r | |
51 | (EFIAPI *HASH_ALL_METHOD) (\r | |
52 | IN CONST VOID *Data,\r | |
53 | IN UINTN DataSize,\r | |
54 | OUT UINT8 *HashValue\r | |
55 | );\r | |
56 | \r | |
57 | /**\r | |
58 | Initializes user-supplied memory as hash context for subsequent use.\r | |
59 | \r | |
60 | @param[out] HashContext Pointer to hash context being initialized.\r | |
61 | \r | |
62 | @retval TRUE Hash context initialization succeeded.\r | |
63 | @retval FALSE Hash context initialization failed.\r | |
64 | @retval FALSE This interface is not supported.\r | |
65 | \r | |
66 | **/\r | |
67 | typedef\r | |
68 | BOOLEAN\r | |
69 | (EFIAPI *HASH_INIT_METHOD) (\r | |
70 | OUT VOID *HashContext\r | |
71 | );\r | |
72 | \r | |
73 | /**\r | |
74 | Digests the input data and updates hash context.\r | |
75 | \r | |
76 | @param[in, out] HashContext Pointer to the hash context.\r | |
77 | @param[in] Data Pointer to the buffer containing the data to be hashed.\r | |
78 | @param[in] DataSize Size of Data buffer in bytes.\r | |
79 | \r | |
80 | @retval TRUE Hash data digest succeeded.\r | |
81 | @retval FALSE Hash data digest failed.\r | |
82 | @retval FALSE This interface is not supported.\r | |
83 | \r | |
84 | **/\r | |
85 | typedef\r | |
86 | BOOLEAN\r | |
87 | (EFIAPI *HASH_UPDATE_METHOD) (\r | |
88 | IN OUT VOID *HashContext,\r | |
89 | IN CONST VOID *Data,\r | |
90 | IN UINTN DataSize\r | |
91 | );\r | |
92 | \r | |
93 | /**\r | |
94 | Completes computation of the hash digest value.\r | |
95 | \r | |
96 | @param[in, out] HashContext Pointer to the hash context.\r | |
97 | @param[out] HashValue Pointer to a buffer that receives the hash digest\r | |
98 | value.\r | |
99 | \r | |
100 | @retval TRUE Hash digest computation succeeded.\r | |
101 | @retval FALSE Hash digest computation failed.\r | |
102 | @retval FALSE This interface is not supported.\r | |
103 | \r | |
104 | **/\r | |
105 | typedef\r | |
106 | BOOLEAN\r | |
107 | (EFIAPI *HASH_FINAL_METHOD) (\r | |
108 | IN OUT VOID *HashContext,\r | |
109 | OUT UINT8 *HashValue\r | |
110 | );\r | |
111 | \r | |
112 | typedef struct {\r | |
113 | UINT16 HashAlgId;\r | |
114 | UINTN HashSize;\r | |
115 | HASH_INIT_METHOD HashInit;\r | |
116 | HASH_UPDATE_METHOD HashUpdate;\r | |
117 | HASH_FINAL_METHOD HashFinal;\r | |
118 | HASH_ALL_METHOD HashAll;\r | |
119 | } HASH_ALG_INFO;\r | |
120 | \r | |
121 | #endif //__FV_REPORT_PEI_H__\r | |
122 | \r |