* [PATCH] SecurityPkg: Support PP version lower than 1.3
@ 2018-02-05 2:32 Zhang, Chao B
2018-02-06 2:29 ` Long, Qin
0 siblings, 1 reply; 4+ messages in thread
From: Zhang, Chao B @ 2018-02-05 2:32 UTC (permalink / raw)
To: edk2-devel; +Cc: Long Qin, Yao Jiewen, Chao Zhang
TCG PP 1.2 & PP 1.3 spec defined different Opcodes.
Update code to support both.
Cc: Long Qin <qin.long@intel.com>
Cc: Yao Jiewen <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
---
.../SmmTcg2PhysicalPresenceLib.c | 31 +++++++++++++++++-----
.../SmmTcg2PhysicalPresenceLib.inf | 7 +++--
2 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.c b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.c
index 6061453..ffade10 100644
--- a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.c
+++ b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.c
@@ -10,7 +10,7 @@
Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction() and Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction()
will receive untrusted input and do validation.
-Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -27,12 +27,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/SmmVariable.h>
+#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/Tcg2PpVendorLib.h>
#include <Library/SmmServicesTableLib.h>
+#define PP_INF_VERSION_1_2 "1.2"
+
EFI_SMM_VARIABLE_PROTOCOL *mTcg2PpSmmVariable;
+BOOLEAN mIsTcg2PPVerLowerThan_1_3 = FALSE;
/**
The handler for TPM physical presence function:
@@ -337,11 +341,22 @@ Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction (
break;
default:
- if (OperationRequest < TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) {
- //
- // TCG PP spec defined operations that are reserved or un-implemented
- //
- return TCG_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED;
+ if (mIsTcg2PPVerLowerThan_1_3 == FALSE) {
+ if (OperationRequest < TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) {
+ //
+ // TCG2 PP1.3 spec defined operations that are reserved or un-implemented
+ //
+ return TCG_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED;
+ }
+ } else {
+ //
+ // TCG PP lower than 1.3. (1.0, 1.1, 1.2)
+ //
+ if (OperationRequest <= TCG2_PHYSICAL_PRESENCE_NO_ACTION_MAX) {
+ RequestConfirmed = TRUE;
+ } else if (OperationRequest < TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) {
+ return TCG_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED;
+ }
}
break;
}
@@ -377,6 +392,10 @@ Tcg2PhysicalPresenceLibConstructor (
{
EFI_STATUS Status;
+ if (AsciiStrnCmp(PP_INF_VERSION_1_2, (CHAR8 *)PcdGetPtr(PcdTcgPhysicalPresenceInterfaceVer), AsciiStrLen(PP_INF_VERSION_1_2)) <=0) {
+ mIsTcg2PPVerLowerThan_1_3 = TRUE;
+ }
+
//
// Locate SmmVariableProtocol.
//
diff --git a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.inf b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.inf
index 5fa84b1..8367097 100644
--- a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.inf
+++ b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.inf
@@ -7,7 +7,7 @@
# This driver will have external input - variable.
# This external input must be validated carefully to avoid security issue.
#
-# Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
@@ -52,6 +52,9 @@
## SOMETIMES_CONSUMES ## Variable:L"PhysicalPresence"
## SOMETIMES_CONSUMES ## Variable:L"PhysicalPresenceFlags"
gEfiTcg2PhysicalPresenceGuid
-
+
+[Pcd]
+ gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer ## CONSUMES
+
[Depex]
gEfiSmmVariableProtocolGuid
\ No newline at end of file
--
1.9.5.msysgit.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] SecurityPkg: Support PP version lower than 1.3
2018-02-05 2:32 [PATCH] SecurityPkg: Support PP version lower than 1.3 Zhang, Chao B
@ 2018-02-06 2:29 ` Long, Qin
2018-02-06 2:33 ` Yao, Jiewen
0 siblings, 1 reply; 4+ messages in thread
From: Long, Qin @ 2018-02-06 2:29 UTC (permalink / raw)
To: Zhang, Chao B, edk2-devel@lists.01.org; +Cc: Yao, Jiewen
Could you update the AsciiStrLen usage with safe version, or direct "sizeof()"?
Others looks good to me.
Reviewed-by: Long Qin <qin.long@intel.com>
Best Regards & Thanks,
LONG, Qin
-----Original Message-----
From: Zhang, Chao B
Sent: Monday, February 5, 2018 10:32 AM
To: edk2-devel@lists.01.org
Cc: Long, Qin <qin.long@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>; Zhang, Chao B <chao.b.zhang@intel.com>
Subject: [PATCH] SecurityPkg: Support PP version lower than 1.3
TCG PP 1.2 & PP 1.3 spec defined different Opcodes.
Update code to support both.
Cc: Long Qin <qin.long@intel.com>
Cc: Yao Jiewen <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
---
.../SmmTcg2PhysicalPresenceLib.c | 31 +++++++++++++++++-----
.../SmmTcg2PhysicalPresenceLib.inf | 7 +++--
2 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.c b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.c
index 6061453..ffade10 100644
--- a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.c
+++ b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPres
+++ enceLib.c
@@ -10,7 +10,7 @@
Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction() and Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction()
will receive untrusted input and do validation.
-Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -27,12 +27,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/SmmVariable.h>
+#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/Tcg2PpVendorLib.h>
#include <Library/SmmServicesTableLib.h>
+#define PP_INF_VERSION_1_2 "1.2"
+
EFI_SMM_VARIABLE_PROTOCOL *mTcg2PpSmmVariable;
+BOOLEAN mIsTcg2PPVerLowerThan_1_3 = FALSE;
/**
The handler for TPM physical presence function:
@@ -337,11 +341,22 @@ Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction (
break;
default:
- if (OperationRequest < TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) {
- //
- // TCG PP spec defined operations that are reserved or un-implemented
- //
- return TCG_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED;
+ if (mIsTcg2PPVerLowerThan_1_3 == FALSE) {
+ if (OperationRequest < TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) {
+ //
+ // TCG2 PP1.3 spec defined operations that are reserved or un-implemented
+ //
+ return TCG_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED;
+ }
+ } else {
+ //
+ // TCG PP lower than 1.3. (1.0, 1.1, 1.2)
+ //
+ if (OperationRequest <= TCG2_PHYSICAL_PRESENCE_NO_ACTION_MAX) {
+ RequestConfirmed = TRUE;
+ } else if (OperationRequest < TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) {
+ return TCG_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED;
+ }
}
break;
}
@@ -377,6 +392,10 @@ Tcg2PhysicalPresenceLibConstructor ( {
EFI_STATUS Status;
+ if (AsciiStrnCmp(PP_INF_VERSION_1_2, (CHAR8 *)PcdGetPtr(PcdTcgPhysicalPresenceInterfaceVer), AsciiStrLen(PP_INF_VERSION_1_2)) <=0) {
+ mIsTcg2PPVerLowerThan_1_3 = TRUE;
+ }
+
//
// Locate SmmVariableProtocol.
//
diff --git a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.inf b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.inf
index 5fa84b1..8367097 100644
--- a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.inf
+++ b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPres
+++ enceLib.inf
@@ -7,7 +7,7 @@
# This driver will have external input - variable.
# This external input must be validated carefully to avoid security issue.
#
-# Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2015 - 2018, Intel Corporation. All rights
+reserved.<BR>
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -52,6 +52,9 @@
## SOMETIMES_CONSUMES ## Variable:L"PhysicalPresence"
## SOMETIMES_CONSUMES ## Variable:L"PhysicalPresenceFlags"
gEfiTcg2PhysicalPresenceGuid
-
+
+[Pcd]
+ gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer ##
+CONSUMES
+
[Depex]
gEfiSmmVariableProtocolGuid
\ No newline at end of file
--
1.9.5.msysgit.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] SecurityPkg: Support PP version lower than 1.3
2018-02-06 2:29 ` Long, Qin
@ 2018-02-06 2:33 ` Yao, Jiewen
2018-02-06 3:37 ` Zhang, Chao B
0 siblings, 1 reply; 4+ messages in thread
From: Yao, Jiewen @ 2018-02-06 2:33 UTC (permalink / raw)
To: Long, Qin, Zhang, Chao B, edk2-devel@lists.01.org
Yeah. I suggest we just use sizeof() for the fixed string.
> -----Original Message-----
> From: Long, Qin
> Sent: Tuesday, February 6, 2018 10:30 AM
> To: Zhang, Chao B <chao.b.zhang@intel.com>; edk2-devel@lists.01.org
> Cc: Yao, Jiewen <jiewen.yao@intel.com>
> Subject: RE: [PATCH] SecurityPkg: Support PP version lower than 1.3
>
> Could you update the AsciiStrLen usage with safe version, or direct "sizeof()"?
> Others looks good to me.
>
> Reviewed-by: Long Qin <qin.long@intel.com>
>
>
> Best Regards & Thanks,
> LONG, Qin
>
> -----Original Message-----
> From: Zhang, Chao B
> Sent: Monday, February 5, 2018 10:32 AM
> To: edk2-devel@lists.01.org
> Cc: Long, Qin <qin.long@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>;
> Zhang, Chao B <chao.b.zhang@intel.com>
> Subject: [PATCH] SecurityPkg: Support PP version lower than 1.3
>
> TCG PP 1.2 & PP 1.3 spec defined different Opcodes.
> Update code to support both.
>
> Cc: Long Qin <qin.long@intel.com>
> Cc: Yao Jiewen <jiewen.yao@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
> ---
> .../SmmTcg2PhysicalPresenceLib.c | 31
> +++++++++++++++++-----
> .../SmmTcg2PhysicalPresenceLib.inf | 7 +++--
> 2 files changed, 30 insertions(+), 8 deletions(-)
>
> diff --git
> a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresence
> Lib.c
> b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresence
> Lib.c
> index 6061453..ffade10 100644
> ---
> a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresence
> Lib.c
> +++ b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPres
> +++ enceLib.c
> @@ -10,7 +10,7 @@
> Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction() and
> Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction()
> will receive untrusted input and do validation.
>
> -Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
> This program and the accompanying materials are licensed and made
> available under the terms and conditions of the BSD License which
> accompanies this distribution. The full text of the license may be found at @@
> -27,12 +27,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND,
> EITHER EXPRESS OR IMPLIED.
>
> #include <Protocol/SmmVariable.h>
>
> +#include <Library/BaseLib.h>
> #include <Library/DebugLib.h>
> #include <Library/BaseMemoryLib.h>
> #include <Library/Tcg2PpVendorLib.h>
> #include <Library/SmmServicesTableLib.h>
>
> +#define PP_INF_VERSION_1_2 "1.2"
> +
> EFI_SMM_VARIABLE_PROTOCOL *mTcg2PpSmmVariable;
> +BOOLEAN mIsTcg2PPVerLowerThan_1_3 = FALSE;
>
> /**
> The handler for TPM physical presence function:
> @@ -337,11 +341,22 @@
> Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction (
> break;
>
> default:
> - if (OperationRequest <
> TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) {
> - //
> - // TCG PP spec defined operations that are reserved or
> un-implemented
> - //
> - return TCG_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED;
> + if (mIsTcg2PPVerLowerThan_1_3 == FALSE) {
> + if (OperationRequest <
> TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) {
> + //
> + // TCG2 PP1.3 spec defined operations that are reserved or
> un-implemented
> + //
> + return TCG_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED;
> + }
> + } else {
> + //
> + // TCG PP lower than 1.3. (1.0, 1.1, 1.2)
> + //
> + if (OperationRequest <=
> TCG2_PHYSICAL_PRESENCE_NO_ACTION_MAX) {
> + RequestConfirmed = TRUE;
> + } else if (OperationRequest <
> TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) {
> + return TCG_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED;
> + }
> }
> break;
> }
> @@ -377,6 +392,10 @@ Tcg2PhysicalPresenceLibConstructor ( {
> EFI_STATUS Status;
>
> + if (AsciiStrnCmp(PP_INF_VERSION_1_2, (CHAR8
> *)PcdGetPtr(PcdTcgPhysicalPresenceInterfaceVer),
> AsciiStrLen(PP_INF_VERSION_1_2)) <=0) {
> + mIsTcg2PPVerLowerThan_1_3 = TRUE;
> + }
> +
> //
> // Locate SmmVariableProtocol.
> //
> diff --git
> a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresence
> Lib.inf
> b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresence
> Lib.inf
> index 5fa84b1..8367097 100644
> ---
> a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresence
> Lib.inf
> +++ b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPres
> +++ enceLib.inf
> @@ -7,7 +7,7 @@
> # This driver will have external input - variable.
> # This external input must be validated carefully to avoid security issue.
> #
> -# Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
> +# Copyright (c) 2015 - 2018, Intel Corporation. All rights
> +reserved.<BR>
> # This program and the accompanying materials # are licensed and made
> available under the terms and conditions of the BSD License # which
> accompanies this distribution. The full text of the license may be found at @@
> -52,6 +52,9 @@
> ## SOMETIMES_CONSUMES ## Variable:L"PhysicalPresence"
> ## SOMETIMES_CONSUMES ## Variable:L"PhysicalPresenceFlags"
> gEfiTcg2PhysicalPresenceGuid
> -
> +
> +[Pcd]
> + gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer ##
> +CONSUMES
> +
> [Depex]
> gEfiSmmVariableProtocolGuid
> \ No newline at end of file
> --
> 1.9.5.msysgit.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] SecurityPkg: Support PP version lower than 1.3
2018-02-06 2:33 ` Yao, Jiewen
@ 2018-02-06 3:37 ` Zhang, Chao B
0 siblings, 0 replies; 4+ messages in thread
From: Zhang, Chao B @ 2018-02-06 3:37 UTC (permalink / raw)
To: Yao, Jiewen, Long, Qin, edk2-devel@lists.01.org
Qin & Jiewen
Tks for your comments , I will follow up to update the patch.
-----Original Message-----
From: Yao, Jiewen
Sent: Tuesday, February 6, 2018 10:33 AM
To: Long, Qin <qin.long@intel.com>; Zhang, Chao B <chao.b.zhang@intel.com>; edk2-devel@lists.01.org
Subject: RE: [PATCH] SecurityPkg: Support PP version lower than 1.3
Yeah. I suggest we just use sizeof() for the fixed string.
> -----Original Message-----
> From: Long, Qin
> Sent: Tuesday, February 6, 2018 10:30 AM
> To: Zhang, Chao B <chao.b.zhang@intel.com>; edk2-devel@lists.01.org
> Cc: Yao, Jiewen <jiewen.yao@intel.com>
> Subject: RE: [PATCH] SecurityPkg: Support PP version lower than 1.3
>
> Could you update the AsciiStrLen usage with safe version, or direct "sizeof()"?
> Others looks good to me.
>
> Reviewed-by: Long Qin <qin.long@intel.com>
>
>
> Best Regards & Thanks,
> LONG, Qin
>
> -----Original Message-----
> From: Zhang, Chao B
> Sent: Monday, February 5, 2018 10:32 AM
> To: edk2-devel@lists.01.org
> Cc: Long, Qin <qin.long@intel.com>; Yao, Jiewen
> <jiewen.yao@intel.com>; Zhang, Chao B <chao.b.zhang@intel.com>
> Subject: [PATCH] SecurityPkg: Support PP version lower than 1.3
>
> TCG PP 1.2 & PP 1.3 spec defined different Opcodes.
> Update code to support both.
>
> Cc: Long Qin <qin.long@intel.com>
> Cc: Yao Jiewen <jiewen.yao@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
> ---
> .../SmmTcg2PhysicalPresenceLib.c | 31
> +++++++++++++++++-----
> .../SmmTcg2PhysicalPresenceLib.inf | 7 +++--
> 2 files changed, 30 insertions(+), 8 deletions(-)
>
> diff --git
> a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresen
> ce
> Lib.c
> b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresen
> ce
> Lib.c
> index 6061453..ffade10 100644
> ---
> a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresen
> ce
> Lib.c
> +++ b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPr
> +++ es
> +++ enceLib.c
> @@ -10,7 +10,7 @@
> Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction() and
> Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction()
> will receive untrusted input and do validation.
>
> -Copyright (c) 2015 - 2017, Intel Corporation. All rights
> reserved.<BR>
> +Copyright (c) 2015 - 2018, Intel Corporation. All rights
> +reserved.<BR>
> This program and the accompanying materials are licensed and made
> available under the terms and conditions of the BSD License which
> accompanies this distribution. The full text of the license may be
> found at @@
> -27,12 +27,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND,
> EITHER EXPRESS OR IMPLIED.
>
> #include <Protocol/SmmVariable.h>
>
> +#include <Library/BaseLib.h>
> #include <Library/DebugLib.h>
> #include <Library/BaseMemoryLib.h>
> #include <Library/Tcg2PpVendorLib.h>
> #include <Library/SmmServicesTableLib.h>
>
> +#define PP_INF_VERSION_1_2 "1.2"
> +
> EFI_SMM_VARIABLE_PROTOCOL *mTcg2PpSmmVariable;
> +BOOLEAN mIsTcg2PPVerLowerThan_1_3 = FALSE;
>
> /**
> The handler for TPM physical presence function:
> @@ -337,11 +341,22 @@
> Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction (
> break;
>
> default:
> - if (OperationRequest <
> TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) {
> - //
> - // TCG PP spec defined operations that are reserved or
> un-implemented
> - //
> - return TCG_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED;
> + if (mIsTcg2PPVerLowerThan_1_3 == FALSE) {
> + if (OperationRequest <
> TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) {
> + //
> + // TCG2 PP1.3 spec defined operations that are reserved or
> un-implemented
> + //
> + return TCG_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED;
> + }
> + } else {
> + //
> + // TCG PP lower than 1.3. (1.0, 1.1, 1.2)
> + //
> + if (OperationRequest <=
> TCG2_PHYSICAL_PRESENCE_NO_ACTION_MAX) {
> + RequestConfirmed = TRUE;
> + } else if (OperationRequest <
> TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) {
> + return TCG_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED;
> + }
> }
> break;
> }
> @@ -377,6 +392,10 @@ Tcg2PhysicalPresenceLibConstructor ( {
> EFI_STATUS Status;
>
> + if (AsciiStrnCmp(PP_INF_VERSION_1_2, (CHAR8
> *)PcdGetPtr(PcdTcgPhysicalPresenceInterfaceVer),
> AsciiStrLen(PP_INF_VERSION_1_2)) <=0) {
> + mIsTcg2PPVerLowerThan_1_3 = TRUE; }
> +
> //
> // Locate SmmVariableProtocol.
> //
> diff --git
> a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresen
> ce
> Lib.inf
> b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresen
> ce
> Lib.inf
> index 5fa84b1..8367097 100644
> ---
> a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresen
> ce
> Lib.inf
> +++ b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPr
> +++ es
> +++ enceLib.inf
> @@ -7,7 +7,7 @@
> # This driver will have external input - variable.
> # This external input must be validated carefully to avoid security issue.
> #
> -# Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
> +# Copyright (c) 2015 - 2018, Intel Corporation. All rights
> +reserved.<BR>
> # This program and the accompanying materials # are licensed and
> made available under the terms and conditions of the BSD License #
> which accompanies this distribution. The full text of the license may
> be found at @@
> -52,6 +52,9 @@
> ## SOMETIMES_CONSUMES ## Variable:L"PhysicalPresence"
> ## SOMETIMES_CONSUMES ## Variable:L"PhysicalPresenceFlags"
> gEfiTcg2PhysicalPresenceGuid
> -
> +
> +[Pcd]
> + gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer
> +## CONSUMES
> +
> [Depex]
> gEfiSmmVariableProtocolGuid
> \ No newline at end of file
> --
> 1.9.5.msysgit.1
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-02-06 3:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-05 2:32 [PATCH] SecurityPkg: Support PP version lower than 1.3 Zhang, Chao B
2018-02-06 2:29 ` Long, Qin
2018-02-06 2:33 ` Yao, Jiewen
2018-02-06 3:37 ` Zhang, Chao B
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox