TianoCore EDK2 master
|
#include <PiDxe.h>
#include <Guid/SystemResourceTable.h>
#include <Guid/FirmwareContentsSigned.h>
#include <Guid/WinCertificate.h>
#include <Guid/EdkiiSystemFmpCapsule.h>
#include <Guid/ImageAuthentication.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/PcdLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/EdkiiSystemCapsuleLib.h>
#include <Library/FmpAuthenticationLib.h>
#include <Protocol/FirmwareManagement.h>
Go to the source code of this file.
Functions | |
BOOLEAN | IsBufferErased (IN UINT8 ErasePolarity, IN VOID *InBuffer, IN UINTN BufferSize) |
BOOLEAN | GetSectionByType (IN VOID *SectionBuffer, IN UINT32 SectionBufferSize, IN EFI_SECTION_TYPE SectionType, IN UINTN SectionInstance, OUT VOID **OutSectionBuffer, OUT UINTN *OutSectionSize) |
BOOLEAN | GetFfsByName (IN VOID *FdStart, IN UINTN FdSize, IN EFI_GUID *FileName, IN EFI_FV_FILETYPE Type, OUT VOID **OutFfsBuffer, OUT UINTN *OutFfsBufferSize) |
BOOLEAN EFIAPI | ExtractDriverFvImage (IN VOID *AuthenticatedImage, IN UINTN AuthenticatedImageSize, OUT VOID **DriverFvImage, OUT UINTN *DriverFvImageSize) |
BOOLEAN EFIAPI | ExtractConfigImage (IN VOID *AuthenticatedImage, IN UINTN AuthenticatedImageSize, OUT VOID **ConfigImage, OUT UINTN *ConfigImageSize) |
BOOLEAN EFIAPI | ExtractAuthenticatedImage (IN VOID *Image, IN UINTN ImageSize, OUT UINT32 *LastAttemptStatus, OUT VOID **AuthenticatedImage, OUT UINTN *AuthenticatedImageSize) |
BOOLEAN EFIAPI | ExtractSystemFirmwareImageFmpInfo (IN VOID *SystemFirmwareImage, IN UINTN SystemFirmwareImageSize, OUT EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR **ImageFmpInfo, OUT UINTN *ImageFmpInfoSize) |
BOOLEAN EFIAPI | ExtractSystemFirmwareImage (IN VOID *AuthenticatedImage, IN UINTN AuthenticatedImageSize, OUT VOID **SystemFirmwareImage, OUT UINTN *SystemFirmwareImageSize) |
EFI_STATUS EFIAPI | CapsuleAuthenticateSystemFirmware (IN VOID *Image, IN UINTN ImageSize, IN BOOLEAN ForceVersionMatch, OUT UINT32 *LastAttemptVersion, OUT UINT32 *LastAttemptStatus, OUT VOID **AuthenticatedImage, OUT UINTN *AuthenticatedImageSize) |
VOID EFIAPI | EdkiiSystemCapsuleLibPcdCallBack (IN CONST GUID *CallBackGuid OPTIONAL, IN UINTN CallBackToken, IN OUT VOID *TokenData, IN UINTN TokenDataSize) |
EFI_STATUS EFIAPI | EdkiiSystemCapsuleLibConstructor (VOID) |
Variables | |
EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR * | mImageFmpInfo |
UINTN | mImageFmpInfoSize |
EFI_GUID | mEdkiiSystemFirmwareFileGuid |
EDKII System Capsule library.
EDKII System Capsule library instance.
CapsuleAuthenticateSystemFirmware(), ExtractAuthenticatedImage() will receive untrusted input and do basic validation.
Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file EdkiiSystemCapsuleLib.c.
EFI_STATUS EFIAPI CapsuleAuthenticateSystemFirmware | ( | IN VOID * | Image, |
IN UINTN | ImageSize, | ||
IN BOOLEAN | ForceVersionMatch, | ||
OUT UINT32 * | LastAttemptVersion, | ||
OUT UINT32 * | LastAttemptStatus, | ||
OUT VOID ** | AuthenticatedImage, | ||
OUT UINTN * | AuthenticatedImageSize | ||
) |
Authenticated system firmware FMP capsule image.
Caution: This function may receive untrusted input.
[in] | Image | The FMP capsule image, including EFI_FIRMWARE_IMAGE_AUTHENTICATION. |
[in] | ImageSize | The size of FMP capsule image in bytes. |
[in] | ForceVersionMatch | TRUE: The version of capsule must be as same as the version of current image. FALSE: The version of capsule must be as same as greater than the lowest supported version of current image. |
[out] | LastAttemptVersion | The last attempt version, which will be recorded in ESRT and FMP EFI_FIRMWARE_IMAGE_DESCRIPTOR. |
[out] | LastAttemptStatus | The last attempt status, which will be recorded in ESRT and FMP EFI_FIRMWARE_IMAGE_DESCRIPTOR. |
[out] | AuthenticatedImage | The authenticated capsule image, excluding EFI_FIRMWARE_IMAGE_AUTHENTICATION. |
[out] | AuthenticatedImageSize | The size of the authenticated capsule image in bytes. |
TRUE | Authentication passes and the authenticated image is extracted. |
FALSE | Authentication fails and the authenticated image is not extracted. |
Definition at line 593 of file EdkiiSystemCapsuleLib.c.
EFI_STATUS EFIAPI EdkiiSystemCapsuleLibConstructor | ( | VOID | ) |
The constructor function.
EFI_SUCCESS | The constructor successfully . |
Definition at line 732 of file EdkiiSystemCapsuleLib.c.
VOID EFIAPI EdkiiSystemCapsuleLibPcdCallBack | ( | IN CONST GUID *CallBackGuid | OPTIONAL, |
IN UINTN | CallBackToken, | ||
IN OUT VOID * | TokenData, | ||
IN UINTN | TokenDataSize | ||
) |
PcdCallBack gets the real set PCD value
[in] | CallBackGuid | The PCD token GUID being set. |
[in] | CallBackToken | The PCD token number being set. |
[in,out] | TokenData | A pointer to the token data being set. |
[in] | TokenDataSize | The size, in bytes, of the data being set. |
Definition at line 687 of file EdkiiSystemCapsuleLib.c.
BOOLEAN EFIAPI ExtractAuthenticatedImage | ( | IN VOID * | Image, |
IN UINTN | ImageSize, | ||
OUT UINT32 * | LastAttemptStatus, | ||
OUT VOID ** | AuthenticatedImage, | ||
OUT UINTN * | AuthenticatedImageSize | ||
) |
Extract the authenticated image from an FMP capsule image.
Caution: This function may receive untrusted input.
[in] | Image | The FMP capsule image, including EFI_FIRMWARE_IMAGE_AUTHENTICATION. |
[in] | ImageSize | The size of FMP capsule image in bytes. |
[out] | LastAttemptStatus | The last attempt status, which will be recorded in ESRT and FMP EFI_FIRMWARE_IMAGE_DESCRIPTOR. |
[out] | AuthenticatedImage | The authenticated capsule image, excluding EFI_FIRMWARE_IMAGE_AUTHENTICATION. |
[out] | AuthenticatedImageSize | The size of the authenticated capsule image in bytes. |
TRUE | The authenticated image is extracted. |
FALSE | The authenticated image is not extracted. |
Definition at line 358 of file EdkiiSystemCapsuleLib.c.
BOOLEAN EFIAPI ExtractConfigImage | ( | IN VOID * | AuthenticatedImage, |
IN UINTN | AuthenticatedImageSize, | ||
OUT VOID ** | ConfigImage, | ||
OUT UINTN * | ConfigImageSize | ||
) |
Extract the config image from an authenticated image.
[in] | AuthenticatedImage | The authenticated capsule image. |
[in] | AuthenticatedImageSize | The size of the authenticated capsule image in bytes. |
[out] | ConfigImage | The config image. |
[out] | ConfigImageSize | The size of the config image in bytes. |
TRUE | The config image is extracted. |
FALSE | The config image is not extracted. |
Definition at line 312 of file EdkiiSystemCapsuleLib.c.
BOOLEAN EFIAPI ExtractDriverFvImage | ( | IN VOID * | AuthenticatedImage, |
IN UINTN | AuthenticatedImageSize, | ||
OUT VOID ** | DriverFvImage, | ||
OUT UINTN * | DriverFvImageSize | ||
) |
Extract the driver FV from an authenticated image.
[in] | AuthenticatedImage | The authenticated capsule image. |
[in] | AuthenticatedImageSize | The size of the authenticated capsule image in bytes. |
[out] | DriverFvImage | The driver FV image. |
[out] | DriverFvImageSize | The size of the driver FV image in bytes. |
TRUE | The driver Fv is extracted. |
FALSE | The driver Fv is not extracted. |
Definition at line 269 of file EdkiiSystemCapsuleLib.c.
BOOLEAN EFIAPI ExtractSystemFirmwareImage | ( | IN VOID * | AuthenticatedImage, |
IN UINTN | AuthenticatedImageSize, | ||
OUT VOID ** | SystemFirmwareImage, | ||
OUT UINTN * | SystemFirmwareImageSize | ||
) |
Extract the System Firmware image from an authenticated image.
[in] | AuthenticatedImage | The authenticated capsule image. |
[in] | AuthenticatedImageSize | The size of the authenticated capsule image in bytes. |
[out] | SystemFirmwareImage | The System Firmware image. |
[out] | SystemFirmwareImageSize | The size of the System Firmware image in bytes. |
TRUE | The System Firmware image is extracted. |
FALSE | The System Firmware image is not extracted. |
Definition at line 539 of file EdkiiSystemCapsuleLib.c.
BOOLEAN EFIAPI ExtractSystemFirmwareImageFmpInfo | ( | IN VOID * | SystemFirmwareImage, |
IN UINTN | SystemFirmwareImageSize, | ||
OUT EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR ** | ImageFmpInfo, | ||
OUT UINTN * | ImageFmpInfoSize | ||
) |
Extract ImageFmpInfo from system firmware.
[in] | SystemFirmwareImage | The System Firmware image. |
[in] | SystemFirmwareImageSize | The size of the System Firmware image in bytes. |
[out] | ImageFmpInfo | The ImageFmpInfo. |
[out] | ImageFmpInfoSize | The size of the ImageFmpInfo in bytes. |
TRUE | The ImageFmpInfo is extracted. |
FALSE | The ImageFmpInfo is not extracted. |
Definition at line 481 of file EdkiiSystemCapsuleLib.c.
BOOLEAN GetFfsByName | ( | IN VOID * | FdStart, |
IN UINTN | FdSize, | ||
IN EFI_GUID * | FileName, | ||
IN EFI_FV_FILETYPE | Type, | ||
OUT VOID ** | OutFfsBuffer, | ||
OUT UINTN * | OutFfsBufferSize | ||
) |
Get FFS buffer pointer by FileName GUID and FileType.
[in] | FdStart | The System Firmware FD image |
[in] | FdSize | The size of System Firmware FD image |
[in] | FileName | The FileName GUID of FFS to be found |
[in] | Type | The FileType of FFS to be found |
[out] | OutFfsBuffer | The FFS buffer found, including FFS_FILE_HEADER |
[out] | OutFfsBufferSize | The size of FFS buffer found, including FFS_FILE_HEADER |
TRUE | The FFS buffer is found. |
FALSE | The FFS buffer is not found. |
Definition at line 157 of file EdkiiSystemCapsuleLib.c.
BOOLEAN GetSectionByType | ( | IN VOID * | SectionBuffer, |
IN UINT32 | SectionBufferSize, | ||
IN EFI_SECTION_TYPE | SectionType, | ||
IN UINTN | SectionInstance, | ||
OUT VOID ** | OutSectionBuffer, | ||
OUT UINTN * | OutSectionSize | ||
) |
Get Section buffer pointer by SectionType and SectionInstance.
[in] | SectionBuffer | The buffer of section |
[in] | SectionBufferSize | The size of SectionBuffer in bytes |
[in] | SectionType | The SectionType of Section to be found |
[in] | SectionInstance | The Instance of Section to be found |
[out] | OutSectionBuffer | The section found, including SECTION_HEADER |
[out] | OutSectionSize | The size of section found, including SECTION_HEADER |
TRUE | The FFS buffer is found. |
FALSE | The FFS buffer is not found. |
Definition at line 88 of file EdkiiSystemCapsuleLib.c.
Check if a block of buffer is erased.
[in] | ErasePolarity | Erase polarity attribute of the firmware volume |
[in] | InBuffer | The buffer to be checked |
[in] | BufferSize | Size of the buffer in bytes |
TRUE | The block of buffer is erased |
FALSE | The block of buffer is not erased |
Definition at line 48 of file EdkiiSystemCapsuleLib.c.
EFI_GUID mEdkiiSystemFirmwareFileGuid |
Definition at line 35 of file EdkiiSystemCapsuleLib.c.
EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR* mImageFmpInfo |
Definition at line 33 of file EdkiiSystemCapsuleLib.c.
UINTN mImageFmpInfoSize |
Definition at line 34 of file EdkiiSystemCapsuleLib.c.