/* Do a hash operation on a data buffer, extend a specific RTMR with the hash result, and add an entry to the Event Log. */
EFI_STATUS TdxDxeHashLogExtendEvent(IN UINT64 Flags, IN UINT8 *HashData, IN UINT64 HashDataLen, IN OUT CC_EVENT_HDR *NewEventHdr, IN UINT8 *NewEventData)
/* Do a hash operation on a data buffer, extend a specific RTMR with the hash result, and add an entry to the Event Log. */
EFI_STATUS TdxDxeHashLogExtendEvent(IN UINT64 Flags, IN UINT8 *HashData, IN UINT64 HashDataLen, IN OUT CC_EVENT_HDR *NewEventHdr, IN UINT8 *NewEventData)
{
  EFI_STATUS          Status;
  TPML_DIGEST_VALUES  DigestList;
  CC_EVENT_HDR        NoActionEvent;
  if (NewEventHdr->EventType == EV_NO_ACTION) {
    Status = EFI_SUCCESS;
    InitNoActionEvent (&NoActionEvent, NewEventHdr->EventSize);
    if ((Flags & EFI_CC_FLAG_EXTEND_ONLY) == 0) {
      Status = TdxDxeLogHashEvent (&(NoActionEvent.Digests), NewEventHdr, NewEventData);
    }
    return Status;
  }
  Status = HashAndExtend (
             NewEventHdr->MrIndex - 1,
             HashData,
             (UINTN)HashDataLen,
             &DigestList
             );
  if (!EFI_ERROR (Status)) {
    if ((Flags & EFI_CC_FLAG_EXTEND_ONLY) == 0) {
      Status = TdxDxeLogHashEvent (&DigestList, NewEventHdr, NewEventData);
    }
  }
  return Status;
}