public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v4 0/2] refine TPM2 operation pull down list
@ 2020-07-28  8:20 Qi Zhang
  2020-07-28  8:20 ` [PATCH v4 1/2] SecurityPkg/Tpm2CommandLib: add a new function Qi Zhang
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Qi Zhang @ 2020-07-28  8:20 UTC (permalink / raw)
  To: devel; +Cc: Qi Zhang, Jiewen Yao, Jian J Wang, Chao Zhang, Rahul Kumar

v2 change: separate the change into two patches
v3 change: rename Tpm2GetCapabilityIsCmdImpl to Tpm2GetCapabilityIsCommandImplemented
v4 change: fix two build errors reported by CI

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Signed-off-by: Qi Zhang <qi1.zhang@intel.com>

Qi Zhang (1):
  SecurityPkg/Tcg2Config: remove TPM2_ChangEPS if it is not supported.

Zhang, Qi (1):
  SecurityPkg/Tpm2CommandLib: add a new function

 SecurityPkg/Include/Library/Tpm2CommandLib.h  | 16 ++++++++
 .../Library/Tpm2CommandLib/Tpm2Capability.c   | 40 +++++++++++++++++++
 SecurityPkg/Tcg/Tcg2Config/Tcg2Config.vfr     |  2 +
 SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c   |  7 ++++
 SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigNvData.h |  1 +
 5 files changed, 66 insertions(+)

-- 
2.26.2.windows.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v4 1/2] SecurityPkg/Tpm2CommandLib: add a new function
  2020-07-28  8:20 [PATCH v4 0/2] refine TPM2 operation pull down list Qi Zhang
@ 2020-07-28  8:20 ` Qi Zhang
  2020-08-03 14:33   ` [edk2-devel] " Wang, Jian J
  2020-07-28  8:20 ` [PATCH v4 2/2] SecurityPkg/Tcg2Config: remove TPM2_ChangEPS if it is not supported Qi Zhang
  2020-08-03 14:35 ` [PATCH v4 0/2] refine TPM2 operation pull down list Wang, Jian J
  2 siblings, 1 reply; 6+ messages in thread
From: Qi Zhang @ 2020-07-28  8:20 UTC (permalink / raw)
  To: devel; +Cc: Zhang, Qi, Jiewen Yao, Jian J Wang, Chao Zhang, Rahul Kumar

From: "Zhang, Qi" <qi1.zhang@intel.com>

 Tpm2GetCapabilityIsCommandImplemented

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2793

check if the commad is supported by comparing the command code with
command index.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Signed-off-by: Qi Zhang <qi1.zhang@intel.com>
---
 SecurityPkg/Include/Library/Tpm2CommandLib.h  | 16 ++++++++
 .../Library/Tpm2CommandLib/Tpm2Capability.c   | 40 +++++++++++++++++++
 2 files changed, 56 insertions(+)

diff --git a/SecurityPkg/Include/Library/Tpm2CommandLib.h b/SecurityPkg/Include/Library/Tpm2CommandLib.h
index ce381e786b..ee8eb62295 100644
--- a/SecurityPkg/Include/Library/Tpm2CommandLib.h
+++ b/SecurityPkg/Include/Library/Tpm2CommandLib.h
@@ -790,6 +790,22 @@ Tpm2GetCapabilityAlgorithmSet (
   OUT     UINT32      *AlgorithmSet
   );
 
+/**
+  This function will query if the command is supported.
+
+  @param[In]  Command         TPM_CC command starts from TPM_CC_FIRST.
+  @param[out] IsCmdImpl       The command is supported or not.
+
+  @retval EFI_SUCCESS            Operation completed successfully.
+  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
+**/
+EFI_STATUS
+EFIAPI
+Tpm2GetCapabilityIsCommandImplemented (
+  IN      TPM_CC      Command,
+  OUT     BOOLEAN     *IsCmdImpl
+  );
+
 /**
   This command is used to check to see if specific combinations of algorithm parameters are supported.
 
diff --git a/SecurityPkg/Library/Tpm2CommandLib/Tpm2Capability.c b/SecurityPkg/Library/Tpm2CommandLib/Tpm2Capability.c
index 85b11c7715..17c0c3a151 100644
--- a/SecurityPkg/Library/Tpm2CommandLib/Tpm2Capability.c
+++ b/SecurityPkg/Library/Tpm2CommandLib/Tpm2Capability.c
@@ -39,6 +39,8 @@ typedef struct {
 
 #pragma pack()
 
+#define TPMA_CC_COMMANDINDEX_MASK  0x2000FFFF
+
 /**
   This command returns various information regarding the TPM and its current state.
 
@@ -628,6 +630,44 @@ Tpm2GetCapabilityAlgorithmSet (
   return EFI_SUCCESS;
 }
 
+/**
+  This function will query if the command is supported.
+
+  @param[In]  Command         TPM_CC command starts from TPM_CC_FIRST.
+  @param[out] IsCmdImpl       The command is supported or not.
+
+  @retval EFI_SUCCESS            Operation completed successfully.
+  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
+**/
+EFI_STATUS
+EFIAPI
+Tpm2GetCapabilityIsCommandImplemented (
+  IN      TPM_CC      Command,
+  OUT     BOOLEAN     *IsCmdImpl
+  )
+{
+  TPMS_CAPABILITY_DATA    TpmCap;
+  TPMI_YES_NO             MoreData;
+  EFI_STATUS              Status;
+  UINT32                  Attribute;
+
+  Status = Tpm2GetCapability (
+             TPM_CAP_COMMANDS,
+             Command,
+             1,
+             &MoreData,
+             &TpmCap
+             );
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
+
+  CopyMem (&Attribute, &TpmCap.data.command.commandAttributes[0], sizeof (UINT32));
+  *IsCmdImpl = (Command == (SwapBytes32(Attribute) & TPMA_CC_COMMANDINDEX_MASK));
+
+  return EFI_SUCCESS;
+}
+
 /**
   This command is used to check to see if specific combinations of algorithm parameters are supported.
 
-- 
2.26.2.windows.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v4 2/2] SecurityPkg/Tcg2Config: remove TPM2_ChangEPS if it is not supported.
  2020-07-28  8:20 [PATCH v4 0/2] refine TPM2 operation pull down list Qi Zhang
  2020-07-28  8:20 ` [PATCH v4 1/2] SecurityPkg/Tpm2CommandLib: add a new function Qi Zhang
