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