Re: [edk2] [Patch 6/6] SecurityPkg: Use PcdGetSize to get the size of VOID* PCD value.

2015-08-20 Thread Zeng, Star

On 2015/8/18 17:25, Liming Gao wrote:

PcdLib introduces generic API to get the size of VOID* PCD value.
Update Pei and Dxe RsaGuidedLib to use generic PCD API instead of GetEx API.
This change can remove PCD type limitation in these two libraries.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao 


Reviewed-by: Star Zeng 


---
  .../DxeRsa2048Sha256GuidedSectionExtractLib.c | 4 ++--
  .../DxeRsa2048Sha256GuidedSectionExtractLib.inf   | 4 ++--
  .../PeiRsa2048Sha256GuidedSectionExtractLib.c | 4 ++--
  .../PeiRsa2048Sha256GuidedSectionExtractLib.inf   | 2 +-
  4 files changed, 7 insertions(+), 7 deletions(-)

diff --git 
a/SecurityPkg/Library/DxeRsa2048Sha256GuidedSectionExtractLib/DxeRsa2048Sha256GuidedSectionExtractLib.c
 
b/SecurityPkg/Library/DxeRsa2048Sha256GuidedSectionExtractLib/DxeRsa2048Sha256GuidedSectionExtractLib.c
index 2b61014..1f7a299 100644
--- 
a/SecurityPkg/Library/DxeRsa2048Sha256GuidedSectionExtractLib/DxeRsa2048Sha256GuidedSectionExtractLib.c
+++ 
b/SecurityPkg/Library/DxeRsa2048Sha256GuidedSectionExtractLib/DxeRsa2048Sha256GuidedSectionExtractLib.c
@@ -2,11 +2,11 @@

This library registers RSA 2048 SHA 256 guided section handler
to parse RSA 2048 SHA 256 encapsulation section and extract raw data.
It uses the BaseCrypyLib based on OpenSSL to authenticate the signature.

-Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.
+Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.
  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
  http://opensource.org/licenses/bsd-license.php

@@ -270,11 +270,11 @@ Rsa2048Sha256GuidedSectionHandler (
//
PublicKey = (UINT8 *)PcdGetPtr (PcdRsa2048Sha256PublicKeyBuffer);
DEBUG ((DEBUG_VERBOSE, "DxePcdRsa2048Sha256: PublicKeyBuffer = %p\n", 
PublicKey));
ASSERT (PublicKey != NULL);
DEBUG ((DEBUG_VERBOSE, "DxePcdRsa2048Sha256: PublicKeyBuffer Token = 
%08x\n", PcdToken (PcdRsa2048Sha256PublicKeyBuffer)));
-  PublicKeyBufferSize = LibPcdGetExSize (&gEfiSecurityPkgTokenSpaceGuid, 
PcdToken (PcdRsa2048Sha256PublicKeyBuffer));
+  PublicKeyBufferSize = PcdGetSize (PcdRsa2048Sha256PublicKeyBuffer);
DEBUG ((DEBUG_VERBOSE, "DxePcdRsa2048Sha256: PublicKeyBuffer Size = 
%08x\n", PublicKeyBufferSize));
ASSERT ((PublicKeyBufferSize % SHA256_DIGEST_SIZE) == 0);
CryptoStatus = FALSE;
while (PublicKeyBufferSize != 0) {
  if (CompareMem (Digest, PublicKey, SHA256_DIGEST_SIZE) == 0) {
diff --git 
a/SecurityPkg/Library/DxeRsa2048Sha256GuidedSectionExtractLib/DxeRsa2048Sha256GuidedSectionExtractLib.inf
 
b/SecurityPkg/Library/DxeRsa2048Sha256GuidedSectionExtractLib/DxeRsa2048Sha256GuidedSectionExtractLib.inf
index f1777f4..4681f08 100644
--- 
a/SecurityPkg/Library/DxeRsa2048Sha256GuidedSectionExtractLib/DxeRsa2048Sha256GuidedSectionExtractLib.inf
+++ 
b/SecurityPkg/Library/DxeRsa2048Sha256GuidedSectionExtractLib/DxeRsa2048Sha256GuidedSectionExtractLib.inf
@@ -48,13 +48,13 @@
MemoryAllocationLib
BaseCryptLib
PcdLib
PerformanceLib

-[PcdEx]
+[Pcd]
gEfiSecurityPkgTokenSpaceGuid.PcdRsa2048Sha256PublicKeyBuffer## 
SOMETIMES_CONSUMES
-
+
  [Protocols]
gEfiSecurityPolicyProtocolGuid   ## SOMETIMES_CONSUMES (Set 
platform override AUTH status if exist)

  [Guids]
gEfiCertTypeRsa2048Sha256Guid  ## PRODUCES   ## UNDEFINED  # Specifies 
RSA 2048 SHA 256 authentication algorithm.
diff --git 
a/SecurityPkg/Library/PeiRsa2048Sha256GuidedSectionExtractLib/PeiRsa2048Sha256GuidedSectionExtractLib.c
 
b/SecurityPkg/Library/PeiRsa2048Sha256GuidedSectionExtractLib/PeiRsa2048Sha256GuidedSectionExtractLib.c
index 8c0047e..e2a0fb6 100644
--- 
a/SecurityPkg/Library/PeiRsa2048Sha256GuidedSectionExtractLib/PeiRsa2048Sha256GuidedSectionExtractLib.c
+++ 
b/SecurityPkg/Library/PeiRsa2048Sha256GuidedSectionExtractLib/PeiRsa2048Sha256GuidedSectionExtractLib.c
@@ -2,11 +2,11 @@

This library registers RSA 2048 SHA 256 guided section handler
to parse RSA 2048 SHA 256 encapsulation section and extract raw data.
It uses the BaseCrypyLib based on OpenSSL to authenticate the signature.

-Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.
+Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.
  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
  http://opensource.org/licenses/bsd-license.php

@@ -254,11 +254,11 @@ Rsa2048Sha256GuidedSectionHandler (
//
PublicKey = (UINT8 *)PcdGetPtr (PcdRsa2048Sha256PublicKeyBuffer);
DEBUG ((DEBUG_VERBOSE, "PeiPcdRsa2048Sha256: PublicKeyBuffer = %p\n", 

[edk2] [Patch 6/6] SecurityPkg: Use PcdGetSize to get the size of VOID* PCD value.

2015-08-18 Thread Liming Gao
PcdLib introduces generic API to get the size of VOID* PCD value.
Update Pei and Dxe RsaGuidedLib to use generic PCD API instead of GetEx API.
This change can remove PCD type limitation in these two libraries.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao 
---
 .../DxeRsa2048Sha256GuidedSectionExtractLib.c | 4 ++--
 .../DxeRsa2048Sha256GuidedSectionExtractLib.inf   | 4 ++--
 .../PeiRsa2048Sha256GuidedSectionExtractLib.c | 4 ++--
 .../PeiRsa2048Sha256GuidedSectionExtractLib.inf   | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git 
a/SecurityPkg/Library/DxeRsa2048Sha256GuidedSectionExtractLib/DxeRsa2048Sha256GuidedSectionExtractLib.c
 
b/SecurityPkg/Library/DxeRsa2048Sha256GuidedSectionExtractLib/DxeRsa2048Sha256GuidedSectionExtractLib.c
index 2b61014..1f7a299 100644
--- 
a/SecurityPkg/Library/DxeRsa2048Sha256GuidedSectionExtractLib/DxeRsa2048Sha256GuidedSectionExtractLib.c
+++ 
b/SecurityPkg/Library/DxeRsa2048Sha256GuidedSectionExtractLib/DxeRsa2048Sha256GuidedSectionExtractLib.c
@@ -2,11 +2,11 @@
 
   This library registers RSA 2048 SHA 256 guided section handler 
   to parse RSA 2048 SHA 256 encapsulation section and extract raw data.
   It uses the BaseCrypyLib based on OpenSSL to authenticate the signature.
 
-Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.
+Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.
 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
 http://opensource.org/licenses/bsd-license.php 
   

   
@@ -270,11 +270,11 @@ Rsa2048Sha256GuidedSectionHandler (
   //
   PublicKey = (UINT8 *)PcdGetPtr (PcdRsa2048Sha256PublicKeyBuffer);
   DEBUG ((DEBUG_VERBOSE, "DxePcdRsa2048Sha256: PublicKeyBuffer = %p\n", 
PublicKey));
   ASSERT (PublicKey != NULL);
   DEBUG ((DEBUG_VERBOSE, "DxePcdRsa2048Sha256: PublicKeyBuffer Token = 
%08x\n", PcdToken (PcdRsa2048Sha256PublicKeyBuffer)));
-  PublicKeyBufferSize = LibPcdGetExSize (&gEfiSecurityPkgTokenSpaceGuid, 
PcdToken (PcdRsa2048Sha256PublicKeyBuffer));
+  PublicKeyBufferSize = PcdGetSize (PcdRsa2048Sha256PublicKeyBuffer);
   DEBUG ((DEBUG_VERBOSE, "DxePcdRsa2048Sha256: PublicKeyBuffer Size = %08x\n", 
PublicKeyBufferSize));
   ASSERT ((PublicKeyBufferSize % SHA256_DIGEST_SIZE) == 0);
   CryptoStatus = FALSE;
   while (PublicKeyBufferSize != 0) {
 if (CompareMem (Digest, PublicKey, SHA256_DIGEST_SIZE) == 0) {
diff --git 
a/SecurityPkg/Library/DxeRsa2048Sha256GuidedSectionExtractLib/DxeRsa2048Sha256GuidedSectionExtractLib.inf
 
b/SecurityPkg/Library/DxeRsa2048Sha256GuidedSectionExtractLib/DxeRsa2048Sha256GuidedSectionExtractLib.inf
index f1777f4..4681f08 100644
--- 
a/SecurityPkg/Library/DxeRsa2048Sha256GuidedSectionExtractLib/DxeRsa2048Sha256GuidedSectionExtractLib.inf
+++ 
b/SecurityPkg/Library/DxeRsa2048Sha256GuidedSectionExtractLib/DxeRsa2048Sha256GuidedSectionExtractLib.inf
@@ -48,13 +48,13 @@
   MemoryAllocationLib
   BaseCryptLib
   PcdLib
   PerformanceLib
 
-[PcdEx]  
+[Pcd]  
   gEfiSecurityPkgTokenSpaceGuid.PcdRsa2048Sha256PublicKeyBuffer## 
SOMETIMES_CONSUMES
-  
+
 [Protocols]
   gEfiSecurityPolicyProtocolGuid   ## SOMETIMES_CONSUMES (Set 
platform override AUTH status if exist)
   
 [Guids]
   gEfiCertTypeRsa2048Sha256Guid  ## PRODUCES   ## UNDEFINED  # Specifies 
RSA 2048 SHA 256 authentication algorithm.
diff --git 
a/SecurityPkg/Library/PeiRsa2048Sha256GuidedSectionExtractLib/PeiRsa2048Sha256GuidedSectionExtractLib.c
 
b/SecurityPkg/Library/PeiRsa2048Sha256GuidedSectionExtractLib/PeiRsa2048Sha256GuidedSectionExtractLib.c
index 8c0047e..e2a0fb6 100644
--- 
a/SecurityPkg/Library/PeiRsa2048Sha256GuidedSectionExtractLib/PeiRsa2048Sha256GuidedSectionExtractLib.c
+++ 
b/SecurityPkg/Library/PeiRsa2048Sha256GuidedSectionExtractLib/PeiRsa2048Sha256GuidedSectionExtractLib.c
@@ -2,11 +2,11 @@
 
   This library registers RSA 2048 SHA 256 guided section handler 
   to parse RSA 2048 SHA 256 encapsulation section and extract raw data.
   It uses the BaseCrypyLib based on OpenSSL to authenticate the signature.
 
-Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.
+Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.
 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
 http://opensource.org/licenses/bsd-license.php