@ 2020-07-28  8:20 ` Qi Zhang
  2020-08-03 14:32   ` [edk2-devel] " Wang, Jian J
  2020-08-03 14:35 ` [PATCH v4 0/2] refine TPM2 operation pull down list Wang, Jian J
  2 siblings, 1 reply; 6+ messages in thread
From: Qi Zhang @ 2020-07-28  8:20 UTC (permalink / raw)
  To: devel; +Cc: Qi Zhang, Jiewen Yao, Jian J Wang, Chao Zhang, Rahul Kumar

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2793

In current implementation TPM2_ChangeEPS command is always available
in the TPM2 operation pull down list in TCG2 Configuration, which
is confusing when the command is not supported by specific TPM chip.
As a user experience improvement, TPM2_ChangeEPS command should be
removed from the list when it is not supported.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Signed-off-by: Qi Zhang <qi1.zhang@intel.com>
---
 SecurityPkg/Tcg/Tcg2Config/Tcg2Config.vfr     | 2 ++
 SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c   | 7 +++++++
 SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigNvData.h | 1 +
 3 files changed, 10 insertions(+)

diff --git a/SecurityPkg/Tcg/Tcg2Config/Tcg2Config.vfr b/SecurityPkg/Tcg/Tcg2Config/Tcg2Config.vfr
index 91a463997c..47d63b009d 100644
--- a/SecurityPkg/Tcg/Tcg2Config/Tcg2Config.vfr
+++ b/SecurityPkg/Tcg/Tcg2Config/Tcg2Config.vfr
@@ -144,7 +144,9 @@ formset
             option text = STRING_TOKEN(STR_TCG2_DISABLE), value = TCG2_PHYSICAL_PRESENCE_DISABLE, flags = RESET_REQUIRED;
             option text = STRING_TOKEN(STR_TCG2_CLEAR), value = TCG2_PHYSICAL_PRESENCE_CLEAR, flags = RESET_REQUIRED;
             option text = STRING_TOKEN(STR_TCG2_SET_PCD_BANKS), value = TCG2_PHYSICAL_PRESENCE_SET_PCR_BANKS, flags = RESET_REQUIRED;
+            suppressif ideqval TCG2_CONFIGURATION_INFO.ChangeEPSSupported == 0;
             option text = STRING_TOKEN(STR_TCG2_CHANGE_EPS), value = TCG2_PHYSICAL_PRESENCE_CHANGE_EPS, flags = RESET_REQUIRED;
+            endif
             option text = STRING_TOKEN(STR_TCG2_LOG_ALL_DIGESTS), value = TCG2_PHYSICAL_PRESENCE_LOG_ALL_DIGESTS, flags = RESET_REQUIRED;
             option text = STRING_TOKEN(STR_TCG2_DISABLE_ENDORSEMENT_ENABLE_STORAGE_HIERARCHY), value = TCG2_PHYSICAL_PRESENCE_DISABLE_ENDORSEMENT_ENABLE_STORAGE_HIERARCHY, flags = RESET_REQUIRED;
     endoneof;
diff --git a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c
index baa8fcd08d..2946f95db0 100644
--- a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c
+++ b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c
@@ -788,6 +788,7 @@ InstallTcg2ConfigForm (
   CHAR16                          TempBuffer[1024];
   TCG2_CONFIGURATION_INFO         Tcg2ConfigInfo;
   TPM2_PTP_INTERFACE_TYPE         TpmDeviceInterfaceDetected;
+  BOOLEAN                         IsCmdImp = FALSE;
 
   DriverHandle = NULL;
   ConfigAccess = &PrivateData->ConfigAccess;
@@ -870,6 +871,12 @@ InstallTcg2ConfigForm (
     HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TPM2_SUPPORTED_HASH_ALGO_CONTENT), TempBuffer, NULL);
   }
 
+  Status = Tpm2GetCapabilityIsCommandImplemented (TPM_CC_ChangeEPS, &IsCmdImp);
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR, "Tpm2GetCapabilityIsCmdImpl fails %r\n", Status));
+  }
+  Tcg2ConfigInfo.ChangeEPSSupported = IsCmdImp;
+
   FillBufferWithBootHashAlg (TempBuffer, sizeof(TempBuffer), PcdGet32 (PcdTcg2HashAlgorithmBitmap));
   HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_BIOS_HASH_ALGO_CONTENT), TempBuffer, NULL);
 
diff --git a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigNvData.h b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigNvData.h
index a91c052850..b84af40a04 100644
--- a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigNvData.h
+++ b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigNvData.h
@@ -70,6 +70,7 @@ typedef struct {
   UINT8    TpmDeviceInterfaceAttempt;
   BOOLEAN  TpmDeviceInterfacePtpFifoSupported;
   BOOLEAN  TpmDeviceInterfacePtpCrbSupported;
+  BOOLEAN  ChangeEPSSupported;
 } TCG2_CONFIGURATION_INFO;
 
 //
-- 
2.26.2.windows.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [edk2-devel] [PATCH v4 2/2] SecurityPkg/Tcg2Config: remove TPM2_ChangEPS if it is not supported.
  2020-07-28  8:20 ` [PATCH v4 2/2] SecurityPkg/Tcg2Config: remove TPM2_ChangEPS if it is not supported Qi Zhang
