]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/Library/PeiRsa2048Sha256GuidedSectionExtractLib/PeiRsa2048Sha256GuidedSectionExtractLib.c
ShellPkg/pci: Fix VS2012 build failure
[mirror_edk2.git] / SecurityPkg / Library / PeiRsa2048Sha256GuidedSectionExtractLib / PeiRsa2048Sha256GuidedSectionExtractLib.c
index 8c0047edf860cd2221971349558ccbff178300de..ba1c700ad031adac4922fa63eea89c5281f03078 100644 (file)
@@ -4,7 +4,7 @@
   to parse RSA 2048 SHA 256 encapsulation section and extract raw data.\r
   It uses the BaseCrypyLib based on OpenSSL to authenticate the signature.\r
 \r
-Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2013 - 2015, 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
@@ -57,7 +57,7 @@ CONST UINT8 mRsaE[] = { 0x01, 0x00, 0x01 };
   @param SectionAttribute   The attribute of the input guided section.\r
 \r
   @retval EFI_SUCCESS            The size of destination buffer, the size of scratch buffer and \r
-                                 the attribute of the input section are successull retrieved.\r
+                                 the attribute of the input section are successfully retrieved.\r
   @retval EFI_INVALID_PARAMETER  The GUID in InputSection does not match this instance guid.\r
 \r
 **/\r
@@ -84,7 +84,7 @@ Rsa2048Sha256GuidedSectionGetInfo (
     //\r
     *SectionAttribute  = ((EFI_GUID_DEFINED_SECTION2 *) InputSection)->Attributes;\r
     *ScratchBufferSize = 0;\r
-    *OutputBufferSize  = SECTION2_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION2 *) InputSection)->DataOffset;\r
+    *OutputBufferSize  = SECTION2_SIZE (InputSection) - sizeof(RSA_2048_SHA_256_SECTION2_HEADER);\r
   } else {\r
     //\r
     // Check whether the input guid section is recognized.\r
@@ -99,7 +99,7 @@ Rsa2048Sha256GuidedSectionGetInfo (
     //\r
     *SectionAttribute  = ((EFI_GUID_DEFINED_SECTION *) InputSection)->Attributes;\r
     *ScratchBufferSize = 0;\r
-    *OutputBufferSize  = SECTION_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset;\r
+    *OutputBufferSize  = SECTION_SIZE (InputSection) - sizeof(RSA_2048_SHA_256_SECTION_HEADER);\r
   }\r
 \r
   return EFI_SUCCESS;\r
@@ -256,7 +256,7 @@ Rsa2048Sha256GuidedSectionHandler (
   DEBUG ((DEBUG_VERBOSE, "PeiPcdRsa2048Sha256: PublicKeyBuffer = %p\n", PublicKey));\r
   ASSERT (PublicKey != NULL);\r
   DEBUG ((DEBUG_VERBOSE, "PeiPcdRsa2048Sha256: PublicKeyBuffer Token = %08x\n", PcdToken (PcdRsa2048Sha256PublicKeyBuffer)));\r
-  PublicKeyBufferSize = LibPcdGetExSize (&gEfiSecurityPkgTokenSpaceGuid, PcdToken (PcdRsa2048Sha256PublicKeyBuffer));\r
+  PublicKeyBufferSize = PcdGetSize (PcdRsa2048Sha256PublicKeyBuffer);\r
   DEBUG ((DEBUG_VERBOSE, "PeiPcdRsa2048Sha256: PublicKeyBuffer Size = %08x\n", PublicKeyBufferSize));\r
   ASSERT ((PublicKeyBufferSize % SHA256_DIGEST_SIZE) == 0);\r
   CryptoStatus = FALSE;\r
@@ -357,12 +357,6 @@ Done:
     FreePool (HashContext);\r
   }\r
 \r
-  //\r
-  // Temp solution until PeiCore checks AUTH Status.\r
-  //\r
-  if ((*AuthenticationStatus & (EFI_AUTH_STATUS_TEST_FAILED | EFI_AUTH_STATUS_NOT_TESTED)) != 0) {\r
-    Status = EFI_ACCESS_DENIED;\r
-  }\r
   DEBUG ((DEBUG_VERBOSE, "PeiRsa2048Sha256: Status = %r  AuthenticationStatus = %08x\n", Status, *AuthenticationStatus));\r
 \r
   return Status;\r