Revision: 19559
          http://sourceforge.net/p/edk2/code/19559
Author:   vanjeff
Date:     2015-12-29 03:13:10 +0000 (Tue, 29 Dec 2015)
Log Message:
-----------
CryptoPkg/BaseCryptLib: Clean up checking of PKCS#7 contents type

Use the new OBJ_get0_data() accessor to compare the data, and actually
check the length of the object too.

(Sync patch r18702 from main trunk.)

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: David Woodhouse <[email protected]>
Tested-by: Laszlo Ersek <[email protected]>
Reviewed-by: Qin Long <[email protected]>

Revision Links:
--------------
    http://sourceforge.net/p/edk2/code/18702

Modified Paths:
--------------
    branches/UDK2015/CryptoPkg/Library/BaseCryptLib/Pk/CryptAuthenticode.c

Modified: branches/UDK2015/CryptoPkg/Library/BaseCryptLib/Pk/CryptAuthenticode.c
===================================================================
--- branches/UDK2015/CryptoPkg/Library/BaseCryptLib/Pk/CryptAuthenticode.c      
2015-12-29 03:12:37 UTC (rev 19558)
+++ branches/UDK2015/CryptoPkg/Library/BaseCryptLib/Pk/CryptAuthenticode.c      
2015-12-29 03:13:10 UTC (rev 19559)
@@ -77,7 +77,7 @@
   UINT8        *SpcIndirectDataContent;
   UINT8        Asn1Byte;
   UINTN        ContentSize;
-  UINT8        *SpcIndirectDataOid;
+  CONST UINT8  *SpcIndirectDataOid;
 
   //
   // Check input parameters.
@@ -115,8 +115,9 @@
   //       some authenticode-specific structure. Use opaque ASN.1 string to 
retrieve
   //       PKCS#7 ContentInfo here.
   //
-  SpcIndirectDataOid = (UINT8 *)(Pkcs7->d.sign->contents->type->data);
-  if (CompareMem (
+  SpcIndirectDataOid = OBJ_get0_data(Pkcs7->d.sign->contents->type);
+  if (OBJ_length(Pkcs7->d.sign->contents->type) != 
sizeof(mSpcIndirectOidValue) ||
+      CompareMem (
         SpcIndirectDataOid,
         mSpcIndirectOidValue,
         sizeof (mSpcIndirectOidValue)


------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to