Tcg2PhysicalPresenceLib.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. /** @file
  2. This library is intended to be used by BDS modules.
  3. This library will execute TPM2 request.
  4. Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
  5. SPDX-License-Identifier: BSD-2-Clause-Patent
  6. **/
  7. #ifndef _TCG2_PHYSICAL_PRESENCE_LIB_H_
  8. #define _TCG2_PHYSICAL_PRESENCE_LIB_H_
  9. #include <IndustryStandard/Tpm20.h>
  10. #include <IndustryStandard/TcgPhysicalPresence.h>
  11. #include <Protocol/Tcg2Protocol.h>
  12. //
  13. // UEFI TCG2 library definition bit of the BIOS TPM Management Flags
  14. //
  15. // BIT0 is reserved
  16. #define TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CLEAR BIT1
  17. // BIT2 is reserved
  18. #define TCG2_LIB_PP_FLAG_RESET_TRACK BIT3
  19. #define TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_TURN_ON BIT4
  20. #define TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_TURN_OFF BIT5
  21. #define TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CHANGE_EPS BIT6
  22. #define TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CHANGE_PCRS BIT7
  23. //
  24. // UEFI TCG2 library definition bit of the BIOS Information Flags
  25. //
  26. #define TCG2_BIOS_INFORMATION_FLAG_HIERACHY_CONTROL_STORAGE_DISABLE BIT8
  27. #define TCG2_BIOS_INFORMATION_FLAG_HIERACHY_CONTROL_ENDORSEMENT_DISABLE BIT9
  28. //
  29. // UEFI TCG2 library definition bit of the BIOS Storage Management Flags
  30. //
  31. #define TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_PP_REQUIRED_FOR_ENABLE_BLOCK_SID BIT16
  32. #define TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_PP_REQUIRED_FOR_DISABLE_BLOCK_SID BIT17
  33. #define TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_ENABLE_BLOCK_SID BIT18
  34. //
  35. // Default value
  36. //
  37. #define TCG2_BIOS_TPM_MANAGEMENT_FLAG_DEFAULT (TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_TURN_OFF | \
  38. TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CLEAR | \
  39. TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CHANGE_EPS | \
  40. TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CHANGE_PCRS)
  41. //
  42. // Default value
  43. //
  44. #define TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_DEFAULT (TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_PP_REQUIRED_FOR_ENABLE_BLOCK_SID | \
  45. TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_PP_REQUIRED_FOR_DISABLE_BLOCK_SID)
  46. /**
  47. Check and execute the pending TPM request.
  48. The TPM request may come from OS or BIOS. This API will display request information and wait
  49. for user confirmation if TPM request exists. The TPM request will be sent to TPM device after
  50. the TPM request is confirmed, and one or more reset may be required to make TPM request to
  51. take effect.
  52. This API should be invoked after console in and console out are all ready as they are required
  53. to display request information and get user input to confirm the request.
  54. @param PlatformAuth platform auth value. NULL means no platform auth change.
  55. **/
  56. VOID
  57. EFIAPI
  58. Tcg2PhysicalPresenceLibProcessRequest (
  59. IN TPM2B_AUTH *PlatformAuth OPTIONAL
  60. );
  61. /**
  62. Check if the pending TPM request needs user input to confirm.
  63. The TPM request may come from OS. This API will check if TPM request exists and need user
  64. input to confirmation.
  65. @retval TRUE TPM needs input to confirm user physical presence.
  66. @retval FALSE TPM doesn't need input to confirm user physical presence.
  67. **/
  68. BOOLEAN
  69. EFIAPI
  70. Tcg2PhysicalPresenceLibNeedUserConfirm (
  71. VOID
  72. );
  73. /**
  74. Return TPM2 ManagementFlags set by PP interface.
  75. @retval ManagementFlags TPM2 Management Flags.
  76. **/
  77. UINT32
  78. EFIAPI
  79. Tcg2PhysicalPresenceLibGetManagementFlags (
  80. VOID
  81. );
  82. /**
  83. The handler for TPM physical presence function:
  84. Return TPM Operation Response to OS Environment.
  85. This API should be invoked in OS runtime phase to interface with ACPI method.
  86. @param[out] MostRecentRequest Most recent operation request.
  87. @param[out] Response Response to the most recent operation request.
  88. @return Return Code for Return TPM Operation Response to OS Environment.
  89. **/
  90. UINT32
  91. EFIAPI
  92. Tcg2PhysicalPresenceLibReturnOperationResponseToOsFunction (
  93. OUT UINT32 *MostRecentRequest,
  94. OUT UINT32 *Response
  95. );
  96. /**
  97. The handler for TPM physical presence function:
  98. Submit TPM Operation Request to Pre-OS Environment and
  99. Submit TPM Operation Request to Pre-OS Environment 2.
  100. This API should be invoked in OS runtime phase to interface with ACPI method.
  101. Caution: This function may receive untrusted input.
  102. @param[in, out] Pointer to OperationRequest TPM physical presence operation request.
  103. @param[in, out] Pointer to RequestParameter TPM physical presence operation request parameter.
  104. @return Return Code for Submit TPM Operation Request to Pre-OS Environment and
  105. Submit TPM Operation Request to Pre-OS Environment 2.
  106. **/
  107. UINT32
  108. Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunctionEx (
  109. IN OUT UINT32 *OperationRequest,
  110. IN OUT UINT32 *RequestParameter
  111. );
  112. /**
  113. The handler for TPM physical presence function:
  114. Submit TPM Operation Request to Pre-OS Environment and
  115. Submit TPM Operation Request to Pre-OS Environment 2.
  116. This API should be invoked in OS runtime phase to interface with ACPI method.
  117. Caution: This function may receive untrusted input.
  118. @param[in] OperationRequest TPM physical presence operation request.
  119. @param[in] RequestParameter TPM physical presence operation request parameter.
  120. @return Return Code for Submit TPM Operation Request to Pre-OS Environment and
  121. Submit TPM Operation Request to Pre-OS Environment 2.
  122. **/
  123. UINT32
  124. EFIAPI
  125. Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction (
  126. IN UINT32 OperationRequest,
  127. IN UINT32 RequestParameter
  128. );
  129. /**
  130. The handler for TPM physical presence function:
  131. Get User Confirmation Status for Operation.
  132. This API should be invoked in OS runtime phase to interface with ACPI method.
  133. Caution: This function may receive untrusted input.
  134. @param[in] OperationRequest TPM physical presence operation request.
  135. @return Return Code for Get User Confirmation Status for Operation.
  136. **/
  137. UINT32
  138. EFIAPI
  139. Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction (
  140. IN UINT32 OperationRequest
  141. );
  142. #endif