@ 2020-08-03 14:32   ` Wang, Jian J
  0 siblings, 0 replies; 6+ messages in thread
From: Wang, Jian J @ 2020-08-03 14:32 UTC (permalink / raw)
  To: devel@edk2.groups.io, Zhang, Qi1; +Cc: Yao, Jiewen, Chao Zhang, Kumar, Rahul1



Reviewed-by: Jian J Wang <jian.j.wang@intel.com>

Regards,
Jian

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Qi Zhang
> Sent: Tuesday, July 28, 2020 4:21 PM
> To: devel@edk2.groups.io
> Cc: Zhang, Qi1 <qi1.zhang@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>;
> Wang, Jian J <jian.j.wang@intel.com>; Chao Zhang <chao.b.zhang@intel.com>;
> Kumar, Rahul1 <rahul1.kumar@intel.com>
> Subject: [edk2-devel] [PATCH v4 2/2] SecurityPkg/Tcg2Config: remove
> TPM2_ChangEPS if it is not supported.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2793
> 
> In current implementation TPM2_ChangeEPS command is always available
> in the TPM2 operation pull down list in TCG2 Configuration, which
> is confusing when the command is not supported by specific TPM chip.
> As a user experience improvement, TPM2_ChangeEPS command should be
> removed from the list when it is not supported.
> 
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Chao Zhang <chao.b.zhang@intel.com>
> Cc: Rahul Kumar <rahul1.kumar@intel.com>
> Signed-off-by: Qi Zhang <qi1.zhang@intel.com>
> ---
>  SecurityPkg/Tcg/Tcg2Config/Tcg2Config.vfr     | 2 ++
>  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c   | 7 +++++++
>  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigNvData.h | 1 +
>  3 files changed, 10 insertions(+)
> 
> diff --git a/SecurityPkg/Tcg/Tcg2Config/Tcg2Config.vfr
> b/SecurityPkg/Tcg/Tcg2Config/Tcg2Config.vfr
> index 91a463997c..47d63b009d 100644
> --- a/SecurityPkg/Tcg/Tcg2Config/Tcg2Config.vfr
> +++ b/SecurityPkg/Tcg/Tcg2Config/Tcg2Config.vfr
> @@ -144,7 +144,9 @@ formset
>              option text = STRING_TOKEN(STR_TCG2_DISABLE), value =
> TCG2_PHYSICAL_PRESENCE_DISABLE, flags = RESET_REQUIRED;
> 
>              option text = STRING_TOKEN(STR_TCG2_CLEAR), value =
> TCG2_PHYSICAL_PRESENCE_CLEAR, flags = RESET_REQUIRED;
> 
>              option text = STRING_TOKEN(STR_TCG2_SET_PCD_BANKS), value =
> TCG2_PHYSICAL_PRESENCE_SET_PCR_BANKS, flags = RESET_REQUIRED;
> 
> +            suppressif ideqval TCG2_CONFIGURATION_INFO.ChangeEPSSupported
> == 0;
> 
>              option text = STRING_TOKEN(STR_TCG2_CHANGE_EPS), value =
> TCG2_PHYSICAL_PRESENCE_CHANGE_EPS, flags = RESET_REQUIRED;
> 
> +            endif
> 
>              option text = STRING_TOKEN(STR_TCG2_LOG_ALL_DIGESTS), value =
> TCG2_PHYSICAL_PRESENCE_LOG_ALL_DIGESTS, flags = RESET_REQUIRED;
> 
>              option text =
> STRING_TOKEN(STR_TCG2_DISABLE_ENDORSEMENT_ENABLE_STORAGE_HIER
> ARCHY), value =
> TCG2_PHYSICAL_PRESENCE_DISABLE_ENDORSEMENT_ENABLE_STORAGE_HIER
> ARCHY, flags = RESET_REQUIRED;
> 
>      endoneof;
> 
> diff --git a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c
> b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c
> index baa8fcd08d..2946f95db0 100644
> --- a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c
> +++ b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c
> @@ -788,6 +788,7 @@ InstallTcg2ConfigForm (
>    CHAR16                          TempBuffer[1024];
> 
>    TCG2_CONFIGURATION_INFO         Tcg2ConfigInfo;
> 
>    TPM2_PTP_INTERFACE_TYPE         TpmDeviceInterfaceDetected;
> 
> +  BOOLEAN                         IsCmdImp = FALSE;
> 
> 
> 
>    DriverHandle = NULL;
> 
>    ConfigAccess = &PrivateData->ConfigAccess;
> 
> @@ -870,6 +871,12 @@ InstallTcg2ConfigForm (
>      HiiSetString (PrivateData->HiiHandle, STRING_TOKEN
> (STR_TPM2_SUPPORTED_HASH_ALGO_CONTENT), TempBuffer, NULL);
> 
>    }
> 
> 
> 
> +  Status = Tpm2GetCapabilityIsCommandImplemented (TPM_CC_ChangeEPS,
> &IsCmdImp);
> 
> +  if (EFI_ERROR (Status)) {
> 
> +    DEBUG ((DEBUG_ERROR, "Tpm2GetCapabilityIsCmdImpl fails %r\n", Status));
> 
> +  }
> 
> +  Tcg2ConfigInfo.ChangeEPSSupported = IsCmdImp;
> 
> +
> 
>    FillBufferWithBootHashAlg (TempBuffer, sizeof(TempBuffer), PcdGet32
> (PcdTcg2HashAlgorithmBitmap));
> 
>    HiiSetString (PrivateData->HiiHandle, STRING_TOKEN
> (STR_BIOS_HASH_ALGO_CONTENT), TempBuffer, NULL);
> 
> 
> 
> diff --git a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigNvData.h
> b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigNvData.h
> index a91c052850..b84af40a04 100644
> --- a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigNvData.h
> +++ b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigNvData.h
> @@ -70,6 +70,7 @@ typedef struct {
>    UINT8    TpmDeviceInterfaceAttempt;
> 
>    BOOLEAN  TpmDeviceInterfacePtpFifoSupported;
> 
>    BOOLEAN  TpmDeviceInterfacePtpCrbSupported;
> 
> +  BOOLEAN  ChangeEPSSupported;
> 
>  } TCG2_CONFIGURATION_INFO;
> 
> 
> 
>  //
> 
> --
> 2.26.2.windows.1
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> 
> View/Reply Online (#63393): https://edk2.groups.io/g/devel/message/63393
> Mute This Topic: https://groups.io/mt/75840054/1768734
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub  [jian.j.wang@intel.com]
> -=-=-=-=-=-=


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [edk2-devel] [PATCH v4 1/2] SecurityPkg/Tpm2CommandLib: add a new function
  2020-07-28  8:20 ` [PATCH v4 1/2] SecurityPkg/Tpm2CommandLib: add a new function Qi Zhang
