EdkiiSystemCapsuleLib.h 5.5 KB

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