CrptoPkg/BaseCryptLib: Fix type mismatch when calling OpenSSL function

Type definition in UEFI & OpeenSSL is different. Sometime it could cause
write overflow. Should use same data type when accessing the same region

Cc: Long Qin <qin.long@intel.com>
Cc: Chen Chen <chen.a.chen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Long Qin <qin.long@intel.com>
This commit is contained in:
Zhang, Chao B 2018-01-15 09:50:38 +08:00
parent 57d1afc889
commit 2067d9f8bf

View File

@ -644,8 +644,8 @@ X509GetTBSCert (
) )
{ {
CONST UINT8 *Temp; CONST UINT8 *Temp;
INTN Asn1Tag; UINT32 Asn1Tag;
INTN ObjClass; UINT32 ObjClass;
UINTN Length; UINTN Length;
// //
@ -673,7 +673,8 @@ X509GetTBSCert (
// So we can just ASN1-parse the x.509 DER-encoded data. If we strip // So we can just ASN1-parse the x.509 DER-encoded data. If we strip
// the first SEQUENCE, the second SEQUENCE is the TBSCertificate. // the first SEQUENCE, the second SEQUENCE is the TBSCertificate.
// //
Temp = Cert; Temp = Cert;
Length = 0;
ASN1_get_object (&Temp, (long *)&Length, (int *)&Asn1Tag, (int *)&ObjClass, (long)CertSize); ASN1_get_object (&Temp, (long *)&Length, (int *)&Asn1Tag, (int *)&ObjClass, (long)CertSize);
if (Asn1Tag != V_ASN1_SEQUENCE) { if (Asn1Tag != V_ASN1_SEQUENCE) {