@ 2020-08-03 14:33   ` Wang, Jian J
  0 siblings, 0 replies; 6+ messages in thread
From: Wang, Jian J @ 2020-08-03 14:33 UTC (permalink / raw)
  To: devel@edk2.groups.io, Zhang, Qi1; +Cc: Yao, Jiewen, Chao Zhang, Kumar, Rahul1



Reviewed-by: Jian J Wang <jian.j.wang@intel.com>

Regards,
Jian

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Qi Zhang
> Sent: Tuesday, July 28, 2020 4:21 PM
> To: devel@edk2.groups.io
> Cc: Zhang, Qi1 <qi1.zhang@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>;
> Wang, Jian J <jian.j.wang@intel.com>; Chao Zhang <chao.b.zhang@intel.com>;
> Kumar, Rahul1 <rahul1.kumar@intel.com>
> Subject: [edk2-devel] [PATCH v4 1/2] SecurityPkg/Tpm2CommandLib: add a new
> function
> 
> From: "Zhang, Qi" <qi1.zhang@intel.com>
> 
>  Tpm2GetCapabilityIsCommandImplemented
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2793
> 
> check if the commad is supported by comparing the command code with
> command index.
> 
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Chao Zhang <chao.b.zhang@intel.com>
> Cc: Rahul Kumar <rahul1.kumar@intel.com>
> Signed-off-by: Qi Zhang <qi1.zhang@intel.com>
> ---
>  SecurityPkg/Include/Library/Tpm2CommandLib.h  | 16 ++++++++
>  .../Library/Tpm2CommandLib/Tpm2Capability.c   | 40 +++++++++++++++++++
>  2 files changed, 56 insertions(+)
> 
> diff --git a/SecurityPkg/Include/Library/Tpm2CommandLib.h
> b/SecurityPkg/Include/Library/Tpm2CommandLib.h
> index ce381e786b..ee8eb62295 100644
> --- a/SecurityPkg/Include/Library/Tpm2CommandLib.h
> +++ b/SecurityPkg/Include/Library/Tpm2CommandLib.h
> @@ -790,6 +790,22 @@ Tpm2GetCapabilityAlgorithmSet (
>    OUT     UINT32      *AlgorithmSet
> 
>    );
> 
> 
> 
> +/**
> 
> +  This function will query if the command is supported.
> 
> +
> 
> +  @param[In]  Command         TPM_CC command starts from TPM_CC_FIRST.
> 
> +  @param[out] IsCmdImpl       The command is supported or not.
> 
> +
> 
> +  @retval EFI_SUCCESS            Operation completed successfully.
> 
> +  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
> 
> +**/
> 
> +EFI_STATUS
> 
> +EFIAPI
> 
> +Tpm2GetCapabilityIsCommandImplemented (
> 
> +  IN      TPM_CC      Command,
> 
> +  OUT     BOOLEAN     *IsCmdImpl
> 
> +  );
> 
> +
> 
>  /**
> 
>    This command is used to check to see if specific combinations of algorithm
> parameters are supported.
> 
> 
> 
> diff --git a/SecurityPkg/Library/Tpm2CommandLib/Tpm2Capability.c
> b/SecurityPkg/Library/Tpm2CommandLib/Tpm2Capability.c
> index 85b11c7715..17c0c3a151 100644
> --- a/SecurityPkg/Library/Tpm2CommandLib/Tpm2Capability.c
> +++ b/SecurityPkg/Library/Tpm2CommandLib/Tpm2Capability.c
> @@ -39,6 +39,8 @@ typedef struct {
> 
> 
>  #pragma pack()
> 
> 
> 
> +#define TPMA_CC_COMMANDINDEX_MASK  0x2000FFFF
> 
> +
> 
>  /**
> 
>    This command returns various information regarding the TPM and its current
> state.
> 
> 
> 
> @@ -628,6 +630,44 @@ Tpm2GetCapabilityAlgorithmSet (
>    return EFI_SUCCESS;
> 
>  }
> 
> 
> 
> +/**
> 
> +  This function will query if the command is supported.
> 
> +
> 
> +  @param[In]  Command         TPM_CC command starts from TPM_CC_FIRST.
> 
> +  @param[out] IsCmdImpl       The command is supported or not.
> 
> +
> 
> +  @retval EFI_SUCCESS            Operation completed successfully.
> 
> +  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
> 
> +**/
> 
> +EFI_STATUS
> 
> +EFIAPI
> 
> +Tpm2GetCapabilityIsCommandImplemented (
> 
> +  IN      TPM_CC      Command,
> 
> +  OUT     BOOLEAN     *IsCmdImpl
> 
> +  )
> 
> +{
> 
> +  TPMS_CAPABILITY_DATA    TpmCap;
> 
> +  TPMI_YES_NO             MoreData;
> 
> +  EFI_STATUS              Status;
> 
> +  UINT32                  Attribute;
> 
> +
> 
> +  Status = Tpm2GetCapability (
> 
> +             TPM_CAP_COMMANDS,
> 
> +             Command,
> 
> +             1,
> 
> +             &MoreData,
> 
> +             &TpmCap
> 
> +             );
> 
> +  if (EFI_ERROR (Status)) {
> 
> +    return Status;
> 
> +  }
> 
> +
> 
> +  CopyMem (&Attribute, &TpmCap.data.command.commandAttributes[0],
> sizeof (UINT32));
> 
> +  *IsCmdImpl = (Command == (SwapBytes32(Attribute) &
> TPMA_CC_COMMANDINDEX_MASK));
> 
> +
> 
> +  return EFI_SUCCESS;
> 
> +}
> 
> +
> 
>  /**
> 
>    This command is used to check to see if specific combinations of algorithm
> parameters are supported.
> 
> 
> 
> --
> 2.26.2.windows.1
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> 
> View/Reply Online (#63392): https://edk2.groups.io/g/devel/message/63392
> Mute This Topic: https://groups.io/mt/75840053/1768734
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub  [jian.j.wang@intel.com]
> -=-=-=-=-=-=


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v4 0/2] refine TPM2 operation pull down list
  2020-07-28  8:20 [PATCH v4 0/2] refine TPM2 operation pull down list Qi Zhang
  2020-07-28  8:20 ` [PATCH v4 1/2] SecurityPkg/Tpm2CommandLib: add a new function Qi Zhang
  2020-07-28  8:20 ` [PATCH v4 2/2] SecurityPkg/Tcg2Config: remove TPM2_ChangEPS if it is not supported Qi Zhang
@ 2020-08-03 14:35 ` Wang, Jian J
  2 siblings, 0 replies; 6+ messages in thread
