/* Extract the driver FV from an authenticated image. */
BOOLEAN EFIAPI ExtractDriverFvImage(IN VOID *AuthenticatedImage, IN UINTN AuthenticatedImageSize, OUT VOID **DriverFvImage, OUT UINTN *DriverFvImageSize)
/* Extract the driver FV from an authenticated image. */
BOOLEAN EFIAPI ExtractDriverFvImage(IN VOID *AuthenticatedImage, IN UINTN AuthenticatedImageSize, OUT VOID **DriverFvImage, OUT UINTN *DriverFvImageSize)
{
  BOOLEAN  Result;
  UINT32   FileHeaderSize;
  *DriverFvImage     = NULL;
  *DriverFvImageSize = 0;
  Result = GetFfsByName (AuthenticatedImage, AuthenticatedImageSize, &gEdkiiSystemFmpCapsuleDriverFvFileGuid, EFI_FV_FILETYPE_RAW, DriverFvImage, DriverFvImageSize);
  if (!Result) {
    return FALSE;
  }
  if (IS_FFS_FILE2 (*DriverFvImage)) {
    FileHeaderSize = sizeof (EFI_FFS_FILE_HEADER2);
  } else {
    FileHeaderSize = sizeof (EFI_FFS_FILE_HEADER);
  }
  *DriverFvImage     = (UINT8 *)*DriverFvImage + FileHeaderSize;
  *DriverFvImageSize = *DriverFvImageSize - FileHeaderSize;
  return Result;
}