From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: jian.j.wang@intel.com) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by groups.io with SMTP; Mon, 29 Jul 2019 18:55:25 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Jul 2019 18:55:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,325,1559545200"; d="scan'208";a="171756946" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga008.fm.intel.com with ESMTP; 29 Jul 2019 18:55:24 -0700 Received: from shsmsx153.ccr.corp.intel.com (10.239.6.53) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 29 Jul 2019 18:55:24 -0700 Received: from shsmsx107.ccr.corp.intel.com ([169.254.9.65]) by SHSMSX153.ccr.corp.intel.com ([169.254.12.215]) with mapi id 14.03.0439.000; Tue, 30 Jul 2019 09:55:22 +0800 From: "Wang, Jian J" To: "Gao, Zhichao" , "devel@edk2.groups.io" CC: "Ye, Ting" Subject: Re: [PATCH] CryptoPkg/BaseCryptLib: Use cmp-operator for non-Boolean comparisons Thread-Topic: [PATCH] CryptoPkg/BaseCryptLib: Use cmp-operator for non-Boolean comparisons Thread-Index: AQHVRnjO0WSvCfjH5EujZ0XVRJTN9qbiZpmQ Date: Tue, 30 Jul 2019 01:55:21 +0000 Message-ID: References: <20190730014745.20264-1-zhichao.gao@intel.com> In-Reply-To: <20190730014745.20264-1-zhichao.gao@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNWJjM2ZhMzgtZTQwNi00NjhmLWExZmItMzI0MzUxZTVkZGYyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiZ1NlUmoxbit5ZnRKUzc2NFl0d2RRYkhwQ0JGRmFITVpXWTlBQmJCTjBsNm5ES2MwM3ZtTkxmaFN3V2taUFNoUCJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: jian.j.wang@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jian J Wang > -----Original Message----- > From: Gao, Zhichao > Sent: Tuesday, July 30, 2019 9:48 AM > To: devel@edk2.groups.io > Cc: Wang, Jian J ; Ye, Ting > Subject: [PATCH] CryptoPkg/BaseCryptLib: Use cmp-operator for non- > Boolean comparisons >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2027 >=20 > Refer to CSS_2_1 5.7.2.1 "Non-Boolean comparisons must use a > compare operator (=3D=3D, !=3D, >, < >=3D, <=3D).", use compare operator > for the non-boolean comparisons. >=20 > Cc: Jian Wang > Cc: Ting Ye > Signed-off-by: Zhichao Gao > --- > .../BaseCryptLib/Pk/CryptPkcs7VerifyEku.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) >=20 > diff --git a/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyEku.c > b/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyEku.c > index a0ea3f85eb..229c244b26 100644 > --- a/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyEku.c > +++ b/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyEku.c > @@ -111,7 +111,7 @@ Exit: > // > // Release Resources > // > - if (Signers) { > + if (Signers !=3D NULL) { > sk_X509_free (Signers); > } >=20 > @@ -230,11 +230,11 @@ Exit: > // > // Release Resources > // > - if (ClonedCert) { > + if (ClonedCert !=3D NULL) { > X509_free (ClonedCert); > } >=20 > - if (Eku) { > + if (Eku !=3D NULL) { > sk_ASN1_OBJECT_pop_free (Eku, ASN1_OBJECT_free); > } >=20 > @@ -281,13 +281,13 @@ CheckEKUs( > // > // Finding required EKU in cert. > // > - if (Asn1ToFind) { > + if (Asn1ToFind !=3D NULL) { > ASN1_OBJECT_free(Asn1ToFind); > Asn1ToFind =3D NULL; > } >=20 > Asn1ToFind =3D OBJ_txt2obj (RequiredEKUs[Index], 0); > - if (!Asn1ToFind) { > + if (Asn1ToFind =3D=3D NULL) { > // > // Fail to convert required EKU to ASN1. > // > @@ -313,7 +313,7 @@ CheckEKUs( >=20 > Exit: >=20 > - if (Asn1ToFind) { > + if (Asn1ToFind !=3D NULL) { > ASN1_OBJECT_free(Asn1ToFind); > } >=20 > @@ -508,11 +508,11 @@ Exit: > free (SignedData); > } >=20 > - if (SignerCert) { > + if (SignerCert !=3D NULL) { > X509_free (SignerCert); > } >=20 > - if (Pkcs7) { > + if (Pkcs7 !=3D NULL) { > PKCS7_free (Pkcs7); > } >=20 > -- > 2.21.0.windows.1