From: Wang, Jian J @ 2020-08-03 14:35 UTC (permalink / raw)
  To: Zhang, Qi1, devel@edk2.groups.io; +Cc: Yao, Jiewen, Chao Zhang, Kumar, Rahul1

Qi,

Please remove Chao Zhang from Cc list when you compose final push patch files.
His address not valid any more.

Regards,
Jian

> -----Original Message-----
> From: Zhang, Qi1 <qi1.zhang@intel.com>
> Sent: Tuesday, July 28, 2020 4:21 PM
> To: devel@edk2.groups.io
> Cc: Zhang, Qi1 <qi1.zhang@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>;
> Wang, Jian J <jian.j.wang@intel.com>; Chao Zhang <chao.b.zhang@intel.com>;
> Kumar, Rahul1 <rahul1.kumar@intel.com>
> Subject: [PATCH v4 0/2] refine TPM2 operation pull down list
> 
> v2 change: separate the change into two patches
> v3 change: rename Tpm2GetCapabilityIsCmdImpl to
> Tpm2GetCapabilityIsCommandImplemented
> v4 change: fix two build errors reported by CI
> 
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Chao Zhang <chao.b.zhang@intel.com>
> Cc: Rahul Kumar <rahul1.kumar@intel.com>
> Signed-off-by: Qi Zhang <qi1.zhang@intel.com>
> 
> Qi Zhang (1):
>   SecurityPkg/Tcg2Config: remove TPM2_ChangEPS if it is not supported.
> 
> Zhang, Qi (1):
>   SecurityPkg/Tpm2CommandLib: add a new function
> 
>  SecurityPkg/Include/Library/Tpm2CommandLib.h  | 16 ++++++++
>  .../Library/Tpm2CommandLib/Tpm2Capability.c   | 40 +++++++++++++++++++
>  SecurityPkg/Tcg/Tcg2Config/Tcg2Config.vfr     |  2 +
>  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c   |  7 ++++
>  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigNvData.h |  1 +
>  5 files changed, 66 insertions(+)
> 
> --
> 2.26.2.windows.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-08-03 14:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-28  8:20 [PATCH v4 0/2] refine TPM2 operation pull down list Qi Zhang
2020-07-28  8:20 ` [PATCH v4 1/2] SecurityPkg/Tpm2CommandLib: add a new function Qi Zhang
2020-08-03 14:33   ` [edk2-devel] " Wang, Jian J
2020-07-28  8:20 ` [PATCH v4 2/2] SecurityPkg/Tcg2Config: remove TPM2_ChangEPS if it is not supported Qi Zhang
2020-08-03 14:32   ` [edk2-devel] " Wang, Jian J
2020-08-03 14:35 ` [PATCH v4 0/2] refine TPM2 operation pull down list Wang, Jian J

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox