VirtualBox

Ignore:
Timestamp:
Mar 31, 2025 11:31:09 AM (2 weeks ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
168237
Message:

Devices/EFI/FirmwareNew: Merge edk2-stable202502 from the vendor branch and make it build for the important platforms, bugref:4643

Location:
trunk/src/VBox/Devices/EFI/FirmwareNew
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/FirmwareNew

  • trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/IntelTdx/TdxHelperLib/SecTdxHelper.c

    r105670 r108794  
    2424#include <ConfidentialComputingGuestAttr.h>
    2525#include <Library/TdxHelperLib.h>
     26#include <Library/TdxMeasurementLib.h>
    2627
    2728#define ALIGNED_2MB_MASK  0x1fffff
     
    644645                                                            EFI_RESOURCE_ATTRIBUTE_READ_ONLY_PROTECTED |
    645646                                                            EFI_RESOURCE_ATTRIBUTE_READ_ONLY_PROTECTABLE |
     647                                                            EFI_RESOURCE_ATTRIBUTE_ENCRYPTED|
     648                                                            EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE |
    646649                                                            EFI_RESOURCE_ATTRIBUTE_MORE_RELIABLE))) != 0)
    647650        {
     
    806809
    807810/**
    808  * Calculate the sha384 of input Data and extend it to RTMR register.
    809  *
    810  * @param RtmrIndex       Index of the RTMR register
    811  * @param DataToHash      Data to be hashed
    812  * @param DataToHashLen   Length of the data
    813  * @param Digest          Hash value of the input data
    814  * @param DigestLen       Length of the hash value
    815  *
    816  * @retval EFI_SUCCESS    Successfully hash and extend to RTMR
    817  * @retval Others         Other errors as indicated
    818  */
    819 STATIC
    820 EFI_STATUS
    821 HashAndExtendToRtmr (
    822   IN UINT32  RtmrIndex,
    823   IN VOID    *DataToHash,
    824   IN UINTN   DataToHashLen,
    825   OUT UINT8  *Digest,
    826   IN  UINTN  DigestLen
    827   )
    828 {
    829   EFI_STATUS  Status;
    830 
    831   if ((DataToHash == NULL) || (DataToHashLen == 0)) {
    832     return EFI_INVALID_PARAMETER;
    833   }
    834 
    835   if ((Digest == NULL) || (DigestLen != SHA384_DIGEST_SIZE)) {
    836     return EFI_INVALID_PARAMETER;
    837   }
    838 
    839   //
    840   // Calculate the sha384 of the data
    841   //
    842   if (!Sha384HashAll (DataToHash, DataToHashLen, Digest)) {
    843     return EFI_ABORTED;
    844   }
    845 
    846   //
    847   // Extend to RTMR
    848   //
    849   Status = TdExtendRtmr (
    850              (UINT32 *)Digest,
    851              SHA384_DIGEST_SIZE,
    852              (UINT8)RtmrIndex
    853              );
    854 
    855   ASSERT (!EFI_ERROR (Status));
    856   return Status;
    857 }
    858 
    859 /**
    860811  In Tdx guest, TdHob is passed from host VMM to guest firmware and it contains
    861812  the information of the memory resource. From the security perspective before
     
    887838  }
    888839
    889   Status = HashAndExtendToRtmr (
     840  Status = TdxMeasurementHashAndExtendToRtmr (
    890841             0,
    891842             (UINT8 *)TdHob,
     
    932883  OVMF_WORK_AREA  *WorkArea;
    933884
    934   Status = HashAndExtendToRtmr (
     885  Status = TdxMeasurementHashAndExtendToRtmr (
    935886             0,
    936887             (UINT8 *)(UINTN)PcdGet32 (PcdOvmfFlashNvStorageVariableBase),
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette