/* Calculate the sha384 of input Data and extend it to RTMR register. */
STATIC EFI_STATUS HashAndExtendToRtmr(IN UINT32 RtmrIndex, IN VOID *DataToHash, IN UINTN DataToHashLen, OUT UINT8 *Digest, IN UINTN DigestLen)
/* Calculate the sha384 of input Data and extend it to RTMR register. */
STATIC EFI_STATUS HashAndExtendToRtmr(IN UINT32 RtmrIndex, IN VOID *DataToHash, IN UINTN DataToHashLen, OUT UINT8 *Digest, IN UINTN DigestLen)
{
  EFI_STATUS  Status;
  if ((DataToHash == NULL) || (DataToHashLen == 0)) {
    return EFI_INVALID_PARAMETER;
  }
  if ((Digest == NULL) || (DigestLen != SHA384_DIGEST_SIZE)) {
    return EFI_INVALID_PARAMETER;
  }
  if (!Sha384HashAll (DataToHash, DataToHashLen, Digest)) {
    return EFI_ABORTED;
  }
  Status = TdExtendRtmr (
             (UINT32 *)Digest,
             SHA384_DIGEST_SIZE,
             (UINT8)RtmrIndex
             );
  ASSERT (!EFI_ERROR (Status));
  return Status;
}