]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SignedCapsulePkg/Include/Library/EdkiiSystemCapsuleLib.h
SignedCapsulePkg/Include: Add EdkiiSystemCapsuleLib definition.
[mirror_edk2.git] / SignedCapsulePkg / Include / Library / EdkiiSystemCapsuleLib.h
diff --git a/SignedCapsulePkg/Include/Library/EdkiiSystemCapsuleLib.h b/SignedCapsulePkg/Include/Library/EdkiiSystemCapsuleLib.h
new file mode 100644 (file)
index 0000000..11958e2
--- /dev/null
@@ -0,0 +1,154 @@
+/** @file\r
+  EDKII System Capsule library.\r
+\r
+Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+\r
+#ifndef __EDKII_SYSTEM_CAPSULE_LIB_H__\r
+#define __EDKII_SYSTEM_CAPSULE_LIB_H__\r
+\r
+#include <Guid/EdkiiSystemFmpCapsule.h>\r
+\r
+/**\r
+  Extract ImageFmpInfo from system firmware.\r
+\r
+  @param[in]  SystemFirmwareImage     The System Firmware image.\r
+  @param[in]  SystemFirmwareImageSize The size of the System Firmware image in bytes.\r
+  @param[out] ImageFmpInfo            The ImageFmpInfo.\r
+  @param[out] ImageFmpInfoSize        The size of the ImageFmpInfo in bytes.\r
+\r
+  @retval TRUE  The ImageFmpInfo is extracted.\r
+  @retval FALSE The ImageFmpInfo is not extracted.\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+ExtractSystemFirmwareImageFmpInfo (\r
+  IN VOID                                      *SystemFirmwareImage,\r
+  IN UINTN                                     SystemFirmwareImageSize,\r
+  OUT EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR   **ImageFmpInfo,\r
+  OUT UINTN                                    *ImageFmpInfoSize\r
+  );\r
+\r
+/**\r
+  Extract the driver FV from an authenticated image.\r
+\r
+  @param[in]  AuthenticatedImage      The authenticated capsule image.\r
+  @param[in]  AuthenticatedImageSize  The size of the authenticated capsule image in bytes.\r
+  @param[out] DriverFvImage           The driver FV image.\r
+  @param[out] DriverFvImageSize       The size of the driver FV image in bytes.\r
+\r
+  @retval TRUE  The driver Fv is extracted.\r
+  @retval FALSE The driver Fv is not extracted.\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+ExtractDriverFvImage (\r
+  IN VOID                         *AuthenticatedImage,\r
+  IN UINTN                        AuthenticatedImageSize,\r
+  OUT VOID                        **DriverFvImage,\r
+  OUT UINTN                       *DriverFvImageSize\r
+  );\r
+\r
+/**\r
+  Extract the config image from an authenticated image.\r
+\r
+  @param[in]  AuthenticatedImage      The authenticated capsule image.\r
+  @param[in]  AuthenticatedImageSize  The size of the authenticated capsule image in bytes.\r
+  @param[out] ConfigImage             The config image.\r
+  @param[out] ConfigImageSize         The size of the config image in bytes.\r
+\r
+  @retval TRUE  The config image is extracted.\r
+  @retval FALSE The config image is not extracted.\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+ExtractConfigImage (\r
+  IN VOID                         *AuthenticatedImage,\r
+  IN UINTN                        AuthenticatedImageSize,\r
+  OUT VOID                        **ConfigImage,\r
+  OUT UINTN                       *ConfigImageSize\r
+  );\r
+\r
+/**\r
+  Extract the System Firmware image from an authenticated image.\r
+\r
+  @param[in]  AuthenticatedImage      The authenticated capsule image.\r
+  @param[in]  AuthenticatedImageSize  The size of the authenticated capsule image in bytes.\r
+  @param[out] SystemFirmwareImage     The System Firmware image.\r
+  @param[out] SystemFirmwareImageSize The size of the System Firmware image in bytes.\r
+\r
+  @retval TRUE  The System Firmware image is extracted.\r
+  @retval FALSE The System Firmware image is not extracted.\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+ExtractSystemFirmwareImage (\r
+  IN VOID                         *AuthenticatedImage,\r
+  IN UINTN                        AuthenticatedImageSize,\r
+  OUT VOID                        **SystemFirmwareImage,\r
+  OUT UINTN                       *SystemFirmwareImageSize\r
+  );\r
+\r
+/**\r
+  Extract the authenticated image from an FMP capsule image.\r
+\r
+  @param[in]  Image                   The FMP capsule image, including EFI_FIRMWARE_IMAGE_AUTHENTICATION.\r
+  @param[in]  ImageSize               The size of FMP capsule image in bytes.\r
+  @param[out] LastAttemptStatus       The last attempt status, which will be recorded in ESRT and FMP EFI_FIRMWARE_IMAGE_DESCRIPTOR.\r
+  @param[out] AuthenticatedImage      The authenticated capsule image, excluding EFI_FIRMWARE_IMAGE_AUTHENTICATION.\r
+  @param[out] AuthenticatedImageSize  The size of the authenticated capsule image in bytes.\r
+\r
+  @retval TRUE  The authenticated image is extracted.\r
+  @retval FALSE The authenticated image is not extracted.\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+ExtractAuthenticatedImage (\r
+  IN VOID                         *Image,\r
+  IN UINTN                        ImageSize,\r
+  OUT UINT32                      *LastAttemptStatus,\r
+  OUT VOID                        **AuthenticatedImage,\r
+  OUT UINTN                       *AuthenticatedImageSize\r
+  );\r
+\r
+/**\r
+  Authenticated system firmware FMP capsule image.\r
+\r
+  Caution: This function may receive untrusted input.\r
+\r
+  @param[in]  Image                   The FMP capsule image, including EFI_FIRMWARE_IMAGE_AUTHENTICATION.\r
+  @param[in]  ImageSize               The size of FMP capsule image in bytes.\r
+  @param[in]  ForceVersionMatch       TRUE: The version of capsule must be as same as the version of current image.\r
+                                      FALSE: The version of capsule must be as same as greater than the lowest\r
+                                             supported version of current image.\r
+  @param[out] LastAttemptVersion      The last attempt version, which will be recorded in ESRT and FMP EFI_FIRMWARE_IMAGE_DESCRIPTOR.\r
+  @param[out] LastAttemptStatus       The last attempt status, which will be recorded in ESRT and FMP EFI_FIRMWARE_IMAGE_DESCRIPTOR.\r
+  @param[out] AuthenticatedImage      The authenticated capsule image, excluding EFI_FIRMWARE_IMAGE_AUTHENTICATION.\r
+  @param[out] AuthenticatedImageSize  The size of the authenticated capsule image in bytes.\r
+\r
+  @retval TRUE  Authentication passes and the authenticated image is extracted.\r
+  @retval FALSE Authentication fails and the authenticated image is not extracted.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+CapsuleAuthenticateSystemFirmware (\r
+  IN VOID                         *Image,\r
+  IN UINTN                        ImageSize,\r
+  IN BOOLEAN                      ForceVersionMatch,\r
+  OUT UINT32                      *LastAttemptVersion,\r
+  OUT UINT32                      *LastAttemptStatus,\r
+  OUT VOID                        **AuthenticatedImage,\r
+  OUT UINTN                       *AuthenticatedImageSize\r
+  );\r
+\r
+#endif\r
+\r