public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 1/1] CryptoPkg/BaseCryptLib: Update pHkdfCtx to PHkdfCtx
@ 2019-08-15  8:49 Zhang, Shenglei
  2019-08-15  9:01 ` Wang, Jian J
  0 siblings, 1 reply; 3+ messages in thread
From: Zhang, Shenglei @ 2019-08-15  8:49 UTC (permalink / raw)
  To: devel; +Cc: Jian Wang, Ting Ye

Update pHkdfCtx to PHkdfCtx, to follow the variable naming
rule.

Cc: Jian Wang <jian.j.wang@intel.com>
Cc: Ting Ye <ting.ye@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
---
 .../Library/BaseCryptLib/Kdf/CryptHkdf.c      | 22 +++++++++----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/CryptoPkg/Library/BaseCryptLib/Kdf/CryptHkdf.c b/CryptoPkg/Library/BaseCryptLib/Kdf/CryptHkdf.c
index f0fcef211d3f..488346a38b8c 100644
--- a/CryptoPkg/Library/BaseCryptLib/Kdf/CryptHkdf.c
+++ b/CryptoPkg/Library/BaseCryptLib/Kdf/CryptHkdf.c
@@ -39,7 +39,7 @@ HkdfSha256ExtractAndExpand (
   IN   UINTN        OutSize
   )
 {
-  EVP_PKEY_CTX *pHkdfCtx;
+  EVP_PKEY_CTX *PHkdfCtx;
   BOOLEAN Result;
 
   if (Key == NULL || Salt == NULL || Info == NULL || Out == NULL ||
@@ -47,29 +47,29 @@ HkdfSha256ExtractAndExpand (
     return FALSE;
   }
 
-  pHkdfCtx = EVP_PKEY_CTX_new_id(EVP_PKEY_HKDF, NULL);
-  if (pHkdfCtx == NULL) {
+  PHkdfCtx = EVP_PKEY_CTX_new_id(EVP_PKEY_HKDF, NULL);
+  if (PHkdfCtx == NULL) {
     return FALSE;
   }
 
-  Result = EVP_PKEY_derive_init(pHkdfCtx) > 0;
+  Result = EVP_PKEY_derive_init(PHkdfCtx) > 0;
   if (Result) {
-    Result = EVP_PKEY_CTX_set_hkdf_md(pHkdfCtx, EVP_sha256()) > 0;
+    Result = EVP_PKEY_CTX_set_hkdf_md(PHkdfCtx, EVP_sha256()) > 0;
   }
   if (Result) {
-    Result = EVP_PKEY_CTX_set1_hkdf_salt(pHkdfCtx, Salt, (UINT32)SaltSize) > 0;
+    Result = EVP_PKEY_CTX_set1_hkdf_salt(PHkdfCtx, Salt, (UINT32)SaltSize) > 0;
   }
   if (Result) {
-    Result = EVP_PKEY_CTX_set1_hkdf_key(pHkdfCtx, Key, (UINT32)KeySize) > 0;
+    Result = EVP_PKEY_CTX_set1_hkdf_key(PHkdfCtx, Key, (UINT32)KeySize) > 0;
   }
   if (Result) {
-    Result = EVP_PKEY_CTX_add1_hkdf_info(pHkdfCtx, Info, (UINT32)InfoSize) > 0;
+    Result = EVP_PKEY_CTX_add1_hkdf_info(PHkdfCtx, Info, (UINT32)InfoSize) > 0;
   }
   if (Result) {
-    Result = EVP_PKEY_derive(pHkdfCtx, Out, &OutSize) > 0;
+    Result = EVP_PKEY_derive(PHkdfCtx, Out, &OutSize) > 0;
   }
 
-  EVP_PKEY_CTX_free(pHkdfCtx);
-  pHkdfCtx = NULL;
+  EVP_PKEY_CTX_free(PHkdfCtx);
+  PHkdfCtx = NULL;
   return Result;
 }
-- 
2.18.0.windows.1


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

* Re: [PATCH 1/1] CryptoPkg/BaseCryptLib: Update pHkdfCtx to PHkdfCtx
  2019-08-15  8:49 [PATCH 1/1] CryptoPkg/BaseCryptLib: Update pHkdfCtx to PHkdfCtx Zhang, Shenglei
@ 2019-08-15  9:01 ` Wang, Jian J
  2019-08-15 11:35   ` Zhang, Shenglei
  0 siblings, 1 reply; 3+ messages in thread
From: Wang, Jian J @ 2019-08-15  9:01 UTC (permalink / raw)
  To: Zhang, Shenglei, devel@edk2.groups.io; +Cc: Ye, Ting

Shenglei,

I remember the edk2 coding style allows prefix 'p' (optional) to represent a pointer variable.

Regards,
Jian


> -----Original Message-----
> From: Zhang, Shenglei
> Sent: Thursday, August 15, 2019 4:49 PM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J <jian.j.wang@intel.com>; Ye, Ting <ting.ye@intel.com>
> Subject: [PATCH 1/1] CryptoPkg/BaseCryptLib: Update pHkdfCtx to
> PHkdfCtx
> 
> Update pHkdfCtx to PHkdfCtx, to follow the variable naming
> rule.
> 
> Cc: Jian Wang <jian.j.wang@intel.com>
> Cc: Ting Ye <ting.ye@intel.com>
> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
> ---
>  .../Library/BaseCryptLib/Kdf/CryptHkdf.c      | 22 +++++++++----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/CryptoPkg/Library/BaseCryptLib/Kdf/CryptHkdf.c
> b/CryptoPkg/Library/BaseCryptLib/Kdf/CryptHkdf.c
> index f0fcef211d3f..488346a38b8c 100644
> --- a/CryptoPkg/Library/BaseCryptLib/Kdf/CryptHkdf.c
> +++ b/CryptoPkg/Library/BaseCryptLib/Kdf/CryptHkdf.c
> @@ -39,7 +39,7 @@ HkdfSha256ExtractAndExpand (
>    IN   UINTN        OutSize
>    )
>  {
> -  EVP_PKEY_CTX *pHkdfCtx;
> +  EVP_PKEY_CTX *PHkdfCtx;
>    BOOLEAN Result;
> 
>    if (Key == NULL || Salt == NULL || Info == NULL || Out == NULL ||
> @@ -47,29 +47,29 @@ HkdfSha256ExtractAndExpand (
>      return FALSE;
>    }
> 
> -  pHkdfCtx = EVP_PKEY_CTX_new_id(EVP_PKEY_HKDF, NULL);
> -  if (pHkdfCtx == NULL) {
> +  PHkdfCtx = EVP_PKEY_CTX_new_id(EVP_PKEY_HKDF, NULL);
> +  if (PHkdfCtx == NULL) {
>      return FALSE;
>    }
> 
> -  Result = EVP_PKEY_derive_init(pHkdfCtx) > 0;
> +  Result = EVP_PKEY_derive_init(PHkdfCtx) > 0;
>    if (Result) {
> -    Result = EVP_PKEY_CTX_set_hkdf_md(pHkdfCtx, EVP_sha256()) > 0;
> +    Result = EVP_PKEY_CTX_set_hkdf_md(PHkdfCtx, EVP_sha256()) > 0;
>    }
>    if (Result) {
> -    Result = EVP_PKEY_CTX_set1_hkdf_salt(pHkdfCtx, Salt,
> (UINT32)SaltSize) > 0;
> +    Result = EVP_PKEY_CTX_set1_hkdf_salt(PHkdfCtx, Salt,
> (UINT32)SaltSize) > 0;
>    }
>    if (Result) {
> -    Result = EVP_PKEY_CTX_set1_hkdf_key(pHkdfCtx, Key,
> (UINT32)KeySize) > 0;
> +    Result = EVP_PKEY_CTX_set1_hkdf_key(PHkdfCtx, Key,
> (UINT32)KeySize) > 0;
>    }
>    if (Result) {
> -    Result = EVP_PKEY_CTX_add1_hkdf_info(pHkdfCtx, Info,
> (UINT32)InfoSize) > 0;
> +    Result = EVP_PKEY_CTX_add1_hkdf_info(PHkdfCtx, Info,
> (UINT32)InfoSize) > 0;
>    }
>    if (Result) {
> -    Result = EVP_PKEY_derive(pHkdfCtx, Out, &OutSize) > 0;
> +    Result = EVP_PKEY_derive(PHkdfCtx, Out, &OutSize) > 0;
>    }
> 
> -  EVP_PKEY_CTX_free(pHkdfCtx);
> -  pHkdfCtx = NULL;
> +  EVP_PKEY_CTX_free(PHkdfCtx);
> +  PHkdfCtx = NULL;
>    return Result;
>  }
> --
> 2.18.0.windows.1


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

* Re: [PATCH 1/1] CryptoPkg/BaseCryptLib: Update pHkdfCtx to PHkdfCtx
  2019-08-15  9:01 ` Wang, Jian J
@ 2019-08-15 11:35   ` Zhang, Shenglei
  0 siblings, 0 replies; 3+ messages in thread
From: Zhang, Shenglei @ 2019-08-15 11:35 UTC (permalink / raw)
  To: Wang, Jian J, devel@edk2.groups.io; +Cc: Ye, Ting

Jian,

Yes, you are right. 
According to CCS_2_1_Draft, 4.3.3.3, Pointer variables may optionally be prefixed with a 'p'.
So please skip this change.

Thanks,
Shenglei

> -----Original Message-----
> From: Wang, Jian J
> Sent: Thursday, August 15, 2019 5:01 PM
> To: Zhang, Shenglei <shenglei.zhang@intel.com>; devel@edk2.groups.io
> Cc: Ye, Ting <ting.ye@intel.com>
> Subject: RE: [PATCH 1/1] CryptoPkg/BaseCryptLib: Update pHkdfCtx to
> PHkdfCtx
> 
> Shenglei,
> 
> I remember the edk2 coding style allows prefix 'p' (optional) to represent a
> pointer variable.
> 
> Regards,
> Jian
> 
> 
> > -----Original Message-----
> > From: Zhang, Shenglei
> > Sent: Thursday, August 15, 2019 4:49 PM
> > To: devel@edk2.groups.io
> > Cc: Wang, Jian J <jian.j.wang@intel.com>; Ye, Ting <ting.ye@intel.com>
> > Subject: [PATCH 1/1] CryptoPkg/BaseCryptLib: Update pHkdfCtx to
> > PHkdfCtx
> >
> > Update pHkdfCtx to PHkdfCtx, to follow the variable naming
> > rule.
> >
> > Cc: Jian Wang <jian.j.wang@intel.com>
> > Cc: Ting Ye <ting.ye@intel.com>
> > Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
> > ---
> >  .../Library/BaseCryptLib/Kdf/CryptHkdf.c      | 22 +++++++++----------
> >  1 file changed, 11 insertions(+), 11 deletions(-)
> >
> > diff --git a/CryptoPkg/Library/BaseCryptLib/Kdf/CryptHkdf.c
> > b/CryptoPkg/Library/BaseCryptLib/Kdf/CryptHkdf.c
> > index f0fcef211d3f..488346a38b8c 100644
> > --- a/CryptoPkg/Library/BaseCryptLib/Kdf/CryptHkdf.c
> > +++ b/CryptoPkg/Library/BaseCryptLib/Kdf/CryptHkdf.c
> > @@ -39,7 +39,7 @@ HkdfSha256ExtractAndExpand (
> >    IN   UINTN        OutSize
> >    )
> >  {
> > -  EVP_PKEY_CTX *pHkdfCtx;
> > +  EVP_PKEY_CTX *PHkdfCtx;
> >    BOOLEAN Result;
> >
> >    if (Key == NULL || Salt == NULL || Info == NULL || Out == NULL ||
> > @@ -47,29 +47,29 @@ HkdfSha256ExtractAndExpand (
> >      return FALSE;
> >    }
> >
> > -  pHkdfCtx = EVP_PKEY_CTX_new_id(EVP_PKEY_HKDF, NULL);
> > -  if (pHkdfCtx == NULL) {
> > +  PHkdfCtx = EVP_PKEY_CTX_new_id(EVP_PKEY_HKDF, NULL);
> > +  if (PHkdfCtx == NULL) {
> >      return FALSE;
> >    }
> >
> > -  Result = EVP_PKEY_derive_init(pHkdfCtx) > 0;
> > +  Result = EVP_PKEY_derive_init(PHkdfCtx) > 0;
> >    if (Result) {
> > -    Result = EVP_PKEY_CTX_set_hkdf_md(pHkdfCtx, EVP_sha256()) > 0;
> > +    Result = EVP_PKEY_CTX_set_hkdf_md(PHkdfCtx, EVP_sha256()) > 0;
> >    }
> >    if (Result) {
> > -    Result = EVP_PKEY_CTX_set1_hkdf_salt(pHkdfCtx, Salt,
> > (UINT32)SaltSize) > 0;
> > +    Result = EVP_PKEY_CTX_set1_hkdf_salt(PHkdfCtx, Salt,
> > (UINT32)SaltSize) > 0;
> >    }
> >    if (Result) {
> > -    Result = EVP_PKEY_CTX_set1_hkdf_key(pHkdfCtx, Key,
> > (UINT32)KeySize) > 0;
> > +    Result = EVP_PKEY_CTX_set1_hkdf_key(PHkdfCtx, Key,
> > (UINT32)KeySize) > 0;
> >    }
> >    if (Result) {
> > -    Result = EVP_PKEY_CTX_add1_hkdf_info(pHkdfCtx, Info,
> > (UINT32)InfoSize) > 0;
> > +    Result = EVP_PKEY_CTX_add1_hkdf_info(PHkdfCtx, Info,
> > (UINT32)InfoSize) > 0;
> >    }
> >    if (Result) {
> > -    Result = EVP_PKEY_derive(pHkdfCtx, Out, &OutSize) > 0;
> > +    Result = EVP_PKEY_derive(PHkdfCtx, Out, &OutSize) > 0;
> >    }
> >
> > -  EVP_PKEY_CTX_free(pHkdfCtx);
> > -  pHkdfCtx = NULL;
> > +  EVP_PKEY_CTX_free(PHkdfCtx);
> > +  PHkdfCtx = NULL;
> >    return Result;
> >  }
> > --
> > 2.18.0.windows.1


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

end of thread, other threads:[~2019-08-15 11:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-15  8:49 [PATCH 1/1] CryptoPkg/BaseCryptLib: Update pHkdfCtx to PHkdfCtx Zhang, Shenglei
2019-08-15  9:01 ` Wang, Jian J
2019-08-15 11:35   ` Zhang, Shenglei

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