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