]> git.proxmox.com Git - mirror_edk2.git/blame - SignedCapsulePkg/Include/Library/EdkiiSystemCapsuleLib.h
SignedCapsulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / SignedCapsulePkg / Include / Library / EdkiiSystemCapsuleLib.h
CommitLineData
5f190b90
JY
1/** @file\r
2 EDKII System Capsule library.\r
3\r
4Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
fbf06957 5SPDX-License-Identifier: BSD-2-Clause-Patent\r
5f190b90
JY
6\r
7**/\r
8\r
9\r
10#ifndef __EDKII_SYSTEM_CAPSULE_LIB_H__\r
11#define __EDKII_SYSTEM_CAPSULE_LIB_H__\r
12\r
13#include <Guid/EdkiiSystemFmpCapsule.h>\r
14\r
15/**\r
16 Extract ImageFmpInfo from system firmware.\r
17\r
18 @param[in] SystemFirmwareImage The System Firmware image.\r
19 @param[in] SystemFirmwareImageSize The size of the System Firmware image in bytes.\r
20 @param[out] ImageFmpInfo The ImageFmpInfo.\r
21 @param[out] ImageFmpInfoSize The size of the ImageFmpInfo in bytes.\r
22\r
23 @retval TRUE The ImageFmpInfo is extracted.\r
24 @retval FALSE The ImageFmpInfo is not extracted.\r
25**/\r
26BOOLEAN\r
27EFIAPI\r
28ExtractSystemFirmwareImageFmpInfo (\r
29 IN VOID *SystemFirmwareImage,\r
30 IN UINTN SystemFirmwareImageSize,\r
31 OUT EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR **ImageFmpInfo,\r
32 OUT UINTN *ImageFmpInfoSize\r
33 );\r
34\r
35/**\r
36 Extract the driver FV from an authenticated image.\r
37\r
38 @param[in] AuthenticatedImage The authenticated capsule image.\r
39 @param[in] AuthenticatedImageSize The size of the authenticated capsule image in bytes.\r
40 @param[out] DriverFvImage The driver FV image.\r
41 @param[out] DriverFvImageSize The size of the driver FV image in bytes.\r
42\r
43 @retval TRUE The driver Fv is extracted.\r
44 @retval FALSE The driver Fv is not extracted.\r
45**/\r
46BOOLEAN\r
47EFIAPI\r
48ExtractDriverFvImage (\r
49 IN VOID *AuthenticatedImage,\r
50 IN UINTN AuthenticatedImageSize,\r
51 OUT VOID **DriverFvImage,\r
52 OUT UINTN *DriverFvImageSize\r
53 );\r
54\r
55/**\r
56 Extract the config image from an authenticated image.\r
57\r
58 @param[in] AuthenticatedImage The authenticated capsule image.\r
59 @param[in] AuthenticatedImageSize The size of the authenticated capsule image in bytes.\r
60 @param[out] ConfigImage The config image.\r
61 @param[out] ConfigImageSize The size of the config image in bytes.\r
62\r
63 @retval TRUE The config image is extracted.\r
64 @retval FALSE The config image is not extracted.\r
65**/\r
66BOOLEAN\r
67EFIAPI\r
68ExtractConfigImage (\r
69 IN VOID *AuthenticatedImage,\r
70 IN UINTN AuthenticatedImageSize,\r
71 OUT VOID **ConfigImage,\r
72 OUT UINTN *ConfigImageSize\r
73 );\r
74\r
75/**\r
76 Extract the System Firmware image from an authenticated image.\r
77\r
78 @param[in] AuthenticatedImage The authenticated capsule image.\r
79 @param[in] AuthenticatedImageSize The size of the authenticated capsule image in bytes.\r
80 @param[out] SystemFirmwareImage The System Firmware image.\r
81 @param[out] SystemFirmwareImageSize The size of the System Firmware image in bytes.\r
82\r
83 @retval TRUE The System Firmware image is extracted.\r
84 @retval FALSE The System Firmware image is not extracted.\r
85**/\r
86BOOLEAN\r
87EFIAPI\r
88ExtractSystemFirmwareImage (\r
89 IN VOID *AuthenticatedImage,\r
90 IN UINTN AuthenticatedImageSize,\r
91 OUT VOID **SystemFirmwareImage,\r
92 OUT UINTN *SystemFirmwareImageSize\r
93 );\r
94\r
95/**\r
96 Extract the authenticated image from an FMP capsule image.\r
97\r
98 @param[in] Image The FMP capsule image, including EFI_FIRMWARE_IMAGE_AUTHENTICATION.\r
99 @param[in] ImageSize The size of FMP capsule image in bytes.\r
100 @param[out] LastAttemptStatus The last attempt status, which will be recorded in ESRT and FMP EFI_FIRMWARE_IMAGE_DESCRIPTOR.\r
101 @param[out] AuthenticatedImage The authenticated capsule image, excluding EFI_FIRMWARE_IMAGE_AUTHENTICATION.\r
102 @param[out] AuthenticatedImageSize The size of the authenticated capsule image in bytes.\r
103\r
104 @retval TRUE The authenticated image is extracted.\r
105 @retval FALSE The authenticated image is not extracted.\r
106**/\r
107BOOLEAN\r
108EFIAPI\r
109ExtractAuthenticatedImage (\r
110 IN VOID *Image,\r
111 IN UINTN ImageSize,\r
112 OUT UINT32 *LastAttemptStatus,\r
113 OUT VOID **AuthenticatedImage,\r
114 OUT UINTN *AuthenticatedImageSize\r
115 );\r
116\r
117/**\r
118 Authenticated system firmware FMP capsule image.\r
119\r
120 Caution: This function may receive untrusted input.\r
121\r
122 @param[in] Image The FMP capsule image, including EFI_FIRMWARE_IMAGE_AUTHENTICATION.\r
123 @param[in] ImageSize The size of FMP capsule image in bytes.\r
124 @param[in] ForceVersionMatch TRUE: The version of capsule must be as same as the version of current image.\r
125 FALSE: The version of capsule must be as same as greater than the lowest\r
126 supported version of current image.\r
127 @param[out] LastAttemptVersion The last attempt version, which will be recorded in ESRT and FMP EFI_FIRMWARE_IMAGE_DESCRIPTOR.\r
128 @param[out] LastAttemptStatus The last attempt status, which will be recorded in ESRT and FMP EFI_FIRMWARE_IMAGE_DESCRIPTOR.\r
129 @param[out] AuthenticatedImage The authenticated capsule image, excluding EFI_FIRMWARE_IMAGE_AUTHENTICATION.\r
130 @param[out] AuthenticatedImageSize The size of the authenticated capsule image in bytes.\r
131\r
132 @retval TRUE Authentication passes and the authenticated image is extracted.\r
133 @retval FALSE Authentication fails and the authenticated image is not extracted.\r
134**/\r
135EFI_STATUS\r
136EFIAPI\r
137CapsuleAuthenticateSystemFirmware (\r
138 IN VOID *Image,\r
139 IN UINTN ImageSize,\r
140 IN BOOLEAN ForceVersionMatch,\r
141 OUT UINT32 *LastAttemptVersion,\r
142 OUT UINT32 *LastAttemptStatus,\r
143 OUT VOID **AuthenticatedImage,\r
144 OUT UINTN *AuthenticatedImageSize\r
145 );\r
146\r
147#endif\r
148\r