]> git.proxmox.com Git - mirror_edk2.git/blobdiff - CryptoPkg/Library/BaseCryptLib/Pk/CryptAuthenticode.c
CryptoPkg: Fix typos in comments
[mirror_edk2.git] / CryptoPkg / Library / BaseCryptLib / Pk / CryptAuthenticode.c
index 4ce2b06b161c6d85341a89bf63567a006750e2c7..74e50a2e862bae55a13f9cb333cf511ecb09e3f1 100644 (file)
@@ -9,7 +9,7 @@
   AuthenticodeVerify() will get PE/COFF Authenticode and will do basic check for\r
   data structure.\r
 \r
-Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2011 - 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
@@ -34,7 +34,7 @@ UINT8 mSpcIndirectOidValue[] = {
   };\r
 \r
 /**\r
-  Verifies the validility of a PE/COFF Authenticode Signature as described in "Windows\r
+  Verifies the validity of a PE/COFF Authenticode Signature as described in "Windows\r
   Authenticode Portable Executable Signature Format".\r
 \r
   If AuthData is NULL, then return FALSE.\r
@@ -50,7 +50,7 @@ UINT8 mSpcIndirectOidValue[] = {
   @param[in]  TrustedCert  Pointer to a trusted/root certificate encoded in DER, which\r
                            is used for certificate chain verification.\r
   @param[in]  CertSize     Size of the trusted certificate in bytes.\r
-  @param[in]  ImageHash    Pointer to the original image file hash value. The procudure\r
+  @param[in]  ImageHash    Pointer to the original image file hash value. The procedure\r
                            for calculating the image hash value is described in Authenticode\r
                            specification.\r
   @param[in]  HashSize     Size of Image hash value in bytes.\r
@@ -72,11 +72,12 @@ AuthenticodeVerify (
 {\r
   BOOLEAN      Status;\r
   PKCS7        *Pkcs7;\r
+  CONST UINT8  *Temp;\r
   CONST UINT8  *OrigAuthData;\r
   UINT8        *SpcIndirectDataContent;\r
   UINT8        Asn1Byte;\r
   UINTN        ContentSize;\r
-  UINT8        *SpcIndirectDataOid;\r
+  CONST UINT8  *SpcIndirectDataOid;\r
 \r
   //\r
   // Check input parameters.\r
@@ -96,7 +97,8 @@ AuthenticodeVerify (
   //\r
   // Retrieve & Parse PKCS#7 Data (DER encoding) from Authenticode Signature\r
   //\r
-  Pkcs7 = d2i_PKCS7 (NULL, &AuthData, (int)DataSize);\r
+  Temp  = AuthData;\r
+  Pkcs7 = d2i_PKCS7 (NULL, &Temp, (int)DataSize);\r
   if (Pkcs7 == NULL) {\r
     goto _Exit;\r
   }\r
@@ -113,8 +115,9 @@ AuthenticodeVerify (
   //       some authenticode-specific structure. Use opaque ASN.1 string to retrieve\r
   //       PKCS#7 ContentInfo here.\r
   //\r
-  SpcIndirectDataOid = (UINT8 *)(Pkcs7->d.sign->contents->type->data);\r
-  if (CompareMem (\r
+  SpcIndirectDataOid = OBJ_get0_data(Pkcs7->d.sign->contents->type);\r
+  if (OBJ_length(Pkcs7->d.sign->contents->type) != sizeof(mSpcIndirectOidValue) ||\r
+      CompareMem (\r
         SpcIndirectDataOid,\r
         mSpcIndirectOidValue,\r
         sizeof (mSpcIndirectOidValue)\r