]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/IntelTdx/TdxHelperLib/PeiTdxHelper.c
OvmfPkg/IntelTdx: Add PeiTdxHelperLib
[mirror_edk2.git] / OvmfPkg / IntelTdx / TdxHelperLib / PeiTdxHelper.c
1 /** @file
2 TdxHelper Functions which are used in PEI phase
3
4 Copyright (c) 2022 - 2023, Intel Corporation. All rights reserved.<BR>
5
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9
10 #include <Base.h>
11 #include <PiPei.h>
12
13 /**
14 Build the GuidHob for tdx measurements which were done in SEC phase.
15 The measurement values are stored in WorkArea.
16
17 @retval EFI_SUCCESS The GuidHob is built successfully
18 @retval Others Other errors as indicated
19 **/
20 EFI_STATUS
21 InternalBuildGuidHobForTdxMeasurement (
22 VOID
23 );
24
25 /**
26 In Tdx guest, some information need to be passed from host VMM to guest
27 firmware. For example, the memory resource, etc. These information are
28 prepared by host VMM and put in TdHob which is described in TdxMetadata.
29 TDVF processes the TdHob to accept memories.
30
31 @retval EFI_SUCCESS Successfully process the TdHob
32 @retval Others Other error as indicated
33 **/
34 EFI_STATUS
35 EFIAPI
36 TdxHelperProcessTdHob (
37 VOID
38 )
39 {
40 return EFI_UNSUPPORTED;
41 }
42
43 /**
44 In Tdx guest, TdHob is passed from host VMM to guest firmware and it contains
45 the information of the memory resource. From the security perspective before
46 it is consumed, it should be measured and extended.
47 *
48 * @retval EFI_SUCCESS Successfully measure the TdHob
49 * @retval Others Other error as indicated
50 */
51 EFI_STATUS
52 EFIAPI
53 TdxHelperMeasureTdHob (
54 VOID
55 )
56 {
57 return EFI_UNSUPPORTED;
58 }
59
60 /**
61 * In Tdx guest, Configuration FV (CFV) is treated as external input because it
62 * may contain the data provided by VMM. From the sucurity perspective Cfv image
63 * should be measured before it is consumed.
64 *
65 * @retval EFI_SUCCESS Successfully measure the CFV image
66 * @retval Others Other error as indicated
67 */
68 EFI_STATUS
69 EFIAPI
70 TdxHelperMeasureCfvImage (
71 VOID
72 )
73 {
74 return EFI_UNSUPPORTED;
75 }
76
77 /**
78 Build the GuidHob for tdx measurements which were done in SEC phase.
79 The measurement values are stored in WorkArea.
80
81 @retval EFI_SUCCESS The GuidHob is built successfully
82 @retval Others Other errors as indicated
83 **/
84 EFI_STATUS
85 EFIAPI
86 TdxHelperBuildGuidHobForTdxMeasurement (
87 VOID
88 )
89 {
90 return InternalBuildGuidHobForTdxMeasurement ();
91 }