|
| 1 | +/** @file |
| 2 | + NULL instance of TdxMeasurementLib |
| 3 | + Copyright (c) 2025, Intel Corporation. All rights reserved.<BR> |
| 4 | + SPDX-License-Identifier: BSD-2-Clause-Patent |
| 5 | +**/ |
| 6 | + |
| 7 | +#include <Base.h> |
| 8 | +#include <PiPei.h> |
| 9 | +#include <Library/TdxMeasurementLib.h> |
| 10 | + |
| 11 | +/** |
| 12 | + According to UEFI Spec 2.10 Section 38.4.1: |
| 13 | + The following table shows the TPM PCR index mapping and CC event log measurement |
| 14 | + register index interpretation for Intel TDX, where MRTD means Trust Domain Measurement |
| 15 | + Register and RTMR means Runtime Measurement Register |
| 16 | + // TPM PCR Index | CC Measurement Register Index | TDX-measurement register |
| 17 | + // ------------------------------------------------------------------------ |
| 18 | + // 0 | 0 | MRTD |
| 19 | + // 1, 7 | 1 | RTMR[0] |
| 20 | + // 2~6 | 2 | RTMR[1] |
| 21 | + // 8~15 | 3 | RTMR[2] |
| 22 | + @param[in] PCRIndex Index of the TPM PCR |
| 23 | + @retval UINT32 Index of the CC Event Log Measurement Register Index |
| 24 | + @retval CC_MR_INDEX_INVALID Invalid MR Index |
| 25 | +**/ |
| 26 | +UINT32 |
| 27 | +EFIAPI |
| 28 | +TdxMeasurementMapPcrToMrIndex ( |
| 29 | + IN UINT32 PCRIndex |
| 30 | + ) |
| 31 | +{ |
| 32 | + return CC_MR_INDEX_INVALID; |
| 33 | +} |
| 34 | + |
| 35 | +/** |
| 36 | + * Calculate the sha384 of input Data and extend it to RTMR register. |
| 37 | + * |
| 38 | + * @param RtmrIndex Index of the RTMR register |
| 39 | + * @param DataToHash Data to be hashed |
| 40 | + * @param DataToHashLen Length of the data |
| 41 | + * @param Digest Hash value of the input data |
| 42 | + * @param DigestLen Length of the hash value |
| 43 | + * |
| 44 | + * @retval EFI_SUCCESS Successfully hash and extend to RTMR |
| 45 | + * @retval Others Other errors as indicated |
| 46 | + */ |
| 47 | +EFI_STATUS |
| 48 | +EFIAPI |
| 49 | +TdxMeasurementHashAndExtendToRtmr ( |
| 50 | + IN UINT32 RtmrIndex, |
| 51 | + IN VOID *DataToHash, |
| 52 | + IN UINTN DataToHashLen, |
| 53 | + OUT UINT8 *Digest, |
| 54 | + IN UINTN DigestLen |
| 55 | + ) |
| 56 | +{ |
| 57 | + return EFI_UNSUPPORTED; |
| 58 | +} |
| 59 | + |
| 60 | +/** |
| 61 | + * Build GuidHob for Tdx CC measurement event. |
| 62 | + * |
| 63 | + * @param RtmrIndex RTMR index |
| 64 | + * @param EventType Event type |
| 65 | + * @param EventData Event data |
| 66 | + * @param EventSize Size of event data |
| 67 | + * @param HashValue Hash value |
| 68 | + * @param HashSize Size of hash |
| 69 | + * |
| 70 | + * @retval EFI_SUCCESS Successfully build the GuidHobs |
| 71 | + * @retval Others Other error as indicated |
| 72 | + */ |
| 73 | +EFI_STATUS |
| 74 | +EFIAPI |
| 75 | +TdxMeasurementBuildGuidHob ( |
| 76 | + UINT32 RtmrIndex, |
| 77 | + UINT32 EventType, |
| 78 | + UINT8 *EventData, |
| 79 | + UINT32 EventSize, |
| 80 | + UINT8 *HashValue, |
| 81 | + UINT32 HashSize |
| 82 | + ) |
| 83 | +{ |
| 84 | + return EFI_UNSUPPORTED; |
| 85 | +} |
0 commit comments