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>
Reviewed-by: Long Qin <qin.long@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction() and Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction()\r
will receive untrusted input and do validation.\r
\r
Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction() and Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction()\r
will receive untrusted input and do validation.\r
\r
-Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials \r
are licensed and made available under the terms and conditions of the BSD License \r
which accompanies this distribution. The full text of the license may be found at \r
This program and the accompanying materials \r
are licensed and made available under the terms and conditions of the BSD License \r
which accompanies this distribution. The full text of the license may be found at \r
\r
#include <Protocol/SmmVariable.h>\r
\r
\r
#include <Protocol/SmmVariable.h>\r
\r
+#include <Library/BaseLib.h>\r
#include <Library/DebugLib.h>\r
#include <Library/BaseMemoryLib.h>\r
#include <Library/Tcg2PpVendorLib.h>\r
#include <Library/SmmServicesTableLib.h>\r
\r
#include <Library/DebugLib.h>\r
#include <Library/BaseMemoryLib.h>\r
#include <Library/Tcg2PpVendorLib.h>\r
#include <Library/SmmServicesTableLib.h>\r
\r
+#define PP_INF_VERSION_1_2 "1.2"\r
+\r
EFI_SMM_VARIABLE_PROTOCOL *mTcg2PpSmmVariable;\r
EFI_SMM_VARIABLE_PROTOCOL *mTcg2PpSmmVariable;\r
+BOOLEAN mIsTcg2PPVerLowerThan_1_3 = FALSE;\r
\r
/**\r
The handler for TPM physical presence function:\r
\r
/**\r
The handler for TPM physical presence function:\r
- if (OperationRequest < TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) {\r
- //\r
- // TCG PP spec defined operations that are reserved or un-implemented\r
- //\r
- return TCG_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED;\r
+ if (mIsTcg2PPVerLowerThan_1_3 == FALSE) {\r
+ if (OperationRequest < TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) {\r
+ //\r
+ // TCG2 PP1.3 spec defined operations that are reserved or un-implemented\r
+ //\r
+ return TCG_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED;\r
+ }\r
+ } else {\r
+ //\r
+ // TCG PP lower than 1.3. (1.0, 1.1, 1.2)\r
+ //\r
+ if (OperationRequest <= TCG2_PHYSICAL_PRESENCE_NO_ACTION_MAX) {\r
+ RequestConfirmed = TRUE;\r
+ } else if (OperationRequest < TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) {\r
+ return TCG_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED;\r
+ }\r
{\r
EFI_STATUS Status;\r
\r
{\r
EFI_STATUS Status;\r
\r
+ if (AsciiStrnCmp(PP_INF_VERSION_1_2, (CHAR8 *)PcdGetPtr(PcdTcgPhysicalPresenceInterfaceVer), sizeof(PP_INF_VERSION_1_2) - 1) <= 0) {\r
+ mIsTcg2PPVerLowerThan_1_3 = TRUE;\r
+ }\r
+\r
//\r
// Locate SmmVariableProtocol.\r
//\r
//\r
// Locate SmmVariableProtocol.\r
//\r
# This driver will have external input - variable.\r
# This external input must be validated carefully to avoid security issue.\r
#\r
# This driver will have external input - variable.\r
# This external input must be validated carefully to avoid security issue.\r
#\r
-# Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
# which accompanies this distribution. The full text of the license may be found at\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
# which accompanies this distribution. The full text of the license may be found at\r
## SOMETIMES_CONSUMES ## Variable:L"PhysicalPresence"\r
## SOMETIMES_CONSUMES ## Variable:L"PhysicalPresenceFlags"\r
gEfiTcg2PhysicalPresenceGuid\r
## SOMETIMES_CONSUMES ## Variable:L"PhysicalPresence"\r
## SOMETIMES_CONSUMES ## Variable:L"PhysicalPresenceFlags"\r
gEfiTcg2PhysicalPresenceGuid\r
+\r
+[Pcd]\r
+ gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer ## CONSUMES\r
+\r
[Depex]\r
gEfiSmmVariableProtocolGuid
\ No newline at end of file
[Depex]\r
gEfiSmmVariableProtocolGuid
\ No newline at end of file