public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] CryptoPkg/BaseCryptLib: Use cmp-operator for non-Boolean comparisons
@ 2019-07-30  1:47 Gao, Zhichao
  2019-07-30  1:55 ` Wang, Jian J
       [not found] ` <15B60C8E2C30DA7D.4832@groups.io>
  0 siblings, 2 replies; 3+ messages in thread
From: Gao, Zhichao @ 2019-07-30  1:47 UTC (permalink / raw)
  To: devel; +Cc: Jian Wang, Ting Ye

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>
---
 .../BaseCryptLib/Pk/CryptPkcs7VerifyEku.c        | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] CryptoPkg/BaseCryptLib: Use cmp-operator for non-Boolean comparisons
  2019-07-30  1:47 [PATCH] CryptoPkg/BaseCryptLib: Use cmp-operator for non-Boolean comparisons Gao, Zhichao
@ 2019-07-30  1:55 ` Wang, Jian J
       [not found] ` <15B60C8E2C30DA7D.4832@groups.io>
  1 sibling, 0 replies; 3+ messages in thread
From: Wang, Jian J @ 2019-07-30  1:55 UTC (permalink / raw)
  To: Gao, Zhichao, devel@edk2.groups.io; +Cc: Ye, Ting



Reviewed-by: Jian J Wang <jian.j.wang@intel.com>

> -----Original Message-----
> From: Gao, Zhichao
> Sent: Tuesday, July 30, 2019 9:48 AM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J <jian.j.wang@intel.com>; Ye, Ting <ting.ye@intel.com>
> Subject: [PATCH] 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>
> ---
>  .../BaseCryptLib/Pk/CryptPkcs7VerifyEku.c        | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> 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 != NULL) {
>      sk_X509_free (Signers);
>    }
> 
> @@ -230,11 +230,11 @@ Exit:
>    //
>    // Release Resources
>    //
> -  if (ClonedCert) {
> +  if (ClonedCert != NULL) {
>      X509_free (ClonedCert);
>    }
> 
> -  if (Eku) {
> +  if (Eku != NULL) {
>      sk_ASN1_OBJECT_pop_free (Eku, ASN1_OBJECT_free);
>    }
> 
> @@ -281,13 +281,13 @@ CheckEKUs(
>      //
>      // Finding required EKU in cert.
>      //
> -    if (Asn1ToFind) {
> +    if (Asn1ToFind != NULL) {
>        ASN1_OBJECT_free(Asn1ToFind);
>        Asn1ToFind = NULL;
>      }
> 
>      Asn1ToFind = OBJ_txt2obj (RequiredEKUs[Index], 0);
> -    if (!Asn1ToFind) {
> +    if (Asn1ToFind == NULL) {
>        //
>        // Fail to convert required EKU to ASN1.
>        //
> @@ -313,7 +313,7 @@ CheckEKUs(
> 
>  Exit:
> 
> -  if (Asn1ToFind) {
> +  if (Asn1ToFind != NULL) {
>      ASN1_OBJECT_free(Asn1ToFind);
>    }
> 
> @@ -508,11 +508,11 @@ Exit:
>      free (SignedData);
>    }
> 
> -  if (SignerCert) {
> +  if (SignerCert != NULL) {
>      X509_free (SignerCert);
>    }
> 
> -  if (Pkcs7) {
> +  if (Pkcs7 != NULL) {
>      PKCS7_free (Pkcs7);
>    }
> 
> --
> 2.21.0.windows.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [edk2-devel] [PATCH] CryptoPkg/BaseCryptLib: Use cmp-operator for non-Boolean comparisons
       [not found] ` <15B60C8E2C30DA7D.4832@groups.io>
@ 2019-07-31  1:21   ` Wang, Jian J
  0 siblings, 0 replies; 3+ messages in thread
From: Wang, Jian J @ 2019-07-31  1:21 UTC (permalink / raw)
  To: devel@edk2.groups.io, Wang, Jian J, Gao, Zhichao; +Cc: Ye, Ting

Pushed at b3d00df69c78fa0e12986a7ff334689a76f4578a

Regards,
Jian


> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Wang, Jian J
> Sent: Tuesday, July 30, 2019 9:55 AM
> To: Gao, Zhichao <zhichao.gao@intel.com>; devel@edk2.groups.io
> Cc: Ye, Ting <ting.ye@intel.com>
> Subject: Re: [edk2-devel] [PATCH] CryptoPkg/BaseCryptLib: Use cmp-
> operator for non-Boolean comparisons
> 
> 
> 
> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
> 
> > -----Original Message-----
> > From: Gao, Zhichao
> > Sent: Tuesday, July 30, 2019 9:48 AM
> > To: devel@edk2.groups.io
> > Cc: Wang, Jian J <jian.j.wang@intel.com>; Ye, Ting <ting.ye@intel.com>
> > Subject: [PATCH] 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>
> > ---
> >  .../BaseCryptLib/Pk/CryptPkcs7VerifyEku.c        | 16 ++++++++--------
> >  1 file changed, 8 insertions(+), 8 deletions(-)
> >
> > 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 != NULL) {
> >      sk_X509_free (Signers);
> >    }
> >
> > @@ -230,11 +230,11 @@ Exit:
> >    //
> >    // Release Resources
> >    //
> > -  if (ClonedCert) {
> > +  if (ClonedCert != NULL) {
> >      X509_free (ClonedCert);
> >    }
> >
> > -  if (Eku) {
> > +  if (Eku != NULL) {
> >      sk_ASN1_OBJECT_pop_free (Eku, ASN1_OBJECT_free);
> >    }
> >
> > @@ -281,13 +281,13 @@ CheckEKUs(
> >      //
> >      // Finding required EKU in cert.
> >      //
> > -    if (Asn1ToFind) {
> > +    if (Asn1ToFind != NULL) {
> >        ASN1_OBJECT_free(Asn1ToFind);
> >        Asn1ToFind = NULL;
> >      }
> >
> >      Asn1ToFind = OBJ_txt2obj (RequiredEKUs[Index], 0);
> > -    if (!Asn1ToFind) {
> > +    if (Asn1ToFind == NULL) {
> >        //
> >        // Fail to convert required EKU to ASN1.
> >        //
> > @@ -313,7 +313,7 @@ CheckEKUs(
> >
> >  Exit:
> >
> > -  if (Asn1ToFind) {
> > +  if (Asn1ToFind != NULL) {
> >      ASN1_OBJECT_free(Asn1ToFind);
> >    }
> >
> > @@ -508,11 +508,11 @@ Exit:
> >      free (SignedData);
> >    }
> >
> > -  if (SignerCert) {
> > +  if (SignerCert != NULL) {
> >      X509_free (SignerCert);
> >    }
> >
> > -  if (Pkcs7) {
> > +  if (Pkcs7 != NULL) {
> >      PKCS7_free (Pkcs7);
> >    }
> >
> > --
> > 2.21.0.windows.1
> 
> 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-31  1:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-30  1:47 [PATCH] CryptoPkg/BaseCryptLib: Use cmp-operator for non-Boolean comparisons Gao, Zhichao
2019-07-30  1:55 ` Wang, Jian J
     [not found] ` <15B60C8E2C30DA7D.4832@groups.io>
2019-07-31  1:21   ` [edk2-devel] " Wang, Jian J

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox