Tcg2PhysicalPresenceLib.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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_HIERARCHY_CONTROL_STORAGE_DISABLE BIT8
  27. #define TCG2_BIOS_INFORMATION_FLAG_HIERARCHY_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. TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_ENABLE_BLOCK_SID)
  47. /**
  48. Check and execute the pending TPM request.
  49. The TPM request may come from OS or BIOS. This API will display request information and wait
  50. for user confirmation if TPM request exists. The TPM request will be sent to TPM device after
  51. the TPM request is confirmed, and one or more reset may be required to make TPM request to
  52. take effect.
  53. This API should be invoked after console in and console out are all ready as they are required
  54. to display request information and get user input to confirm the request.
  55. @param PlatformAuth platform auth value. NULL means no platform auth change.
  56. **/
  57. VOID
  58. EFIAPI
  59. Tcg2PhysicalPresenceLibProcessRequest (
  60. IN TPM2B_AUTH *PlatformAuth OPTIONAL
  61. );
  62. /**
  63. Check if the pending TPM request needs user input to confirm.
  64. The TPM request may come from OS. This API will check if TPM request exists and need user
  65. input to confirmation.
  66. @retval TRUE TPM needs input to confirm user physical presence.
  67. @retval FALSE TPM doesn't need input to confirm user physical presence.
  68. **/
  69. BOOLEAN
  70. EFIAPI
  71. Tcg2PhysicalPresenceLibNeedUserConfirm (
  72. VOID
  73. );
  74. /**
  75. Return TPM2 ManagementFlags set by PP interface.
  76. @retval ManagementFlags TPM2 Management Flags.
  77. **/
  78. UINT32
  79. EFIAPI
  80. Tcg2PhysicalPresenceLibGetManagementFlags (
  81. VOID
  82. );
  83. /**
  84. The handler for TPM physical presence function:
  85. Return TPM Operation Response to OS Environment.
  86. This API should be invoked in OS runtime phase to interface with ACPI method.
  87. @param[out] MostRecentRequest Most recent operation request.
  88. @param[out] Response Response to the most recent operation request.
  89. @return Return Code for Return TPM Operation Response to OS Environment.
  90. **/
  91. UINT32
  92. EFIAPI
  93. Tcg2PhysicalPresenceLibReturnOperationResponseToOsFunction (
  94. OUT UINT32 *MostRecentRequest,
  95. OUT UINT32 *Response
  96. );
  97. /**
  98. The handler for TPM physical presence function:
  99. Submit TPM Operation Request to Pre-OS Environment and
  100. Submit TPM Operation Request to Pre-OS Environment 2.
  101. This API should be invoked in OS runtime phase to interface with ACPI method.
  102. Caution: This function may receive untrusted input.
  103. @param[in, out] Pointer to OperationRequest TPM physical presence operation request.
  104. @param[in, out] Pointer to RequestParameter TPM physical presence operation request parameter.
  105. @return Return Code for Submit TPM Operation Request to Pre-OS Environment and
  106. Submit TPM Operation Request to Pre-OS Environment 2.
  107. **/
  108. UINT32
  109. Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunctionEx (
  110. IN OUT UINT32 *OperationRequest,
  111. IN OUT UINT32 *RequestParameter
  112. );
  113. /**
  114. The handler for TPM physical presence function:
  115. Submit TPM Operation Request to Pre-OS Environment and
  116. Submit TPM Operation Request to Pre-OS Environment 2.
  117. This API should be invoked in OS runtime phase to interface with ACPI method.
  118. Caution: This function may receive untrusted input.
  119. @param[in] OperationRequest TPM physical presence operation request.
  120. @param[in] RequestParameter TPM physical presence operation request parameter.
  121. @return Return Code for Submit TPM Operation Request to Pre-OS Environment and
  122. Submit TPM Operation Request to Pre-OS Environment 2.
  123. **/
  124. UINT32
  125. EFIAPI
  126. Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction (
  127. IN UINT32 OperationRequest,
  128. IN UINT32 RequestParameter
  129. );
  130. /**
  131. The handler for TPM physical presence function:
  132. Get User Confirmation Status for Operation.
  133. This API should be invoked in OS runtime phase to interface with ACPI method.
  134. Caution: This function may receive untrusted input.
  135. @param[in] OperationRequest TPM physical presence operation request.
  136. @return Return Code for Get User Confirmation Status for Operation.
  137. **/
  138. UINT32
  139. EFIAPI
  140. Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction (
  141. IN UINT32 OperationRequest
  142. );
  143. #endif