CryptoPkg/BaseCryptLib: Use cmp-operator for non-Boolean comparisons

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2027

Refer to CSS_2_1 5.7.2.1 "Non-Boolean comparisons must use a
compare operator (==, !=, >, < >=, <=).", use compare operator
for the non-boolean comparisons.

Cc: Jian Wang <jian.j.wang@intel.com>
Cc: Ting Ye <ting.ye@intel.com>
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
This commit is contained in:
Zhichao Gao 2019-07-30 09:14:57 +08:00 committed by Jian J Wang
parent 3d34b5f326
commit b3d00df69c
1 changed files with 8 additions and 8 deletions

View File

@ -111,7 +111,7 @@ Exit:
// //
// Release Resources // Release Resources
// //
if (Signers) { if (Signers != NULL) {
sk_X509_free (Signers); sk_X509_free (Signers);
} }
@ -230,11 +230,11 @@ Exit:
// //
// Release Resources // Release Resources
// //
if (ClonedCert) { if (ClonedCert != NULL) {
X509_free (ClonedCert); X509_free (ClonedCert);
} }
if (Eku) { if (Eku != NULL) {
sk_ASN1_OBJECT_pop_free (Eku, ASN1_OBJECT_free); sk_ASN1_OBJECT_pop_free (Eku, ASN1_OBJECT_free);
} }
@ -281,13 +281,13 @@ CheckEKUs(
// //
// Finding required EKU in cert. // Finding required EKU in cert.
// //
if (Asn1ToFind) { if (Asn1ToFind != NULL) {
ASN1_OBJECT_free(Asn1ToFind); ASN1_OBJECT_free(Asn1ToFind);
Asn1ToFind = NULL; Asn1ToFind = NULL;
} }
Asn1ToFind = OBJ_txt2obj (RequiredEKUs[Index], 0); Asn1ToFind = OBJ_txt2obj (RequiredEKUs[Index], 0);
if (!Asn1ToFind) { if (Asn1ToFind == NULL) {
// //
// Fail to convert required EKU to ASN1. // Fail to convert required EKU to ASN1.
// //
@ -313,7 +313,7 @@ CheckEKUs(
Exit: Exit:
if (Asn1ToFind) { if (Asn1ToFind != NULL) {
ASN1_OBJECT_free(Asn1ToFind); ASN1_OBJECT_free(Asn1ToFind);
} }
@ -508,11 +508,11 @@ Exit:
free (SignedData); free (SignedData);
} }
if (SignerCert) { if (SignerCert != NULL) {
X509_free (SignerCert); X509_free (SignerCert);
} }
if (Pkcs7) { if (Pkcs7 != NULL) {
PKCS7_free (Pkcs7); PKCS7_free (Pkcs7);
} }