Topics

[PATCH v4 2/2] SecurityPkg/Tcg2Config: remove TPM2_ChangEPS if it is not supported.


Qi Zhang
 

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

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@...>
Cc: Jian J Wang <jian.j.wang@...>
Cc: Chao Zhang <chao.b.zhang@...>
Cc: Rahul Kumar <rahul1.kumar@...>
Signed-off-by: Qi Zhang <qi1.zhang@...>
---
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/Tc=
g2Config/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 =3D STRING_TOKEN(STR_TCG2_DISABLE), value =3D TCG2=
_PHYSICAL_PRESENCE_DISABLE, flags =3D RESET_REQUIRED;=0D
option text =3D STRING_TOKEN(STR_TCG2_CLEAR), value =3D TCG2_P=
HYSICAL_PRESENCE_CLEAR, flags =3D RESET_REQUIRED;=0D
option text =3D STRING_TOKEN(STR_TCG2_SET_PCD_BANKS), value =
=3D TCG2_PHYSICAL_PRESENCE_SET_PCR_BANKS, flags =3D RESET_REQUIRED;=0D
+ suppressif ideqval TCG2_CONFIGURATION_INFO.ChangeEPSSupported =
=3D=3D 0;=0D
option text =3D STRING_TOKEN(STR_TCG2_CHANGE_EPS), value =3D T=
CG2_PHYSICAL_PRESENCE_CHANGE_EPS, flags =3D RESET_REQUIRED;=0D
+ endif=0D
option text =3D STRING_TOKEN(STR_TCG2_LOG_ALL_DIGESTS), value =
=3D TCG2_PHYSICAL_PRESENCE_LOG_ALL_DIGESTS, flags =3D RESET_REQUIRED;=0D
option text =3D STRING_TOKEN(STR_TCG2_DISABLE_ENDORSEMENT_ENAB=
LE_STORAGE_HIERARCHY), value =3D TCG2_PHYSICAL_PRESENCE_DISABLE_ENDORSEMENT=
_ENABLE_STORAGE_HIERARCHY, flags =3D RESET_REQUIRED;=0D
endoneof;=0D
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];=0D
TCG2_CONFIGURATION_INFO Tcg2ConfigInfo;=0D
TPM2_PTP_INTERFACE_TYPE TpmDeviceInterfaceDetected;=0D
+ BOOLEAN IsCmdImp =3D FALSE;=0D
=0D
DriverHandle =3D NULL;=0D
ConfigAccess =3D &PrivateData->ConfigAccess;=0D
@@ -870,6 +871,12 @@ InstallTcg2ConfigForm (
HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TPM2_SUPPORTED=
_HASH_ALGO_CONTENT), TempBuffer, NULL);=0D
}=0D
=0D
+ Status =3D Tpm2GetCapabilityIsCommandImplemented (TPM_CC_ChangeEPS, &IsC=
mdImp);=0D
+ if (EFI_ERROR (Status)) {=0D
+ DEBUG ((DEBUG_ERROR, "Tpm2GetCapabilityIsCmdImpl fails %r\n", Status))=
;=0D
+ }=0D
+ Tcg2ConfigInfo.ChangeEPSSupported =3D IsCmdImp;=0D
+=0D
FillBufferWithBootHashAlg (TempBuffer, sizeof(TempBuffer), PcdGet32 (Pcd=
Tcg2HashAlgorithmBitmap));=0D
HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_BIOS_HASH_ALGO_C=
ONTENT), TempBuffer, NULL);=0D
=0D
diff --git a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigNvData.h b/SecurityPkg/Tc=
g/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;=0D
BOOLEAN TpmDeviceInterfacePtpFifoSupported;=0D
BOOLEAN TpmDeviceInterfacePtpCrbSupported;=0D
+ BOOLEAN ChangeEPSSupported;=0D
} TCG2_CONFIGURATION_INFO;=0D
=0D
//=0D
--=20
2.26.2.windows.1


Wang, Jian J
 

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

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@...>; Yao, Jiewen <jiewen.yao@...>;
Wang, Jian J <jian.j.wang@...>; Chao Zhang <chao.b.zhang@...>;
Kumar, Rahul1 <rahul1.kumar@...>
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@...>
Cc: Jian J Wang <jian.j.wang@...>
Cc: Chao Zhang <chao.b.zhang@...>
Cc: Rahul Kumar <rahul1.kumar@...>
Signed-off-by: Qi Zhang <qi1.zhang@...>
---
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@...]
-=-=-=-=-=-=