audk/SecurityPkg/Library
Laszlo Ersek 11b74aa472 SecurityPkg/AuthVariableLib: fix GCC build error
Commit 53c6ff1803 ("SecurityPkg:AuthVariableLib:Implement ECR1707 for
Private Auth Variable", 2017-09-12) introduced the following build
failure under several GCC toolchain versions:

> SecurityPkg/Library/AuthVariableLib/AuthService.c: In function
> 'CalculatePrivAuthVarSignChainSHA256Digest':
> SecurityPkg/Library/AuthVariableLib/AuthService.c:1567:58: error:
> pointer targets in passing argument 3 of 'X509GetCommonName' differ in
> signedness [-Werror=pointer-sign]
>    Status = X509GetCommonName(SignerCert, SignerCertSize, CertCommonName, &CertCommonNameSize);
>                                                           ^~~~~~~~~~~~~~
> In file included from
> SecurityPkg/Library/AuthVariableLib/AuthServiceInternal.h:34:0,
>                  from
>                  SecurityPkg/Library/AuthVariableLib/AuthService.c:32:
> CryptoPkg/Include/Library/BaseCryptLib.h:2202:1: note: expected 'CHAR8 *
> {aka char *}' but argument is of type 'UINT8 * {aka unsigned char *}'
>  X509GetCommonName (
>  ^~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors

Fix it by changing the type of "CertCommonName" to array-of-CHAR8.

Locations where "CertCommonName" is used in the
CalculatePrivAuthVarSignChainSHA256Digest() function:

- it is taken the size of -- not impacted by this patch;

- passed to X509GetCommonName() as an argument -- the patch fixes the
  build error;

- passed to Sha256Update() as argument for "IN CONST VOID  *Data" -- not
  impacted by the patch;

- passed to AsciiStrLen() as argument -- drop the now-superfluous explicit
  cast.

Since we are touching the Sha256Update() function call, fix the coding
style too:

- the line is overlong, so break each argument to its own line;

- insert a space between "AsciiStrLen" and the opening paren "(".

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Gary Lin <glin@suse.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Long Qin <qin.long@intel.com>
Reported-by: Gary Lin <glin@suse.com>
Suggested-by: Gary Lin <glin@suse.com>
Suggested-by: Long Qin <qin.long@intel.com>
Fixes: 53c6ff1803
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2017-10-17 21:46:21 +02:00
..
AuthVariableLib SecurityPkg/AuthVariableLib: fix GCC build error 2017-10-17 21:46:21 +02:00
DxeDeferImageLoadLib SecurityPkg: Fix typos in comments 2016-11-15 15:45:31 +08:00
DxeImageAuthenticationStatusLib SecurityPkg: Convert all .uni files to utf-8 2015-12-15 04:58:32 +00:00
DxeImageVerificationLib SecurityPkg: Refine type cast for pointer subtraction 2017-03-06 14:15:36 +08:00
DxeRsa2048Sha256GuidedSectionExtractLib SecurityPkg: Fix typos in comments 2016-11-15 15:45:31 +08:00
DxeTcg2PhysicalPresenceLib SecurityPkg: Tcg2PhysicalPresence: Define TCG2 PP Flags Initial Pcd 2016-12-29 09:45:15 +08:00
DxeTcgPhysicalPresenceLib Revert old "Enable BlockSid related PP actions" patch series. 2016-11-23 16:30:03 +08:00
DxeTpm2MeasureBootLib SecurityPkg: Add TCG Spec info to TCG related modules 2017-05-11 16:20:05 +08:00
DxeTpmMeasureBootLib SecurityPkg: Refine type cast for pointer subtraction 2017-03-06 14:15:36 +08:00
DxeTpmMeasurementLib SecurityPkg: Convert all .uni files to utf-8 2015-12-15 04:58:32 +00:00
DxeTrEEPhysicalPresenceLib SecurityPkg: Update protocol usage in module INF files. 2016-04-13 14:52:58 +08:00
FmpAuthenticationLibPkcs7 SecurityPkg/FmpAuthenticationLib: Refine to compare with same type 2017-01-12 21:26:29 +08:00
FmpAuthenticationLibRsa2048Sha256 SecurityPkg: Update Guid usage in INF file to match source code logic 2017-10-10 18:10:22 +08:00
HashInstanceLibSha1 SecurityPkg: Fix typo 'Ihis' with 'This' in codes 2016-10-18 09:41:56 +08:00
HashInstanceLibSha256 SecurityPkg: Fix typo 'Ihis' with 'This' in codes 2016-10-18 09:41:56 +08:00
HashLibBaseCryptoRouter SecurityPkg: Update Guid usage in INF file to match source code logic 2017-10-10 18:10:22 +08:00
HashLibTpm2 SecurityPkg: Fix typo 'Ihis' with 'This' in codes 2016-10-18 09:41:56 +08:00
OpalPasswordSupportLib SecurityPkg OpalPasswordSupportLib: Remove include to UefiAcpiDataTable.h 2017-07-27 14:08:08 +08:00
PeiRsa2048Sha256GuidedSectionExtractLib SecurityPkg: Fix typos in comments 2016-11-15 15:45:31 +08:00
PeiTcg2PhysicalPresenceLib SecurityPkg Tcg2PPLib: Support BlockSID related actions 2016-11-28 14:50:42 +08:00
PlatformSecureLibNull SecurityPkg: Update PlatformSecureLibNull with PCD to get physical presence. 2016-06-29 09:43:00 +08:00
SmmTcg2PhysicalPresenceLib SecurityPkg\SmmTcg2PhysicalPresenceLib.c Handle reserved or unimplemented PP Operation 2017-09-28 11:29:42 +08:00
Tcg2PpVendorLibNull SecurityPkg: Convert all .uni files to utf-8 2015-12-15 04:58:32 +00:00
TcgPpVendorLibNull SecurityPkg: Convert all .uni files to utf-8 2015-12-15 04:58:32 +00:00
TcgStorageCoreLib SecurityPkg TcgStorageCoreLib: ASSERT to ensure 'ByteSeq' is not NULL 2016-11-22 16:31:44 +08:00
TcgStorageOpalLib SecurityPkg: Fix typos in comments 2016-11-15 15:45:31 +08:00
Tpm2CommandLib SecurityPkg: Refine type cast for pointer subtraction 2017-03-06 14:15:36 +08:00
Tpm2DeviceLibDTpm SecurityPkg: Add TCG Spec info to TCG related modules 2017-05-11 16:20:05 +08:00
Tpm2DeviceLibRouter SecurityPkg: Error Level is not used correctly 2017-04-12 08:56:33 +08:00
Tpm2DeviceLibTcg2 SecurityPkg: Fix typo 'Ihis' with 'This' in codes 2016-10-18 09:41:56 +08:00
Tpm2DeviceLibTrEE SecurityPkg: Fix typo 'Ihis' with 'This' in codes 2016-10-18 09:41:56 +08:00
Tpm12CommandLib SecurityPkg/Tpm12CommandLib: Always check response returnCode 2017-01-25 14:18:30 -08:00
Tpm12DeviceLibDTpm SecurityPkg : Tpm12DeviceLibDTpm: Fix TPM12 wrong Response Tag check 2016-06-08 15:14:56 +08:00
Tpm12DeviceLibTcg SecurityPkg: Fix typo 'Ihis' with 'This' in codes 2016-10-18 09:41:56 +08:00
TpmCommLib SecurityPkg: Convert all .uni files to utf-8 2015-12-15 04:58:32 +00:00
TrEEPpVendorLibNull SecurityPkg: Convert all .uni files to utf-8 2015-12-15 04:58:32 +00:00