[edk2] [PATCH] SecurityPkg:AuthVariableLib:Fix GCC build error

Zhang, Chao B posted 1 patch 7 years, 2 months ago
Failed in applying to current master (apply log)
SecurityPkg/Library/AuthVariableLib/AuthService.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[edk2] [PATCH] SecurityPkg:AuthVariableLib:Fix GCC build error
Posted by Zhang, Chao B 7 years, 2 months ago
Fix GCC build error

Cc: Long Qin <qin.long@intel.com>
Cc: Gary Lin <glin@suse.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
---
 SecurityPkg/Library/AuthVariableLib/AuthService.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/SecurityPkg/Library/AuthVariableLib/AuthService.c b/SecurityPkg/Library/AuthVariableLib/AuthService.c
index 7188ff6..1e7872a 100644
--- a/SecurityPkg/Library/AuthVariableLib/AuthService.c
+++ b/SecurityPkg/Library/AuthVariableLib/AuthService.c
@@ -1564,7 +1564,7 @@ CalculatePrivAuthVarSignChainSHA256Digest(
   //
   // Get SignerCert CommonName
   //
-  Status = X509GetCommonName(SignerCert, SignerCertSize, CertCommonName, &CertCommonNameSize);
+  Status = X509GetCommonName(SignerCert, SignerCertSize, (CHAR8 *)CertCommonName, &CertCommonNameSize);
   if (EFI_ERROR(Status)) {
     DEBUG((DEBUG_INFO, "%a Get SignerCert CommonName failed with status %x\n", __FUNCTION__, Status));
     return EFI_ABORTED;
-- 
1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] SecurityPkg:AuthVariableLib:Fix GCC build error
Posted by Gary Lin 7 years, 2 months ago
On Mon, Oct 16, 2017 at 10:08:29PM +0800, Zhang, Chao B wrote:
> Fix GCC build error
> 
> Cc: Long Qin <qin.long@intel.com>
> Cc: Gary Lin <glin@suse.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
> ---
>  SecurityPkg/Library/AuthVariableLib/AuthService.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/SecurityPkg/Library/AuthVariableLib/AuthService.c b/SecurityPkg/Library/AuthVariableLib/AuthService.c
> index 7188ff6..1e7872a 100644
> --- a/SecurityPkg/Library/AuthVariableLib/AuthService.c
> +++ b/SecurityPkg/Library/AuthVariableLib/AuthService.c
> @@ -1564,7 +1564,7 @@ CalculatePrivAuthVarSignChainSHA256Digest(
>    //
>    // Get SignerCert CommonName
>    //
> -  Status = X509GetCommonName(SignerCert, SignerCertSize, CertCommonName, &CertCommonNameSize);
> +  Status = X509GetCommonName(SignerCert, SignerCertSize, (CHAR8 *)CertCommonName, &CertCommonNameSize);
Hi Chao Zhang,

Although casting also silences the warning, why not declare
CertCommonName as CHAR8 directly? The only signedness check happens
in X509GetCommonName(). Sha256Update() requests "VOID *" so the
signedness doesn't matter. Besides, AsciiStrLen() also requests
CHAR8, so declaring CertCommonName as CHAR8 can remove the casting
altogether. What do you think?

Gary Lin

>    if (EFI_ERROR(Status)) {
>      DEBUG((DEBUG_INFO, "%a Get SignerCert CommonName failed with status %x\n", __FUNCTION__, Status));
>      return EFI_ABORTED;
> -- 
> 1.9.5.msysgit.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
> 
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] SecurityPkg:AuthVariableLib:Fix GCC build error
Posted by Long, Qin 7 years, 2 months ago
Agree. It's better to use CHAR8 directly.


From: Gary Lin [mailto:glin@suse.com]
Sent: Tuesday, October 17, 2017 10:10 AM
To: Zhang, Chao B <chao.b.zhang@intel.com>
Cc: edk2-devel@lists.01.org; Long, Qin <qin.long@intel.com>
Subject: Re: [edk2] [PATCH] SecurityPkg:AuthVariableLib:Fix GCC build error

On Mon, Oct 16, 2017 at 10:08:29PM +0800, Zhang, Chao B wrote:
> Fix GCC build error
>
> Cc: Long Qin <qin.long@intel.com<mailto:qin.long@intel.com>>
> Cc: Gary Lin <glin@suse.com<mailto:glin@suse.com>>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Chao Zhang <chao.b.zhang@intel.com<mailto:chao.b.zhang@intel.com>>
> ---
>  SecurityPkg/Library/AuthVariableLib/AuthService.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/SecurityPkg/Library/AuthVariableLib/AuthService.c b/SecurityPkg/Library/AuthVariableLib/AuthService.c
> index 7188ff6..1e7872a 100644
> --- a/SecurityPkg/Library/AuthVariableLib/AuthService.c
> +++ b/SecurityPkg/Library/AuthVariableLib/AuthService.c
> @@ -1564,7 +1564,7 @@ CalculatePrivAuthVarSignChainSHA256Digest(
>    //
>    // Get SignerCert CommonName
>    //
> -  Status = X509GetCommonName(SignerCert, SignerCertSize, CertCommonName, &CertCommonNameSize);
> +  Status = X509GetCommonName(SignerCert, SignerCertSize, (CHAR8 *)CertCommonName, &CertCommonNameSize);
Hi Chao Zhang,

Although casting also silences the warning, why not declare
CertCommonName as CHAR8 directly? The only signedness check happens
in X509GetCommonName(). Sha256Update() requests "VOID *" so the
signedness doesn't matter. Besides, AsciiStrLen() also requests
CHAR8, so declaring CertCommonName as CHAR8 can remove the casting
altogether. What do you think?

Gary Lin

>    if (EFI_ERROR(Status)) {
>      DEBUG((DEBUG_INFO, "%a Get SignerCert CommonName failed with status %x\n", __FUNCTION__, Status));
>      return EFI_ABORTED;
> --
> 1.9.5.msysgit.1
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
> https://lists.01.org/mailman/listinfo/edk2-devel
>
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] SecurityPkg:AuthVariableLib:Fix GCC build error
Posted by Ard Biesheuvel 7 years, 2 months ago
On 17 October 2017 at 09:53, Long, Qin <qin.long@intel.com> wrote:
> Agree. It's better to use CHAR8 directly.
>

Could we get this fixed please? The GCC build has been broken for two days now.


>
> From: Gary Lin [mailto:glin@suse.com]
> Sent: Tuesday, October 17, 2017 10:10 AM
> To: Zhang, Chao B <chao.b.zhang@intel.com>
> Cc: edk2-devel@lists.01.org; Long, Qin <qin.long@intel.com>
> Subject: Re: [edk2] [PATCH] SecurityPkg:AuthVariableLib:Fix GCC build error
>
> On Mon, Oct 16, 2017 at 10:08:29PM +0800, Zhang, Chao B wrote:
>> Fix GCC build error
>>
>> Cc: Long Qin <qin.long@intel.com<mailto:qin.long@intel.com>>
>> Cc: Gary Lin <glin@suse.com<mailto:glin@suse.com>>
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Chao Zhang <chao.b.zhang@intel.com<mailto:chao.b.zhang@intel.com>>
>> ---
>>  SecurityPkg/Library/AuthVariableLib/AuthService.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/SecurityPkg/Library/AuthVariableLib/AuthService.c b/SecurityPkg/Library/AuthVariableLib/AuthService.c
>> index 7188ff6..1e7872a 100644
>> --- a/SecurityPkg/Library/AuthVariableLib/AuthService.c
>> +++ b/SecurityPkg/Library/AuthVariableLib/AuthService.c
>> @@ -1564,7 +1564,7 @@ CalculatePrivAuthVarSignChainSHA256Digest(
>>    //
>>    // Get SignerCert CommonName
>>    //
>> -  Status = X509GetCommonName(SignerCert, SignerCertSize, CertCommonName, &CertCommonNameSize);
>> +  Status = X509GetCommonName(SignerCert, SignerCertSize, (CHAR8 *)CertCommonName, &CertCommonNameSize);
> Hi Chao Zhang,
>
> Although casting also silences the warning, why not declare
> CertCommonName as CHAR8 directly? The only signedness check happens
> in X509GetCommonName(). Sha256Update() requests "VOID *" so the
> signedness doesn't matter. Besides, AsciiStrLen() also requests
> CHAR8, so declaring CertCommonName as CHAR8 can remove the casting
> altogether. What do you think?
>
> Gary Lin
>
>>    if (EFI_ERROR(Status)) {
>>      DEBUG((DEBUG_INFO, "%a Get SignerCert CommonName failed with status %x\n", __FUNCTION__, Status));
>>      return EFI_ABORTED;
>> --
>> 1.9.5.msysgit.1
>>
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
>> https://lists.01.org/mailman/listinfo/edk2-devel
>>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel