Re: [edk2] [PATCH] SecurityPkg: Reduce verbosity of TPM DEBUG messages

2015-09-14 Thread Yao, Jiewen
Looks good.
Reviewed by: jiewen@intel.com


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Samer 
El-Haj-Mahmoud
Sent: Tuesday, September 15, 2015 4:40 AM
To: edk2-devel@lists.01.org
Cc: Samer El-Haj-Mahmoud; Zhang, Chao B; Samer El-Haj-Mahmoud
Subject: [edk2] [PATCH] SecurityPkg: Reduce verbosity of TPM DEBUG messages

Some of the TPM/TPM2 DEBUG messages are at EFI_D_INFO level, even though they 
are simply tracing functions that run on every boot even if there is no TPM 
installed. Changed verbosity to EFI_D_VERBOSE.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahm...@hpe.com>
---
 .../DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c  |  3 ++-
 SecurityPkg/Library/HashLibTpm2/HashLibTpm2.c  | 13 ++--
 SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c  | 23 +++---
 SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Tis.c| 23 +++---
 4 files changed, 33 insertions(+), 29 deletions(-)

diff --git a/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c 
b/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c
index 26bf6fb..1f2574e 100644
--- a/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c
+++ b/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c
@@ -16,6 +16,7 @@
   partition data carefully.
 
 Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.
+(C) Copyright 2015 Hewlett Packard Enterprise Development LP
 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 @@ -447,7 +448,7 @@ 
DxeTpm2MeasureBootHandler (
 // Tcg2 protocol is not installed. So, TPM2 is not present.
 // Don't do any measurement, and directly return EFI_SUCCESS.
 //
-DEBUG ((EFI_D_INFO, "DxeTpm2MeasureBootHandler - Tcg2 - %r\n", Status));
+DEBUG ((EFI_D_VERBOSE, "DxeTpm2MeasureBootHandler - Tcg2 - %r\n", 
+ Status));
 return EFI_SUCCESS;
   }
 
diff --git a/SecurityPkg/Library/HashLibTpm2/HashLibTpm2.c 
b/SecurityPkg/Library/HashLibTpm2/HashLibTpm2.c
index 379f2f7..075db4a 100644
--- a/SecurityPkg/Library/HashLibTpm2/HashLibTpm2.c
+++ b/SecurityPkg/Library/HashLibTpm2/HashLibTpm2.c
@@ -2,6 +2,7 @@
   Ihis library uses TPM2 device to calculation hash.
 
 Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved. 
+(C) Copyright 2015 Hewlett Packard Enterprise Development LP
 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 @@ -242,7 +243,7 @@ 
HashAndExtend (
   TPM2B_EVENTEventData;
   TPM2B_DIGEST   Result;
 
-  DEBUG((EFI_D_INFO, "\n HashAndExtend Entry \n"));
+  DEBUG((EFI_D_VERBOSE, "\n HashAndExtend Entry \n"));
 
   SequenceHandle = 0x; // Know bad value
 
@@ -262,7 +263,7 @@ HashAndExtend (
   if (EFI_ERROR(Status)) {
 return EFI_DEVICE_ERROR;
   }
-  DEBUG((EFI_D_INFO, "\n Tpm2HashSequenceStart Success \n"));
+  DEBUG((EFI_D_VERBOSE, "\n Tpm2HashSequenceStart Success \n"));
 
   Buffer = (UINT8 *)(UINTN)DataToHash;
   for (HashLen = DataToHashLen; HashLen > sizeof(HashBuffer.buffer); HashLen 
-= sizeof(HashBuffer.buffer)) { @@ -276,7 +277,7 @@ HashAndExtend (
   return EFI_DEVICE_ERROR;
 }
   }
-  DEBUG((EFI_D_INFO, "\n Tpm2SequenceUpdate Success \n"));
+  DEBUG((EFI_D_VERBOSE, "\n Tpm2SequenceUpdate Success \n"));
 
   HashBuffer.size = (UINT16)HashLen;
   CopyMem(HashBuffer.buffer, Buffer, (UINTN)HashLen); @@ -294,7 +295,7 @@ 
HashAndExtend (
 if (EFI_ERROR(Status)) {
   return EFI_DEVICE_ERROR;
 }
-DEBUG((EFI_D_INFO, "\n Tpm2EventSequenceComplete Success \n"));
+DEBUG((EFI_D_VERBOSE, "\n Tpm2EventSequenceComplete Success \n"));
   } else {
 Status = Tpm2SequenceComplete (
SequenceHandle,
@@ -304,7 +305,7 @@ HashAndExtend (
 if (EFI_ERROR(Status)) {
   return EFI_DEVICE_ERROR;
 }
-DEBUG((EFI_D_INFO, "\n Tpm2SequenceComplete Success \n"));
+DEBUG((EFI_D_VERBOSE, "\n Tpm2SequenceComplete Success \n"));
 
 DigestList->count = 1;
 DigestList->digests[0].hashAlg = AlgoId; @@ -316,7 +317,7 @@ HashAndExtend 
(
 if (EFI_ERROR(Status)) {
   return EFI_DEVICE_ERROR;
 }
-DEBUG((EFI_D_INFO, "\n Tpm2PcrExtend Success \n"));
+DEBUG((EFI_D_VERBOSE, "\n Tpm2PcrExtend Success \n"));
   }
 
   return EFI_SUCCESS;
diff --git a/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c 
b/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c
index 2fb360f..b8d13aa 100644
--- a/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12

[edk2] [PATCH] SecurityPkg: Reduce verbosity of TPM DEBUG messages

2015-09-14 Thread Samer El-Haj-Mahmoud
Some of the TPM/TPM2 DEBUG messages are at EFI_D_INFO level, even though they 
are simply tracing functions that run on every boot even if there is no TPM 
installed. Changed verbosity to EFI_D_VERBOSE.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Samer El-Haj-Mahmoud 
---
 .../DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c  |  3 ++-
 SecurityPkg/Library/HashLibTpm2/HashLibTpm2.c  | 13 ++--
 SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c  | 23 +++---
 SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Tis.c| 23 +++---
 4 files changed, 33 insertions(+), 29 deletions(-)

diff --git a/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c 
b/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c
index 26bf6fb..1f2574e 100644
--- a/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c
+++ b/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c
@@ -16,6 +16,7 @@
   partition data carefully.
 
 Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.
+(C) Copyright 2015 Hewlett Packard Enterprise Development LP
 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 
@@ -447,7 +448,7 @@ DxeTpm2MeasureBootHandler (
 // Tcg2 protocol is not installed. So, TPM2 is not present.
 // Don't do any measurement, and directly return EFI_SUCCESS.
 //
-DEBUG ((EFI_D_INFO, "DxeTpm2MeasureBootHandler - Tcg2 - %r\n", Status));
+DEBUG ((EFI_D_VERBOSE, "DxeTpm2MeasureBootHandler - Tcg2 - %r\n", Status));
 return EFI_SUCCESS;
   }
 
diff --git a/SecurityPkg/Library/HashLibTpm2/HashLibTpm2.c 
b/SecurityPkg/Library/HashLibTpm2/HashLibTpm2.c
index 379f2f7..075db4a 100644
--- a/SecurityPkg/Library/HashLibTpm2/HashLibTpm2.c
+++ b/SecurityPkg/Library/HashLibTpm2/HashLibTpm2.c
@@ -2,6 +2,7 @@
   Ihis library uses TPM2 device to calculation hash.
 
 Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved. 
+(C) Copyright 2015 Hewlett Packard Enterprise Development LP
 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
@@ -242,7 +243,7 @@ HashAndExtend (
   TPM2B_EVENTEventData;
   TPM2B_DIGEST   Result;
 
-  DEBUG((EFI_D_INFO, "\n HashAndExtend Entry \n"));
+  DEBUG((EFI_D_VERBOSE, "\n HashAndExtend Entry \n"));
 
   SequenceHandle = 0x; // Know bad value
 
@@ -262,7 +263,7 @@ HashAndExtend (
   if (EFI_ERROR(Status)) {
 return EFI_DEVICE_ERROR;
   }
-  DEBUG((EFI_D_INFO, "\n Tpm2HashSequenceStart Success \n"));
+  DEBUG((EFI_D_VERBOSE, "\n Tpm2HashSequenceStart Success \n"));
 
   Buffer = (UINT8 *)(UINTN)DataToHash;
   for (HashLen = DataToHashLen; HashLen > sizeof(HashBuffer.buffer); HashLen 
-= sizeof(HashBuffer.buffer)) {
@@ -276,7 +277,7 @@ HashAndExtend (
   return EFI_DEVICE_ERROR;
 }
   }
-  DEBUG((EFI_D_INFO, "\n Tpm2SequenceUpdate Success \n"));
+  DEBUG((EFI_D_VERBOSE, "\n Tpm2SequenceUpdate Success \n"));
 
   HashBuffer.size = (UINT16)HashLen;
   CopyMem(HashBuffer.buffer, Buffer, (UINTN)HashLen);
@@ -294,7 +295,7 @@ HashAndExtend (
 if (EFI_ERROR(Status)) {
   return EFI_DEVICE_ERROR;
 }
-DEBUG((EFI_D_INFO, "\n Tpm2EventSequenceComplete Success \n"));
+DEBUG((EFI_D_VERBOSE, "\n Tpm2EventSequenceComplete Success \n"));
   } else {
 Status = Tpm2SequenceComplete (
SequenceHandle,
@@ -304,7 +305,7 @@ HashAndExtend (
 if (EFI_ERROR(Status)) {
   return EFI_DEVICE_ERROR;
 }
-DEBUG((EFI_D_INFO, "\n Tpm2SequenceComplete Success \n"));
+DEBUG((EFI_D_VERBOSE, "\n Tpm2SequenceComplete Success \n"));
 
 DigestList->count = 1;
 DigestList->digests[0].hashAlg = AlgoId;
@@ -316,7 +317,7 @@ HashAndExtend (
 if (EFI_ERROR(Status)) {
   return EFI_DEVICE_ERROR;
 }
-DEBUG((EFI_D_INFO, "\n Tpm2PcrExtend Success \n"));
+DEBUG((EFI_D_VERBOSE, "\n Tpm2PcrExtend Success \n"));
   }
 
   return EFI_SUCCESS;
diff --git a/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c 
b/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c
index 2fb360f..b8d13aa 100644
--- a/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c
+++ b/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c
@@ -2,6 +2,7 @@
   TIS (TPM Interface Specification) functions used by TPM1.2.
   
 Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.
+(C) Copyright 2015 Hewlett Packard Enterprise Development LP
 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 
@@ -381,22 +382,22 @@ Tpm12TisTpmCommand (
   

Re: [edk2] [PATCH] SecurityPkg: Reduce verbosity of TPM DEBUG messages

2015-09-14 Thread Zhang, Chao B
Samer:
   To me, EFI_D_INFO is OK to send out these information. If you don't want to 
see them, you can
configure debug level message PCD special for TPM module.





Thanks & Best regards
Chao Zhang

-Original Message-
From: Samer El-Haj-Mahmoud [mailto:samer.el-haj-mahm...@hp.com] 
Sent: Tuesday, September 15, 2015 4:40 AM
To: edk2-devel@lists.01.org
Cc: Zhang, Chao B; Samer El-Haj-Mahmoud; Samer El-Haj-Mahmoud
Subject: [PATCH] SecurityPkg: Reduce verbosity of TPM DEBUG messages

Some of the TPM/TPM2 DEBUG messages are at EFI_D_INFO level, even though they 
are simply tracing functions that run on every boot even if there is no TPM 
installed. Changed verbosity to EFI_D_VERBOSE.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Samer El-Haj-Mahmoud 
---
 .../DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c  |  3 ++-
 SecurityPkg/Library/HashLibTpm2/HashLibTpm2.c  | 13 ++--
 SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c  | 23 +++---
 SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Tis.c| 23 +++---
 4 files changed, 33 insertions(+), 29 deletions(-)

diff --git a/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c 
b/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c
index 26bf6fb..1f2574e 100644
--- a/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c
+++ b/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c
@@ -16,6 +16,7 @@
   partition data carefully.
 
 Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.
+(C) Copyright 2015 Hewlett Packard Enterprise Development LP
 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 @@ -447,7 +448,7 @@ 
DxeTpm2MeasureBootHandler (
 // Tcg2 protocol is not installed. So, TPM2 is not present.
 // Don't do any measurement, and directly return EFI_SUCCESS.
 //
-DEBUG ((EFI_D_INFO, "DxeTpm2MeasureBootHandler - Tcg2 - %r\n", Status));
+DEBUG ((EFI_D_VERBOSE, "DxeTpm2MeasureBootHandler - Tcg2 - %r\n", 
+ Status));
 return EFI_SUCCESS;
   }
 
diff --git a/SecurityPkg/Library/HashLibTpm2/HashLibTpm2.c 
b/SecurityPkg/Library/HashLibTpm2/HashLibTpm2.c
index 379f2f7..075db4a 100644
--- a/SecurityPkg/Library/HashLibTpm2/HashLibTpm2.c
+++ b/SecurityPkg/Library/HashLibTpm2/HashLibTpm2.c
@@ -2,6 +2,7 @@
   Ihis library uses TPM2 device to calculation hash.
 
 Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved. 
+(C) Copyright 2015 Hewlett Packard Enterprise Development LP
 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 @@ -242,7 +243,7 @@ 
HashAndExtend (
   TPM2B_EVENTEventData;
   TPM2B_DIGEST   Result;
 
-  DEBUG((EFI_D_INFO, "\n HashAndExtend Entry \n"));
+  DEBUG((EFI_D_VERBOSE, "\n HashAndExtend Entry \n"));
 
   SequenceHandle = 0x; // Know bad value
 
@@ -262,7 +263,7 @@ HashAndExtend (
   if (EFI_ERROR(Status)) {
 return EFI_DEVICE_ERROR;
   }
-  DEBUG((EFI_D_INFO, "\n Tpm2HashSequenceStart Success \n"));
+  DEBUG((EFI_D_VERBOSE, "\n Tpm2HashSequenceStart Success \n"));
 
   Buffer = (UINT8 *)(UINTN)DataToHash;
   for (HashLen = DataToHashLen; HashLen > sizeof(HashBuffer.buffer); HashLen 
-= sizeof(HashBuffer.buffer)) { @@ -276,7 +277,7 @@ HashAndExtend (
   return EFI_DEVICE_ERROR;
 }
   }
-  DEBUG((EFI_D_INFO, "\n Tpm2SequenceUpdate Success \n"));
+  DEBUG((EFI_D_VERBOSE, "\n Tpm2SequenceUpdate Success \n"));
 
   HashBuffer.size = (UINT16)HashLen;
   CopyMem(HashBuffer.buffer, Buffer, (UINTN)HashLen); @@ -294,7 +295,7 @@ 
HashAndExtend (
 if (EFI_ERROR(Status)) {
   return EFI_DEVICE_ERROR;
 }
-DEBUG((EFI_D_INFO, "\n Tpm2EventSequenceComplete Success \n"));
+DEBUG((EFI_D_VERBOSE, "\n Tpm2EventSequenceComplete Success \n"));
   } else {
 Status = Tpm2SequenceComplete (
SequenceHandle,
@@ -304,7 +305,7 @@ HashAndExtend (
 if (EFI_ERROR(Status)) {
   return EFI_DEVICE_ERROR;
 }
-DEBUG((EFI_D_INFO, "\n Tpm2SequenceComplete Success \n"));
+DEBUG((EFI_D_VERBOSE, "\n Tpm2SequenceComplete Success \n"));
 
 DigestList->count = 1;
 DigestList->digests[0].hashAlg = AlgoId; @@ -316,7 +317,7 @@ HashAndExtend 
(
 if (EFI_ERROR(Status)) {
   return EFI_DEVICE_ERROR;
 }
-DEBUG((EFI_D_INFO, "\n Tpm2PcrExtend Success \n"));
+DEBUG((EFI_D_VERBOSE, "\n Tpm2PcrExtend Success \n"));
   }
 
   return EFI_SUCCESS;
diff --git a/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c 
b/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c
index 2fb360f..b8d13aa 100644
--- a/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c
+++