SecurityPkg: Update code to be more C11 compliant by using __func__
__FUNCTION__ is a pre-standard extension that gcc and Visual C++ among others support, while __func__ was standardized in C99. Since it's more standard, replace __FUNCTION__ with __func__ throughout SecurityPkg. Signed-off-by: Rebecca Cran <rebecca@bsdio.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
This commit is contained in:
committed by
mergify[bot]
parent
7b82da70ed
commit
dd0b33e3e5
@@ -491,7 +491,7 @@ OpalEndOfDxeEventNotify (
|
||||
{
|
||||
OPAL_DRIVER_DEVICE *TmpDev;
|
||||
|
||||
DEBUG ((DEBUG_INFO, "%a() - enter\n", __FUNCTION__));
|
||||
DEBUG ((DEBUG_INFO, "%a() - enter\n", __func__));
|
||||
|
||||
mOpalEndOfDxe = TRUE;
|
||||
|
||||
@@ -529,7 +529,7 @@ OpalEndOfDxeEventNotify (
|
||||
//
|
||||
SendBlockSidCommand ();
|
||||
|
||||
DEBUG ((DEBUG_INFO, "%a() - exit\n", __FUNCTION__));
|
||||
DEBUG ((DEBUG_INFO, "%a() - exit\n", __func__));
|
||||
|
||||
gBS->CloseEvent (Event);
|
||||
}
|
||||
@@ -888,7 +888,7 @@ OpalDriverRequestPassword (
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_INFO, "%a()\n", __FUNCTION__));
|
||||
DEBUG ((DEBUG_INFO, "%a()\n", __func__));
|
||||
|
||||
PopUpString = OpalGetPopUpString (Dev, RequestString);
|
||||
|
||||
@@ -1074,7 +1074,7 @@ ProcessOpalRequestEnableFeature (
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_INFO, "%a()\n", __FUNCTION__));
|
||||
DEBUG ((DEBUG_INFO, "%a()\n", __func__));
|
||||
|
||||
PopUpString = OpalGetPopUpString (Dev, RequestString);
|
||||
|
||||
@@ -1223,7 +1223,7 @@ ProcessOpalRequestDisableUser (
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_INFO, "%a()\n", __FUNCTION__));
|
||||
DEBUG ((DEBUG_INFO, "%a()\n", __func__));
|
||||
|
||||
PopUpString = OpalGetPopUpString (Dev, RequestString);
|
||||
|
||||
@@ -1339,7 +1339,7 @@ ProcessOpalRequestPsidRevert (
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_INFO, "%a()\n", __FUNCTION__));
|
||||
DEBUG ((DEBUG_INFO, "%a()\n", __func__));
|
||||
|
||||
PopUpString = OpalGetPopUpString (Dev, RequestString);
|
||||
|
||||
@@ -1478,7 +1478,7 @@ ProcessOpalRequestRevert (
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_INFO, "%a()\n", __FUNCTION__));
|
||||
DEBUG ((DEBUG_INFO, "%a()\n", __func__));
|
||||
|
||||
PopUpString = OpalGetPopUpString (Dev, RequestString);
|
||||
|
||||
@@ -1646,7 +1646,7 @@ ProcessOpalRequestSecureErase (
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_INFO, "%a()\n", __FUNCTION__));
|
||||
DEBUG ((DEBUG_INFO, "%a()\n", __func__));
|
||||
|
||||
PopUpString = OpalGetPopUpString (Dev, RequestString);
|
||||
|
||||
@@ -1784,7 +1784,7 @@ ProcessOpalRequestSetUserPwd (
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_INFO, "%a()\n", __FUNCTION__));
|
||||
DEBUG ((DEBUG_INFO, "%a()\n", __func__));
|
||||
|
||||
PopUpString = OpalGetPopUpString (Dev, RequestString);
|
||||
|
||||
@@ -1990,7 +1990,7 @@ ProcessOpalRequestSetAdminPwd (
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_INFO, "%a()\n", __FUNCTION__));
|
||||
DEBUG ((DEBUG_INFO, "%a()\n", __func__));
|
||||
|
||||
PopUpString = OpalGetPopUpString (Dev, RequestString);
|
||||
|
||||
@@ -2182,7 +2182,7 @@ ProcessOpalRequest (
|
||||
UINTN DevicePathSize;
|
||||
BOOLEAN KeepUserData;
|
||||
|
||||
DEBUG ((DEBUG_INFO, "%a() - enter\n", __FUNCTION__));
|
||||
DEBUG ((DEBUG_INFO, "%a() - enter\n", __func__));
|
||||
|
||||
if (mOpalRequestVariable == NULL) {
|
||||
Status = GetVariable2 (
|
||||
@@ -2278,7 +2278,7 @@ ProcessOpalRequest (
|
||||
TempVariable = (OPAL_REQUEST_VARIABLE *)((UINTN)TempVariable + TempVariable->Length);
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_INFO, "%a() - exit\n", __FUNCTION__));
|
||||
DEBUG ((DEBUG_INFO, "%a() - exit\n", __func__));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -95,7 +95,7 @@ GetSavedOpalRequest (
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
UINTN DevicePathSize;
|
||||
|
||||
DEBUG ((DEBUG_INFO, "%a() - enter\n", __FUNCTION__));
|
||||
DEBUG ((DEBUG_INFO, "%a() - enter\n", __func__));
|
||||
|
||||
Variable = NULL;
|
||||
VariableSize = 0;
|
||||
@@ -141,7 +141,7 @@ GetSavedOpalRequest (
|
||||
|
||||
FreePool (Variable);
|
||||
|
||||
DEBUG ((DEBUG_INFO, "%a() - exit\n", __FUNCTION__));
|
||||
DEBUG ((DEBUG_INFO, "%a() - exit\n", __func__));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -169,7 +169,7 @@ SaveOpalRequest (
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
UINTN DevicePathSize;
|
||||
|
||||
DEBUG ((DEBUG_INFO, "%a() - enter\n", __FUNCTION__));
|
||||
DEBUG ((DEBUG_INFO, "%a() - enter\n", __func__));
|
||||
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
@@ -264,7 +264,7 @@ SaveOpalRequest (
|
||||
FreePool (Variable);
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_INFO, "%a() - exit\n", __FUNCTION__));
|
||||
DEBUG ((DEBUG_INFO, "%a() - exit\n", __func__));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -280,7 +280,7 @@ UnlockOpalPassword (
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"%a() OpalUtilUpdateGlobalLockingRange() Result = 0x%x\n",
|
||||
__FUNCTION__,
|
||||
__func__,
|
||||
Result
|
||||
));
|
||||
}
|
||||
@@ -302,7 +302,7 @@ UnlockOpalPassword (
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"%a() OpalBlockSid() Result = 0x%x\n",
|
||||
__FUNCTION__,
|
||||
__func__,
|
||||
Result
|
||||
));
|
||||
}
|
||||
@@ -427,11 +427,11 @@ OpalPasswordStorageSecurityPpiNotify (
|
||||
IN VOID *Ppi
|
||||
)
|
||||
{
|
||||
DEBUG ((DEBUG_INFO, "%a entered at S3 resume!\n", __FUNCTION__));
|
||||
DEBUG ((DEBUG_INFO, "%a entered at S3 resume!\n", __func__));
|
||||
|
||||
UnlockOpalPasswordDevices ((EDKII_PEI_STORAGE_SECURITY_CMD_PPI *)Ppi);
|
||||
|
||||
DEBUG ((DEBUG_INFO, "%a exit at S3 resume!\n", __FUNCTION__));
|
||||
DEBUG ((DEBUG_INFO, "%a exit at S3 resume!\n", __func__));
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
@@ -466,7 +466,7 @@ OpalPasswordPeiInit (
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_INFO, "%a: Enters in S3 path.\n", __FUNCTION__));
|
||||
DEBUG ((DEBUG_INFO, "%a: Enters in S3 path.\n", __func__));
|
||||
|
||||
Status = PeiServicesNotifyPpi (&mOpalPasswordStorageSecurityPpiNotifyDesc);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
@@ -188,14 +188,14 @@ ExchangeCommonBuffer (
|
||||
|
||||
// Step 0: Sanity check for input argument
|
||||
if (TcgNvs == NULL) {
|
||||
DEBUG ((DEBUG_ERROR, "%a - Input argument is NULL!\n", __FUNCTION__));
|
||||
DEBUG ((DEBUG_ERROR, "%a - Input argument is NULL!\n", __func__));
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
// Step 1: Grab the common buffer header
|
||||
Status = EfiGetSystemConfigurationTable (&gEdkiiPiSmmCommunicationRegionTableGuid, (VOID **)&PiSmmCommunicationRegionTable);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a - Failed to locate SMM communciation common buffer - %r!\n", __FUNCTION__, Status));
|
||||
DEBUG ((DEBUG_ERROR, "%a - Failed to locate SMM communciation common buffer - %r!\n", __func__, Status));
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ ExchangeCommonBuffer (
|
||||
|
||||
if (Index >= PiSmmCommunicationRegionTable->NumberOfEntries) {
|
||||
// Could not find one that meets our goal...
|
||||
DEBUG ((DEBUG_ERROR, "%a - Could not find a common buffer that is big enough for NVS!\n", __FUNCTION__));
|
||||
DEBUG ((DEBUG_ERROR, "%a - Could not find a common buffer that is big enough for NVS!\n", __func__));
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
@@ -236,9 +236,9 @@ ExchangeCommonBuffer (
|
||||
Status = gBS->LocateProtocol (&gEfiMmCommunicationProtocolGuid, NULL, (VOID **)&MmCommunication);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = MmCommunication->Communicate (MmCommunication, CommHeader, &CommBufferSize);
|
||||
DEBUG ((DEBUG_INFO, "%a - Communicate() = %r\n", __FUNCTION__, Status));
|
||||
DEBUG ((DEBUG_INFO, "%a - Communicate() = %r\n", __func__, Status));
|
||||
} else {
|
||||
DEBUG ((DEBUG_ERROR, "%a - Failed to locate MmCommunication protocol - %r\n", __FUNCTION__, Status));
|
||||
DEBUG ((DEBUG_ERROR, "%a - Failed to locate MmCommunication protocol - %r\n", __func__, Status));
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ ExchangeCommonBuffer (
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"%a Communication returned software SMI value. PP: 0x%x; MC: 0x%x.\n",
|
||||
__FUNCTION__,
|
||||
__func__,
|
||||
TcgNvs->PhysicalPresence.SoftwareSmi,
|
||||
TcgNvs->MemoryClear.SoftwareSmi
|
||||
));
|
||||
|
@@ -312,10 +312,10 @@ SyncPcrAllocationsAndPcrMask (
|
||||
NewTpmActivePcrBanks &= BiosHashAlgorithmBitmap;
|
||||
DEBUG ((DEBUG_INFO, "NewTpmActivePcrBanks 0x%08x\n", NewTpmActivePcrBanks));
|
||||
|
||||
DEBUG ((DEBUG_INFO, "%a - Reallocating PCR banks from 0x%X to 0x%X.\n", __FUNCTION__, TpmActivePcrBanks, NewTpmActivePcrBanks));
|
||||
DEBUG ((DEBUG_INFO, "%a - Reallocating PCR banks from 0x%X to 0x%X.\n", __func__, TpmActivePcrBanks, NewTpmActivePcrBanks));
|
||||
|
||||
if (NewTpmActivePcrBanks == 0) {
|
||||
DEBUG ((DEBUG_ERROR, "%a - No viable PCRs active! Please set a less restrictive value for PcdTpm2HashMask!\n", __FUNCTION__));
|
||||
DEBUG ((DEBUG_ERROR, "%a - No viable PCRs active! Please set a less restrictive value for PcdTpm2HashMask!\n", __func__));
|
||||
ASSERT (FALSE);
|
||||
} else {
|
||||
DEBUG ((DEBUG_ERROR, "Tpm2PcrAllocateBanks (TpmHashAlgorithmBitmap: 0x%08x, NewTpmActivePcrBanks: 0x%08x)\n", TpmHashAlgorithmBitmap, NewTpmActivePcrBanks));
|
||||
@@ -324,7 +324,7 @@ SyncPcrAllocationsAndPcrMask (
|
||||
//
|
||||
// We can't do much here, but we hope that this doesn't happen.
|
||||
//
|
||||
DEBUG ((DEBUG_ERROR, "%a - Failed to reallocate PCRs!\n", __FUNCTION__));
|
||||
DEBUG ((DEBUG_ERROR, "%a - Failed to reallocate PCRs!\n", __func__));
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
|
||||
@@ -342,9 +342,9 @@ SyncPcrAllocationsAndPcrMask (
|
||||
if ((Tpm2PcrMask & TpmHashAlgorithmBitmap) != Tpm2PcrMask) {
|
||||
NewTpm2PcrMask = Tpm2PcrMask & TpmHashAlgorithmBitmap;
|
||||
|
||||
DEBUG ((DEBUG_INFO, "%a - Updating PcdTpm2HashMask from 0x%X to 0x%X.\n", __FUNCTION__, Tpm2PcrMask, NewTpm2PcrMask));
|
||||
DEBUG ((DEBUG_INFO, "%a - Updating PcdTpm2HashMask from 0x%X to 0x%X.\n", __func__, Tpm2PcrMask, NewTpm2PcrMask));
|
||||
if (NewTpm2PcrMask == 0) {
|
||||
DEBUG ((DEBUG_ERROR, "%a - No viable PCRs supported! Please set a less restrictive value for PcdTpm2HashMask!\n", __FUNCTION__));
|
||||
DEBUG ((DEBUG_ERROR, "%a - No viable PCRs supported! Please set a less restrictive value for PcdTpm2HashMask!\n", __func__));
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
|
@@ -57,7 +57,7 @@ TpmNvsCommunciate (
|
||||
UINTN TempCommBufferSize;
|
||||
TPM_NVS_MM_COMM_BUFFER *CommParams;
|
||||
|
||||
DEBUG ((DEBUG_VERBOSE, "%a()\n", __FUNCTION__));
|
||||
DEBUG ((DEBUG_VERBOSE, "%a()\n", __func__));
|
||||
|
||||
//
|
||||
// If input is invalid, stop processing this SMI
|
||||
@@ -69,12 +69,12 @@ TpmNvsCommunciate (
|
||||
TempCommBufferSize = *CommBufferSize;
|
||||
|
||||
if (TempCommBufferSize != sizeof (TPM_NVS_MM_COMM_BUFFER)) {
|
||||
DEBUG ((DEBUG_ERROR, "[%a] MM Communication buffer size is invalid for this handler!\n", __FUNCTION__));
|
||||
DEBUG ((DEBUG_ERROR, "[%a] MM Communication buffer size is invalid for this handler!\n", __func__));
|
||||
return EFI_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
if (!IsBufferOutsideMmValid ((UINTN)CommBuffer, TempCommBufferSize)) {
|
||||
DEBUG ((DEBUG_ERROR, "[%a] - MM Communication buffer in invalid location!\n", __FUNCTION__));
|
||||
DEBUG ((DEBUG_ERROR, "[%a] - MM Communication buffer in invalid location!\n", __func__));
|
||||
return EFI_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
@@ -85,14 +85,14 @@ TpmNvsCommunciate (
|
||||
Status = EFI_SUCCESS;
|
||||
switch (CommParams->Function) {
|
||||
case TpmNvsMmExchangeInfo:
|
||||
DEBUG ((DEBUG_VERBOSE, "[%a] - Function requested: MM_EXCHANGE_NVS_INFO\n", __FUNCTION__));
|
||||
DEBUG ((DEBUG_VERBOSE, "[%a] - Function requested: MM_EXCHANGE_NVS_INFO\n", __func__));
|
||||
CommParams->RegisteredPpSwiValue = mPpSoftwareSmi;
|
||||
CommParams->RegisteredMcSwiValue = mMcSoftwareSmi;
|
||||
mTcgNvs = (TCG_NVS *)(UINTN)CommParams->TargetAddress;
|
||||
break;
|
||||
|
||||
default:
|
||||
DEBUG ((DEBUG_INFO, "[%a] - Unknown function %d!\n", __FUNCTION__, CommParams->Function));
|
||||
DEBUG ((DEBUG_INFO, "[%a] - Unknown function %d!\n", __func__, CommParams->Function));
|
||||
Status = EFI_UNSUPPORTED;
|
||||
break;
|
||||
}
|
||||
@@ -301,7 +301,7 @@ InitializeTcgCommon (
|
||||
Status = gMmst->MmiHandlerRegister (TpmNvsCommunciate, &gTpmNvsMmGuid, &mReadyToLockHandle);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "[%a] Failed to register NVS communicate as root MM handler - %r!\n", __FUNCTION__, Status));
|
||||
DEBUG ((DEBUG_ERROR, "[%a] Failed to register NVS communicate as root MM handler - %r!\n", __func__, Status));
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
@@ -311,7 +311,7 @@ InitializeTcgCommon (
|
||||
Status = gMmst->MmLocateProtocol (&gEfiSmmSwDispatch2ProtocolGuid, NULL, (VOID **)&SwDispatch);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "[%a] Failed to locate Sw dispatch protocol - %r!\n", __FUNCTION__, Status));
|
||||
DEBUG ((DEBUG_ERROR, "[%a] Failed to locate Sw dispatch protocol - %r!\n", __func__, Status));
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ InitializeTcgCommon (
|
||||
Status = SwDispatch->Register (SwDispatch, PhysicalPresenceCallback, &SwContext, &PpSwHandle);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "[%a] Failed to register PP callback as SW MM handler - %r!\n", __FUNCTION__, Status));
|
||||
DEBUG ((DEBUG_ERROR, "[%a] Failed to register PP callback as SW MM handler - %r!\n", __func__, Status));
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
@@ -329,7 +329,7 @@ InitializeTcgCommon (
|
||||
Status = SwDispatch->Register (SwDispatch, MemoryClearCallback, &SwContext, &McSwHandle);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "[%a] Failed to register MC callback as SW MM handler - %r!\n", __FUNCTION__, Status));
|
||||
DEBUG ((DEBUG_ERROR, "[%a] Failed to register MC callback as SW MM handler - %r!\n", __func__, Status));
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
@@ -342,7 +342,7 @@ InitializeTcgCommon (
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
if (EFI_ERROR (Status)) {
|
||||
// Should not happen
|
||||
DEBUG ((DEBUG_ERROR, "[%a] Failed to locate SMM variable protocol - %r!\n", __FUNCTION__, Status));
|
||||
DEBUG ((DEBUG_ERROR, "[%a] Failed to locate SMM variable protocol - %r!\n", __func__, Status));
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
@@ -350,7 +350,7 @@ InitializeTcgCommon (
|
||||
Status = gMmst->MmRegisterProtocolNotify (&gEfiMmReadyToLockProtocolGuid, TcgMmReadyToLock, &NotifyHandle);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "[%a] Failed to register ready to lock notification - %r!\n", __FUNCTION__, Status));
|
||||
DEBUG ((DEBUG_ERROR, "[%a] Failed to register ready to lock notification - %r!\n", __func__, Status));
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
|
@@ -1353,12 +1353,12 @@ TdHashLogExtendEvent (
|
||||
}
|
||||
|
||||
if (CcEvent->Header.MrIndex == CC_MR_INDEX_0_MRTD) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: MRTD cannot be extended in TDVF.\n", __FUNCTION__));
|
||||
DEBUG ((DEBUG_ERROR, "%a: MRTD cannot be extended in TDVF.\n", __func__));
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (CcEvent->Header.MrIndex >= CC_MR_INDEX_INVALID) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: MrIndex is invalid. (%d)\n", __FUNCTION__, CcEvent->Header.MrIndex));
|
||||
DEBUG ((DEBUG_ERROR, "%a: MrIndex is invalid. (%d)\n", __func__, CcEvent->Header.MrIndex));
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -2514,7 +2514,7 @@ DriverEntry (
|
||||
//
|
||||
// Cc measurement feature is crucial to a td-guest and it shall stop running immediately
|
||||
// when it is failed to be installed.
|
||||
DEBUG ((DEBUG_ERROR, "%a: CcMeasurement protocol failed to be installed - %r\n", __FUNCTION__, Status));
|
||||
DEBUG ((DEBUG_ERROR, "%a: CcMeasurement protocol failed to be installed - %r\n", __func__, Status));
|
||||
CpuDeadLoop ();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user