]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/Library/Tpm2CommandLib/Tpm2Capability.c
SecurityPkg: Clean up source files
[mirror_edk2.git] / SecurityPkg / Library / Tpm2CommandLib / Tpm2Capability.c
index b11a8ac3e27db800f4f879c3fe71f8ff0fac8d05..734cea7c1f632305326d705ac0c87dbb73b1311a 100644 (file)
@@ -48,25 +48,25 @@ typedef struct {
 /**\r
   This command returns various information regarding the TPM and its current state.\r
 \r
-  The capability parameter determines the category of data returned. The property parameter \r
-  selects the first value of the selected category to be returned. If there is no property \r
+  The capability parameter determines the category of data returned. The property parameter\r
+  selects the first value of the selected category to be returned. If there is no property\r
   that corresponds to the value of property, the next higher value is returned, if it exists.\r
-  The moreData parameter will have a value of YES if there are more values of the requested \r
+  The moreData parameter will have a value of YES if there are more values of the requested\r
   type that were not returned.\r
-  If no next capability exists, the TPM will return a zero-length list and moreData will have \r
+  If no next capability exists, the TPM will return a zero-length list and moreData will have\r
   a value of NO.\r
 \r
-  NOTE: \r
-  To simplify this function, leave returned CapabilityData for caller to unpack since there are \r
+  NOTE:\r
+  To simplify this function, leave returned CapabilityData for caller to unpack since there are\r
   many capability categories and only few categories will be used in firmware. It means the caller\r
   need swap the byte order for the feilds in CapabilityData.\r
 \r
   @param[in]  Capability         Group selection; determines the format of the response.\r
-  @param[in]  Property           Further definition of information. \r
+  @param[in]  Property           Further definition of information.\r
   @param[in]  PropertyCount      Number of properties of the indicated type to return.\r
   @param[out] MoreData           Flag to indicate if there are more values of this type.\r
   @param[out] CapabilityData     The capability data.\r
-  \r
+\r
   @retval EFI_SUCCESS            Operation completed successfully.\r
   @retval EFI_DEVICE_ERROR       The command was unsuccessful.\r
 **/\r
@@ -95,10 +95,10 @@ Tpm2GetCapability (
   SendBuffer.Capability = SwapBytes32 (Capability);\r
   SendBuffer.Property = SwapBytes32 (Property);\r
   SendBuffer.PropertyCount = SwapBytes32 (PropertyCount);\r
\r
+\r
   SendBufferSize = (UINT32) sizeof (SendBuffer);\r
   SendBuffer.Header.paramSize = SwapBytes32 (SendBufferSize);\r
-    \r
+\r
   //\r
   // send Tpm command\r
   //\r
@@ -128,7 +128,7 @@ Tpm2GetCapability (
   // Does not unpack all possiable property here, the caller should unpack it and note the byte order.\r
   //\r
   CopyMem (CapabilityData, &RecvBuffer.CapabilityData, RecvBufferSize - sizeof (TPM2_RESPONSE_HEADER) - sizeof (UINT8));\r
-  \r
+\r
   return EFI_SUCCESS;\r
 }\r
 \r
@@ -138,7 +138,7 @@ Tpm2GetCapability (
   This function parse the value got from TPM2_GetCapability and return the Family.\r
 \r
   @param[out] Family             The Family of TPM. (a 4-octet character string)\r
-  \r
+\r
   @retval EFI_SUCCESS            Operation completed successfully.\r
   @retval EFI_DEVICE_ERROR       The command was unsuccessful.\r
 **/\r
@@ -150,13 +150,13 @@ Tpm2GetCapabilityFamily (
 {\r
   TPMS_CAPABILITY_DATA    TpmCap;\r
   TPMI_YES_NO             MoreData;\r
-  EFI_STATUS              Status; \r
+  EFI_STATUS              Status;\r
 \r
   Status = Tpm2GetCapability (\r
-             TPM_CAP_TPM_PROPERTIES, \r
-             TPM_PT_FAMILY_INDICATOR, \r
-             1, \r
-             &MoreData, \r
+             TPM_CAP_TPM_PROPERTIES,\r
+             TPM_PT_FAMILY_INDICATOR,\r
+             1,\r
+             &MoreData,\r
              &TpmCap\r
              );\r
   if (EFI_ERROR (Status)) {\r
@@ -173,7 +173,7 @@ Tpm2GetCapabilityFamily (
   This function parse the value got from TPM2_GetCapability and return the TPM manufacture ID.\r
 \r
   @param[out] ManufactureId      The manufacture ID of TPM.\r
-  \r
+\r
   @retval EFI_SUCCESS            Operation completed successfully.\r
   @retval EFI_DEVICE_ERROR       The command was unsuccessful.\r
 **/\r
@@ -185,13 +185,13 @@ Tpm2GetCapabilityManufactureID (
 {\r
   TPMS_CAPABILITY_DATA    TpmCap;\r
   TPMI_YES_NO             MoreData;\r
-  EFI_STATUS              Status; \r
+  EFI_STATUS              Status;\r
 \r
   Status = Tpm2GetCapability (\r
-             TPM_CAP_TPM_PROPERTIES, \r
-             TPM_PT_MANUFACTURER, \r
-             1, \r
-             &MoreData, \r
+             TPM_CAP_TPM_PROPERTIES,\r
+             TPM_PT_MANUFACTURER,\r
+             1,\r
+             &MoreData,\r
              &TpmCap\r
              );\r
   if (EFI_ERROR (Status)) {\r
@@ -209,7 +209,7 @@ Tpm2GetCapabilityManufactureID (
 \r
   @param[out] FirmwareVersion1   The FirmwareVersion1.\r
   @param[out] FirmwareVersion2   The FirmwareVersion2.\r
-  \r
+\r
   @retval EFI_SUCCESS            Operation completed successfully.\r
   @retval EFI_DEVICE_ERROR       The command was unsuccessful.\r
 **/\r
@@ -222,13 +222,13 @@ Tpm2GetCapabilityFirmwareVersion (
 {\r
   TPMS_CAPABILITY_DATA    TpmCap;\r
   TPMI_YES_NO             MoreData;\r
-  EFI_STATUS              Status; \r
+  EFI_STATUS              Status;\r
 \r
   Status = Tpm2GetCapability (\r
-             TPM_CAP_TPM_PROPERTIES, \r
-             TPM_PT_FIRMWARE_VERSION_1, \r
-             1, \r
-             &MoreData, \r
+             TPM_CAP_TPM_PROPERTIES,\r
+             TPM_PT_FIRMWARE_VERSION_1,\r
+             1,\r
+             &MoreData,\r
              &TpmCap\r
              );\r
   if (EFI_ERROR (Status)) {\r
@@ -237,10 +237,10 @@ Tpm2GetCapabilityFirmwareVersion (
   *FirmwareVersion1 = SwapBytes32 (TpmCap.data.tpmProperties.tpmProperty->value);\r
 \r
   Status = Tpm2GetCapability (\r
-             TPM_CAP_TPM_PROPERTIES, \r
-             TPM_PT_FIRMWARE_VERSION_2, \r
-             1, \r
-             &MoreData, \r
+             TPM_CAP_TPM_PROPERTIES,\r
+             TPM_PT_FIRMWARE_VERSION_2,\r
+             1,\r
+             &MoreData,\r
              &TpmCap\r
              );\r
   if (EFI_ERROR (Status)) {\r
@@ -258,7 +258,7 @@ Tpm2GetCapabilityFirmwareVersion (
 \r
   @param[out] MaxCommandSize     The maximum value for commandSize in a command.\r
   @param[out] MaxResponseSize    The maximum value for responseSize in a command.\r
-  \r
+\r
   @retval EFI_SUCCESS            Operation completed successfully.\r
   @retval EFI_DEVICE_ERROR       The command was unsuccessful.\r
 **/\r
@@ -274,10 +274,10 @@ Tpm2GetCapabilityMaxCommandResponseSize (
   EFI_STATUS              Status;\r
 \r
   Status = Tpm2GetCapability (\r
-             TPM_CAP_TPM_PROPERTIES, \r
-             TPM_PT_MAX_COMMAND_SIZE, \r
-             1, \r
-             &MoreData, \r
+             TPM_CAP_TPM_PROPERTIES,\r
+             TPM_PT_MAX_COMMAND_SIZE,\r
+             1,\r
+             &MoreData,\r
              &TpmCap\r
              );\r
   if (EFI_ERROR (Status)) {\r
@@ -287,10 +287,10 @@ Tpm2GetCapabilityMaxCommandResponseSize (
   *MaxCommandSize = SwapBytes32 (TpmCap.data.tpmProperties.tpmProperty->value);\r
 \r
   Status = Tpm2GetCapability (\r
-             TPM_CAP_TPM_PROPERTIES, \r
-             TPM_PT_MAX_RESPONSE_SIZE, \r
-             1, \r
-             &MoreData, \r
+             TPM_CAP_TPM_PROPERTIES,\r
+             TPM_PT_MAX_RESPONSE_SIZE,\r
+             1,\r
+             &MoreData,\r
              &TpmCap\r
              );\r
   if (EFI_ERROR (Status)) {\r
@@ -298,17 +298,17 @@ Tpm2GetCapabilityMaxCommandResponseSize (
   }\r
 \r
   *MaxResponseSize = SwapBytes32 (TpmCap.data.tpmProperties.tpmProperty->value);\r
-  return EFI_SUCCESS; \r
+  return EFI_SUCCESS;\r
 }\r
 \r
 /**\r
   This command returns Returns a list of TPMS_ALG_PROPERTIES. Each entry is an\r
-  algorithm ID and a set of properties of the algorithm. \r
+  algorithm ID and a set of properties of the algorithm.\r
 \r
   This function parse the value got from TPM2_GetCapability and return the list.\r
 \r
   @param[out] AlgList      List of algorithm.\r
-  \r
+\r
   @retval EFI_SUCCESS            Operation completed successfully.\r
   @retval EFI_DEVICE_ERROR       The command was unsuccessful.\r
 **/\r
@@ -322,24 +322,24 @@ Tpm2GetCapabilitySupportedAlg (
   TPMI_YES_NO             MoreData;\r
   UINTN                   Index;\r
   EFI_STATUS              Status;\r
\r
+\r
   Status = Tpm2GetCapability (\r
-             TPM_CAP_ALGS, \r
-             1, \r
-             MAX_CAP_ALGS, \r
-             &MoreData, \r
+             TPM_CAP_ALGS,\r
+             1,\r
+             MAX_CAP_ALGS,\r
+             &MoreData,\r
              &TpmCap\r
              );\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
-  \r
+\r
   CopyMem (AlgList, &TpmCap.data.algorithms, sizeof (TPML_ALG_PROPERTY));\r
 \r
   AlgList->count = SwapBytes32 (AlgList->count);\r
   if (AlgList->count > MAX_CAP_ALGS) {\r
     DEBUG ((DEBUG_ERROR, "Tpm2GetCapabilitySupportedAlg - AlgList->count error %x\n", AlgList->count));\r
-    return EFI_DEVICE_ERROR; \r
+    return EFI_DEVICE_ERROR;\r
   }\r
 \r
   for (Index = 0; Index < AlgList->count; Index++) {\r
@@ -356,7 +356,7 @@ Tpm2GetCapabilitySupportedAlg (
   This function parse the value got from TPM2_GetCapability and return the LockoutCounter.\r
 \r
   @param[out] LockoutCounter     The LockoutCounter of TPM.\r
-  \r
+\r
   @retval EFI_SUCCESS            Operation completed successfully.\r
   @retval EFI_DEVICE_ERROR       The command was unsuccessful.\r
 **/\r
@@ -368,13 +368,13 @@ Tpm2GetCapabilityLockoutCounter (
 {\r
   TPMS_CAPABILITY_DATA    TpmCap;\r
   TPMI_YES_NO             MoreData;\r
-  EFI_STATUS              Status; \r
+  EFI_STATUS              Status;\r
 \r
   Status = Tpm2GetCapability (\r
-             TPM_CAP_TPM_PROPERTIES, \r
-             TPM_PT_LOCKOUT_COUNTER, \r
-             1, \r
-             &MoreData, \r
+             TPM_CAP_TPM_PROPERTIES,\r
+             TPM_PT_LOCKOUT_COUNTER,\r
+             1,\r
+             &MoreData,\r
              &TpmCap\r
              );\r
   if (EFI_ERROR (Status)) {\r
@@ -391,7 +391,7 @@ Tpm2GetCapabilityLockoutCounter (
   This function parse the value got from TPM2_GetCapability and return the LockoutInterval.\r
 \r
   @param[out] LockoutInterval    The LockoutInterval of TPM.\r
-  \r
+\r
   @retval EFI_SUCCESS            Operation completed successfully.\r
   @retval EFI_DEVICE_ERROR       The command was unsuccessful.\r
 **/\r
@@ -403,13 +403,13 @@ Tpm2GetCapabilityLockoutInterval (
 {\r
   TPMS_CAPABILITY_DATA    TpmCap;\r
   TPMI_YES_NO             MoreData;\r
-  EFI_STATUS              Status; \r
+  EFI_STATUS              Status;\r
 \r
   Status = Tpm2GetCapability (\r
-             TPM_CAP_TPM_PROPERTIES, \r
-             TPM_PT_LOCKOUT_INTERVAL, \r
-             1, \r
-             &MoreData, \r
+             TPM_CAP_TPM_PROPERTIES,\r
+             TPM_PT_LOCKOUT_INTERVAL,\r
+             1,\r
+             &MoreData,\r
              &TpmCap\r
              );\r
   if (EFI_ERROR (Status)) {\r
@@ -427,7 +427,7 @@ Tpm2GetCapabilityLockoutInterval (
 \r
   @param[out] InputBufferSize    The InputBufferSize of TPM.\r
                                  the maximum size of a parameter (typically, a TPM2B_MAX_BUFFER)\r
-  \r
+\r
   @retval EFI_SUCCESS            Operation completed successfully.\r
   @retval EFI_DEVICE_ERROR       The command was unsuccessful.\r
 **/\r
@@ -439,13 +439,13 @@ Tpm2GetCapabilityInputBufferSize (
 {\r
   TPMS_CAPABILITY_DATA    TpmCap;\r
   TPMI_YES_NO             MoreData;\r
-  EFI_STATUS              Status; \r
+  EFI_STATUS              Status;\r
 \r
   Status = Tpm2GetCapability (\r
-             TPM_CAP_TPM_PROPERTIES, \r
-             TPM_PT_INPUT_BUFFER, \r
-             1, \r
-             &MoreData, \r
+             TPM_CAP_TPM_PROPERTIES,\r
+             TPM_PT_INPUT_BUFFER,\r
+             1,\r
+             &MoreData,\r
              &TpmCap\r
              );\r
   if (EFI_ERROR (Status)) {\r
@@ -462,7 +462,7 @@ Tpm2GetCapabilityInputBufferSize (
   This function parse the value got from TPM2_GetCapability and return the PcrSelection.\r
 \r
   @param[out] Pcrs    The Pcr Selection\r
-  \r
+\r
   @retval EFI_SUCCESS            Operation completed successfully.\r
   @retval EFI_DEVICE_ERROR       The command was unsuccessful.\r
 **/\r
@@ -478,10 +478,10 @@ Tpm2GetCapabilityPcrs (
   UINTN                   Index;\r
 \r
   Status = Tpm2GetCapability (\r
-             TPM_CAP_PCRS, \r
-             0, \r
-             1, \r
-             &MoreData, \r
+             TPM_CAP_PCRS,\r
+             0,\r
+             1,\r
+             &MoreData,\r
              &TpmCap\r
              );\r
   if (EFI_ERROR (Status)) {\r
@@ -605,7 +605,7 @@ Tpm2GetCapabilitySupportedAndActivePcrs (
   This function parse the value got from TPM2_GetCapability and return the AlgorithmSet.\r
 \r
   @param[out] AlgorithmSet    The AlgorithmSet of TPM.\r
-  \r
+\r
   @retval EFI_SUCCESS            Operation completed successfully.\r
   @retval EFI_DEVICE_ERROR       The command was unsuccessful.\r
 **/\r
@@ -617,13 +617,13 @@ Tpm2GetCapabilityAlgorithmSet (
 {\r
   TPMS_CAPABILITY_DATA    TpmCap;\r
   TPMI_YES_NO             MoreData;\r
-  EFI_STATUS              Status; \r
+  EFI_STATUS              Status;\r
 \r
   Status = Tpm2GetCapability (\r
-             TPM_CAP_TPM_PROPERTIES, \r
-             TPM_PT_ALGORITHM_SET, \r
-             1, \r
-             &MoreData, \r
+             TPM_CAP_TPM_PROPERTIES,\r
+             TPM_PT_ALGORITHM_SET,\r
+             1,\r
+             &MoreData,\r
              &TpmCap\r
              );\r
   if (EFI_ERROR (Status)) {\r