public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] SecurityPkg: Tcg2Smm: Update HID patch logic
@ 2017-01-04  3:12 Zhang, Chao B
  2017-01-04  3:26 ` Yao, Jiewen
  2017-01-04  3:27 ` Long, Qin
  0 siblings, 2 replies; 3+ messages in thread
From: Zhang, Chao B @ 2017-01-04  3:12 UTC (permalink / raw)
  To: edk2-devel; +Cc: qin.long, jiewen.yao, Chao Zhang

Update HID patch logic. NOOP in ASL template may cause syntax error when
disassembled and recompiled.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
---
 SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c | 11 ++++++-----
 SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h |  4 ++--
 SecurityPkg/Tcg/Tcg2Smm/Tpm.asl   |  8 ++++----
 3 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c
index 5a31a87..0159036 100644
--- a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c
+++ b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c
@@ -9,7 +9,7 @@
 
   PhysicalPresenceCallback() and MemoryClearCallback() will receive untrusted input and do some check.
 
-Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2015 - 2017, 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 
@@ -331,7 +331,6 @@ UpdateHID (
   // Initialize HID with Default PNP string
   //
   ZeroMem(HID, TPM_HID_ACPI_SIZE);
-  CopyMem(HID, TPM_HID_TAG, TPM_HID_PNP_SIZE);
 
   //
   // Get Manufacturer ID
@@ -391,11 +390,13 @@ UpdateHID (
     if (AsciiStrCmp((CHAR8 *)DataPtr,  TPM_HID_TAG) == 0) {
       if (PnpHID) {
         CopyMem(DataPtr, HID, TPM_HID_PNP_SIZE);
-        Size = TPM_HID_PNP_SIZE;
-      } else {
         //
-        // NOOP will be patched to '\0'
+        // if HID is PNP ID, patch the last byte in HID TAG to Noop
         //
+        *(DataPtr + TPM_HID_PNP_SIZE) = AML_NOOP_OP;
+        Size = TPM_HID_PNP_SIZE;
+      } else {
+
         CopyMem(DataPtr, HID, TPM_HID_ACPI_SIZE);
         Size = TPM_HID_ACPI_SIZE;
       }
diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h
index 18e8bfc..100804c 100644
--- a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h
+++ b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h
@@ -1,7 +1,7 @@
 /** @file
   The header file for Tcg2 SMM driver.
   
-Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2015 - 2017, 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 
@@ -98,7 +98,7 @@ typedef struct {
 //
 // PNP _HID for TPM2 device
 //
-#define TPM_HID_TAG                                                "NNN0000"
+#define TPM_HID_TAG                                                "NNNN0000"
 #define TPM_HID_PNP_SIZE                                           8
 #define TPM_HID_ACPI_SIZE                                          9
 
diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl b/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl
index 4128684..cf0642e 100644
--- a/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl
+++ b/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl
@@ -2,7 +2,7 @@
   The TPM2 definition block in ACPI table for TCG2 physical presence  
   and MemoryClear.
 
-Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
 (c)Copyright 2016 HP Development Company, L.P.<BR>
 This program and the accompanying materials 
 are licensed and made available under the terms and conditions of the BSD License 
@@ -30,11 +30,11 @@ DefinitionBlock (
       //
       // TCG2
       //
-      Name (_HID, "NNN0000")
+
       //
-      // Reserve 1 more byte for ACPI HID
+      //  TAG for patching TPM2.0 _HID
       //
-      Noop
+      Name (_HID, "NNNN0000")
 
       Name (_CID, "MSFT0101")
 
-- 
1.9.5.msysgit.1



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

* Re: [PATCH] SecurityPkg: Tcg2Smm: Update HID patch logic
  2017-01-04  3:12 [PATCH] SecurityPkg: Tcg2Smm: Update HID patch logic Zhang, Chao B
@ 2017-01-04  3:26 ` Yao, Jiewen
  2017-01-04  3:27 ` Long, Qin
  1 sibling, 0 replies; 3+ messages in thread
From: Yao, Jiewen @ 2017-01-04  3:26 UTC (permalink / raw)
  To: Zhang, Chao B, edk2-devel@lists.01.org; +Cc: Long, Qin

Reviewed-by: Jiewen.yao@intel.com

> -----Original Message-----
> From: Zhang, Chao B
> Sent: Wednesday, January 4, 2017 11:12 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: Tcg2Smm: Update HID patch logic
> 
> Update HID patch logic. NOOP in ASL template may cause syntax error when
> disassembled and recompiled.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
> ---
>  SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c | 11 ++++++-----
>  SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h |  4 ++--
>  SecurityPkg/Tcg/Tcg2Smm/Tpm.asl   |  8 ++++----
>  3 files changed, 12 insertions(+), 11 deletions(-)
> 
> diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c
> b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c
> index 5a31a87..0159036 100644
> --- a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c
> +++ b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c
> @@ -9,7 +9,7 @@
> 
>    PhysicalPresenceCallback() and MemoryClearCallback() will receive untrusted
> input and do some check.
> 
> -Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2015 - 2017, 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
> @@ -331,7 +331,6 @@ UpdateHID (
>    // Initialize HID with Default PNP string
>    //
>    ZeroMem(HID, TPM_HID_ACPI_SIZE);
> -  CopyMem(HID, TPM_HID_TAG, TPM_HID_PNP_SIZE);
> 
>    //
>    // Get Manufacturer ID
> @@ -391,11 +390,13 @@ UpdateHID (
>      if (AsciiStrCmp((CHAR8 *)DataPtr,  TPM_HID_TAG) == 0) {
>        if (PnpHID) {
>          CopyMem(DataPtr, HID, TPM_HID_PNP_SIZE);
> -        Size = TPM_HID_PNP_SIZE;
> -      } else {
>          //
> -        // NOOP will be patched to '\0'
> +        // if HID is PNP ID, patch the last byte in HID TAG to Noop
>          //
> +        *(DataPtr + TPM_HID_PNP_SIZE) = AML_NOOP_OP;
> +        Size = TPM_HID_PNP_SIZE;
> +      } else {
> +
>          CopyMem(DataPtr, HID, TPM_HID_ACPI_SIZE);
>          Size = TPM_HID_ACPI_SIZE;
>        }
> diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h
> b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h
> index 18e8bfc..100804c 100644
> --- a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h
> +++ b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h
> @@ -1,7 +1,7 @@
>  /** @file
>    The header file for Tcg2 SMM driver.
> 
> -Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2015 - 2017, 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
> @@ -98,7 +98,7 @@ typedef struct {
>  //
>  // PNP _HID for TPM2 device
>  //
> -#define TPM_HID_TAG
> "NNN0000"
> +#define TPM_HID_TAG
> "NNNN0000"
>  #define TPM_HID_PNP_SIZE                                           8
>  #define TPM_HID_ACPI_SIZE                                          9
> 
> diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl
> b/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl
> index 4128684..cf0642e 100644
> --- a/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl
> +++ b/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl
> @@ -2,7 +2,7 @@
>    The TPM2 definition block in ACPI table for TCG2 physical presence
>    and MemoryClear.
> 
> -Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
>  (c)Copyright 2016 HP Development Company, L.P.<BR>
>  This program and the accompanying materials
>  are licensed and made available under the terms and conditions of the BSD
> License
> @@ -30,11 +30,11 @@ DefinitionBlock (
>        //
>        // TCG2
>        //
> -      Name (_HID, "NNN0000")
> +
>        //
> -      // Reserve 1 more byte for ACPI HID
> +      //  TAG for patching TPM2.0 _HID
>        //
> -      Noop
> +      Name (_HID, "NNNN0000")
> 
>        Name (_CID, "MSFT0101")
> 
> --
> 1.9.5.msysgit.1



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

* Re: [PATCH] SecurityPkg: Tcg2Smm: Update HID patch logic
  2017-01-04  3:12 [PATCH] SecurityPkg: Tcg2Smm: Update HID patch logic Zhang, Chao B
  2017-01-04  3:26 ` Yao, Jiewen
@ 2017-01-04  3:27 ` Long, Qin
  1 sibling, 0 replies; 3+ messages in thread
From: Long, Qin @ 2017-01-04  3:27 UTC (permalink / raw)
  To: Zhang, Chao B, edk2-devel@lists.01.org; +Cc: Yao, Jiewen

Reviewed-by: Qin Long <qin.long@intel.com>


> -----Original Message-----
> From: Zhang, Chao B
> Sent: Wednesday, January 04, 2017 11:12 AM
> To: edk2-devel@lists.01.org
> Cc: Long, Qin; Yao, Jiewen; Zhang, Chao B
> Subject: [PATCH] SecurityPkg: Tcg2Smm: Update HID patch logic
> 
> Update HID patch logic. NOOP in ASL template may cause syntax error when
> disassembled and recompiled.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
> ---
>  SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c | 11 ++++++-----
> SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h |  4 ++--
>  SecurityPkg/Tcg/Tcg2Smm/Tpm.asl   |  8 ++++----
>  3 files changed, 12 insertions(+), 11 deletions(-)
> 
> diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c
> b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c
> index 5a31a87..0159036 100644
> --- a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c
> +++ b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c
> @@ -9,7 +9,7 @@
> 
>    PhysicalPresenceCallback() and MemoryClearCallback() will receive
> untrusted input and do some check.
> 
> -Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2015 - 2017, 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
> @@ -331,7 +331,6 @@ UpdateHID (
>    // Initialize HID with Default PNP string
>    //
>    ZeroMem(HID, TPM_HID_ACPI_SIZE);
> -  CopyMem(HID, TPM_HID_TAG, TPM_HID_PNP_SIZE);
> 
>    //
>    // Get Manufacturer ID
> @@ -391,11 +390,13 @@ UpdateHID (
>      if (AsciiStrCmp((CHAR8 *)DataPtr,  TPM_HID_TAG) == 0) {
>        if (PnpHID) {
>          CopyMem(DataPtr, HID, TPM_HID_PNP_SIZE);
> -        Size = TPM_HID_PNP_SIZE;
> -      } else {
>          //
> -        // NOOP will be patched to '\0'
> +        // if HID is PNP ID, patch the last byte in HID TAG to Noop
>          //
> +        *(DataPtr + TPM_HID_PNP_SIZE) = AML_NOOP_OP;
> +        Size = TPM_HID_PNP_SIZE;
> +      } else {
> +
>          CopyMem(DataPtr, HID, TPM_HID_ACPI_SIZE);
>          Size = TPM_HID_ACPI_SIZE;
>        }
> diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h
> b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h
> index 18e8bfc..100804c 100644
> --- a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h
> +++ b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h
> @@ -1,7 +1,7 @@
>  /** @file
>    The header file for Tcg2 SMM driver.
> 
> -Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2015 - 2017, 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
> @@ -98,7 +98,7 @@ typedef struct {  //  // PNP _HID for TPM2 device  //
> -#define TPM_HID_TAG                                                "NNN0000"
> +#define TPM_HID_TAG                                                "NNNN0000"
>  #define TPM_HID_PNP_SIZE                                           8
>  #define TPM_HID_ACPI_SIZE                                          9
> 
> diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl
> b/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl index 4128684..cf0642e 100644
> --- a/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl
> +++ b/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl
> @@ -2,7 +2,7 @@
>    The TPM2 definition block in ACPI table for TCG2 physical presence
>    and MemoryClear.
> 
> -Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
>  (c)Copyright 2016 HP Development Company, L.P.<BR>  This program and
> the accompanying materials  are licensed and made available under the
> terms and conditions of the BSD License @@ -30,11 +30,11 @@
> DefinitionBlock (
>        //
>        // TCG2
>        //
> -      Name (_HID, "NNN0000")
> +
>        //
> -      // Reserve 1 more byte for ACPI HID
> +      //  TAG for patching TPM2.0 _HID
>        //
> -      Noop
> +      Name (_HID, "NNNN0000")
> 
>        Name (_CID, "MSFT0101")
> 
> --
> 1.9.5.msysgit.1



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

end of thread, other threads:[~2017-01-04  3:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-04  3:12 [PATCH] SecurityPkg: Tcg2Smm: Update HID patch logic Zhang, Chao B
2017-01-04  3:26 ` Yao, Jiewen
2017-01-04  3:27 ` Long, Qin

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