/* Returns the version described in the FMP Payload Header. */
EFI_STATUS EFIAPI GetFmpPayloadHeaderVersion(IN CONST VOID *Header, IN CONST UINTN FmpPayloadSize, OUT UINT32 *Version)
/* Returns the version described in the FMP Payload Header. */
EFI_STATUS EFIAPI GetFmpPayloadHeaderVersion(IN CONST VOID *Header, IN CONST UINTN FmpPayloadSize, OUT UINT32 *Version)
{
  FMP_PAYLOAD_HEADER  *FmpPayloadHeader;
  FmpPayloadHeader = NULL;
  if ((Header == NULL) || (Version == NULL)) {
    return EFI_INVALID_PARAMETER;
  }
  FmpPayloadHeader = (FMP_PAYLOAD_HEADER *)Header;
  if (((UINTN)FmpPayloadHeader + sizeof (FMP_PAYLOAD_HEADER) < (UINTN)FmpPayloadHeader) ||
      ((UINTN)FmpPayloadHeader + sizeof (FMP_PAYLOAD_HEADER) >= (UINTN)FmpPayloadHeader + FmpPayloadSize) ||
      (FmpPayloadHeader->HeaderSize < sizeof (FMP_PAYLOAD_HEADER)))
  {
    return EFI_INVALID_PARAMETER;
  }
  if (FmpPayloadHeader->Signature != FMP_PAYLOAD_HEADER_SIGNATURE) {
    return EFI_INVALID_PARAMETER;
  }
  *Version = FmpPayloadHeader->FwVersion;
  return EFI_SUCCESS;
}