summaryrefslogtreecommitdiffstats
path: root/SecurityPkg/Library
diff options
context:
space:
mode:
authorRebecca Cran <rebecca@bsdio.com>2023-04-06 13:50:26 -0600
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-04-10 14:19:57 +0000
commitdd0b33e3e55957aecbae6aa5cebdc6c14e6e8932 (patch)
treeadcf42806767e4448a954218cccd9cade86dcacd /SecurityPkg/Library
parent7b82da70edf7dda2c6f4e853f100df620bd5c0f3 (diff)
downloadedk2-dd0b33e3e55957aecbae6aa5cebdc6c14e6e8932.tar.gz
edk2-dd0b33e3e55957aecbae6aa5cebdc6c14e6e8932.tar.bz2
edk2-dd0b33e3e55957aecbae6aa5cebdc6c14e6e8932.zip
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>
Diffstat (limited to 'SecurityPkg/Library')
-rw-r--r--SecurityPkg/Library/AuthVariableLib/AuthService.c4
-rw-r--r--SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.c6
-rw-r--r--SecurityPkg/Library/PlatformPKProtectionLibVarPolicy/PlatformPKProtectionLibVarPolicy.c2
-rw-r--r--SecurityPkg/Library/SecureBootVariableLib/SecureBootVariableLib.c38
-rw-r--r--SecurityPkg/Library/SecureBootVariableLib/UnitTest/SecureBootVariableLibUnitTest.c4
-rw-r--r--SecurityPkg/Library/SecureBootVariableProvisionLib/SecureBootVariableProvisionLib.c2
6 files changed, 28 insertions, 28 deletions
diff --git a/SecurityPkg/Library/AuthVariableLib/AuthService.c b/SecurityPkg/Library/AuthVariableLib/AuthService.c
index 452ed491ea..d81c581d78 100644
--- a/SecurityPkg/Library/AuthVariableLib/AuthService.c
+++ b/SecurityPkg/Library/AuthVariableLib/AuthService.c
@@ -1126,7 +1126,7 @@ CalculatePrivAuthVarSignChainSHA256Digest (
//
Status = X509GetCommonName (SignerCert, SignerCertSize, CertCommonName, &CertCommonNameSize);
if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_INFO, "%a Get SignerCert CommonName failed with status %x\n", __FUNCTION__, Status));
+ DEBUG ((DEBUG_INFO, "%a Get SignerCert CommonName failed with status %x\n", __func__, Status));
return EFI_ABORTED;
}
@@ -1134,7 +1134,7 @@ CalculatePrivAuthVarSignChainSHA256Digest (
// Get TopLevelCert tbsCertificate
//
if (!X509GetTBSCert (TopLevelCert, TopLevelCertSize, &TbsCert, &TbsCertSize)) {
- DEBUG ((DEBUG_INFO, "%a Get Top-level Cert tbsCertificate failed!\n", __FUNCTION__));
+ DEBUG ((DEBUG_INFO, "%a Get Top-level Cert tbsCertificate failed!\n", __func__));
return EFI_ABORTED;
}
diff --git a/SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.c b/SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.c
index b8838766bc..cdb5248aff 100644
--- a/SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.c
+++ b/SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.c
@@ -205,7 +205,7 @@ DisableTpmPlatformHierarchy (
// Make sure that we have use of the TPM.
Status = Tpm2RequestUseTpm ();
if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "%a:%a() - Tpm2RequestUseTpm Failed! %r\n", gEfiCallerBaseName, __FUNCTION__, Status));
+ DEBUG ((DEBUG_ERROR, "%a:%a() - Tpm2RequestUseTpm Failed! %r\n", gEfiCallerBaseName, __func__, Status));
ASSERT_EFI_ERROR (Status);
return Status;
}
@@ -224,9 +224,9 @@ DisableTpmPlatformHierarchy (
TPM_RH_PLATFORM, // Hierarchy
NO // State
);
- DEBUG ((DEBUG_VERBOSE, "%a:%a() - Disable PH = %r\n", gEfiCallerBaseName, __FUNCTION__, Status));
+ DEBUG ((DEBUG_VERBOSE, "%a:%a() - Disable PH = %r\n", gEfiCallerBaseName, __func__, Status));
if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "%a:%a() - Disable PH Failed! %r\n", gEfiCallerBaseName, __FUNCTION__, Status));
+ DEBUG ((DEBUG_ERROR, "%a:%a() - Disable PH Failed! %r\n", gEfiCallerBaseName, __func__, Status));
ASSERT_EFI_ERROR (Status);
}
diff --git a/SecurityPkg/Library/PlatformPKProtectionLibVarPolicy/PlatformPKProtectionLibVarPolicy.c b/SecurityPkg/Library/PlatformPKProtectionLibVarPolicy/PlatformPKProtectionLibVarPolicy.c
index a264924224..ac18fcd702 100644
--- a/SecurityPkg/Library/PlatformPKProtectionLibVarPolicy/PlatformPKProtectionLibVarPolicy.c
+++ b/SecurityPkg/Library/PlatformPKProtectionLibVarPolicy/PlatformPKProtectionLibVarPolicy.c
@@ -33,7 +33,7 @@ DisablePKProtection (
EFI_STATUS Status;
EDKII_VARIABLE_POLICY_PROTOCOL *VariablePolicy;
- DEBUG ((DEBUG_INFO, "%a() Entry...\n", __FUNCTION__));
+ DEBUG ((DEBUG_INFO, "%a() Entry...\n", __func__));
// IMPORTANT NOTE: This operation is sticky and leaves variable protections disabled.
// The system *MUST* be reset after performing this operation.
diff --git a/SecurityPkg/Library/SecureBootVariableLib/SecureBootVariableLib.c b/SecurityPkg/Library/SecureBootVariableLib/SecureBootVariableLib.c
index abca249c65..24599c7a0b 100644
--- a/SecurityPkg/Library/SecureBootVariableLib/SecureBootVariableLib.c
+++ b/SecurityPkg/Library/SecureBootVariableLib/SecureBootVariableLib.c
@@ -276,7 +276,7 @@ CreateTimeBasedPayload (
UINTN DescriptorSize;
if ((Data == NULL) || (DataSize == NULL) || (Time == NULL)) {
- DEBUG ((DEBUG_ERROR, "%a(), invalid arg\n", __FUNCTION__));
+ DEBUG ((DEBUG_ERROR, "%a(), invalid arg\n", __func__));
return EFI_INVALID_PARAMETER;
}
@@ -292,7 +292,7 @@ CreateTimeBasedPayload (
DescriptorSize = OFFSET_OF (EFI_VARIABLE_AUTHENTICATION_2, AuthInfo) + OFFSET_OF (WIN_CERTIFICATE_UEFI_GUID, CertData);
NewData = (UINT8 *)AllocateZeroPool (DescriptorSize + PayloadSize);
if (NewData == NULL) {
- DEBUG ((DEBUG_ERROR, "%a() Out of resources.\n", __FUNCTION__));
+ DEBUG ((DEBUG_ERROR, "%a() Out of resources.\n", __func__));
return EFI_OUT_OF_RESOURCES;
}
@@ -603,13 +603,13 @@ DeleteSecureBootVariables (
{
EFI_STATUS Status, TempStatus;
- DEBUG ((DEBUG_INFO, "%a - Attempting to delete the Secure Boot variables.\n", __FUNCTION__));
+ DEBUG ((DEBUG_INFO, "%a - Attempting to delete the Secure Boot variables.\n", __func__));
//
// Step 1: Notify that a PK update is coming shortly...
Status = DisablePKProtection ();
if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "%a - Failed to signal PK update start! %r\n", __FUNCTION__, Status));
+ DEBUG ((DEBUG_ERROR, "%a - Failed to signal PK update start! %r\n", __func__, Status));
// Classify this as a PK deletion error.
Status = EFI_ABORTED;
}
@@ -619,7 +619,7 @@ DeleteSecureBootVariables (
// Let's try to nuke the PK, why not...
if (!EFI_ERROR (Status)) {
Status = DeletePlatformKey ();
- DEBUG ((DEBUG_INFO, "%a - PK Delete = %r\n", __FUNCTION__, Status));
+ DEBUG ((DEBUG_INFO, "%a - PK Delete = %r\n", __func__, Status));
// If the PK is not found, then our work here is done.
if (Status == EFI_NOT_FOUND) {
Status = EFI_SUCCESS;
@@ -646,25 +646,25 @@ DeleteSecureBootVariables (
// the variables anyway.
//
TempStatus = DeleteKEK ();
- DEBUG ((DEBUG_INFO, "%a - KEK Delete = %r\n", __FUNCTION__, TempStatus));
+ DEBUG ((DEBUG_INFO, "%a - KEK Delete = %r\n", __func__, TempStatus));
if (EFI_ERROR (TempStatus) && (TempStatus != EFI_NOT_FOUND)) {
Status = EFI_ACCESS_DENIED;
}
TempStatus = DeleteDb ();
- DEBUG ((DEBUG_INFO, "%a - db Delete = %r\n", __FUNCTION__, TempStatus));
+ DEBUG ((DEBUG_INFO, "%a - db Delete = %r\n", __func__, TempStatus));
if (EFI_ERROR (TempStatus) && (TempStatus != EFI_NOT_FOUND)) {
Status = EFI_ACCESS_DENIED;
}
TempStatus = DeleteDbx ();
- DEBUG ((DEBUG_INFO, "%a - dbx Delete = %r\n", __FUNCTION__, TempStatus));
+ DEBUG ((DEBUG_INFO, "%a - dbx Delete = %r\n", __func__, TempStatus));
if (EFI_ERROR (TempStatus) && (TempStatus != EFI_NOT_FOUND)) {
Status = EFI_ACCESS_DENIED;
}
TempStatus = DeleteDbt ();
- DEBUG ((DEBUG_INFO, "%a - dbt Delete = %r\n", __FUNCTION__, TempStatus));
+ DEBUG ((DEBUG_INFO, "%a - dbt Delete = %r\n", __func__, TempStatus));
if (EFI_ERROR (TempStatus) && (TempStatus != EFI_NOT_FOUND)) {
Status = EFI_ACCESS_DENIED;
}
@@ -752,7 +752,7 @@ EnrollFromInput (
DEBUG ((
DEBUG_ERROR,
"error: %a (\"%s\", %g): %r\n",
- __FUNCTION__,
+ __func__,
VariableName,
VendorGuid,
Status
@@ -795,21 +795,21 @@ SetSecureBootVariablesToDefault (
UINT8 *Data;
UINTN DataSize;
- DEBUG ((DEBUG_INFO, "%a() Entry\n", __FUNCTION__));
+ DEBUG ((DEBUG_INFO, "%a() Entry\n", __func__));
if (SecureBootPayload == NULL) {
- DEBUG ((DEBUG_ERROR, "%a - Invalid SecureBoot payload is supplied!\n", __FUNCTION__));
+ DEBUG ((DEBUG_ERROR, "%a - Invalid SecureBoot payload is supplied!\n", __func__));
return EFI_INVALID_PARAMETER;
}
//
// Right off the bat, if SecureBoot is currently enabled, bail.
if (IsSecureBootEnabled ()) {
- DEBUG ((DEBUG_ERROR, "%a - Cannot set default keys while SecureBoot is enabled!\n", __FUNCTION__));
+ DEBUG ((DEBUG_ERROR, "%a - Cannot set default keys while SecureBoot is enabled!\n", __func__));
return EFI_ABORTED;
}
- DEBUG ((DEBUG_INFO, "%a - Setting up key %s!\n", __FUNCTION__, SecureBootPayload->SecureBootKeyName));
+ DEBUG ((DEBUG_INFO, "%a - Setting up key %s!\n", __func__, SecureBootPayload->SecureBootKeyName));
//
// Start running down the list, creating variables in our wake.
@@ -834,10 +834,10 @@ SetSecureBootVariablesToDefault (
Data
);
if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "%a - Failed to enroll DB %r!\n", __FUNCTION__, Status));
+ DEBUG ((DEBUG_ERROR, "%a - Failed to enroll DB %r!\n", __func__, Status));
}
} else {
- DEBUG ((DEBUG_ERROR, "%a - Failed to enroll DBX %r!\n", __FUNCTION__, Status));
+ DEBUG ((DEBUG_ERROR, "%a - Failed to enroll DBX %r!\n", __func__, Status));
}
// Keep it going. Keep it going. dbt if supplied...
@@ -851,7 +851,7 @@ SetSecureBootVariablesToDefault (
Data
);
if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "%a - Failed to enroll DBT %r!\n", __FUNCTION__, Status));
+ DEBUG ((DEBUG_ERROR, "%a - Failed to enroll DBT %r!\n", __func__, Status));
}
}
@@ -866,7 +866,7 @@ SetSecureBootVariablesToDefault (
Data
);
if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "%a - Failed to enroll KEK %r!\n", __FUNCTION__, Status));
+ DEBUG ((DEBUG_ERROR, "%a - Failed to enroll KEK %r!\n", __func__, Status));
}
}
@@ -889,7 +889,7 @@ SetSecureBootVariablesToDefault (
//
// Report PK creation errors.
if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "%a - Failed to update the PK! - %r\n", __FUNCTION__, Status));
+ DEBUG ((DEBUG_ERROR, "%a - Failed to update the PK! - %r\n", __func__, Status));
Status = EFI_SECURITY_VIOLATION;
}
}
diff --git a/SecurityPkg/Library/SecureBootVariableLib/UnitTest/SecureBootVariableLibUnitTest.c b/SecurityPkg/Library/SecureBootVariableLib/UnitTest/SecureBootVariableLibUnitTest.c
index e4cdc68bbb..fb9a0a2aba 100644
--- a/SecurityPkg/Library/SecureBootVariableLib/UnitTest/SecureBootVariableLibUnitTest.c
+++ b/SecurityPkg/Library/SecureBootVariableLib/UnitTest/SecureBootVariableLibUnitTest.c
@@ -82,7 +82,7 @@ MockSetVariable (
DEBUG ((
DEBUG_INFO,
"%a %s %g %x %x %p\n",
- __FUNCTION__,
+ __func__,
VariableName,
VendorGuid,
Attributes,
@@ -139,7 +139,7 @@ MockGetVariable (
DEBUG ((
DEBUG_INFO,
"%a %s %g %p %x %p\n",
- __FUNCTION__,
+ __func__,
VariableName,
VendorGuid,
Attributes,
diff --git a/SecurityPkg/Library/SecureBootVariableProvisionLib/SecureBootVariableProvisionLib.c b/SecurityPkg/Library/SecureBootVariableProvisionLib/SecureBootVariableProvisionLib.c
index bed1fe8620..d6046c85d2 100644
--- a/SecurityPkg/Library/SecureBootVariableProvisionLib/SecureBootVariableProvisionLib.c
+++ b/SecurityPkg/Library/SecureBootVariableProvisionLib/SecureBootVariableProvisionLib.c
@@ -81,7 +81,7 @@ SecureBootFetchData (
if (Status == EFI_SUCCESS) {
RsaPubKey = NULL;
if (RsaGetPublicKeyFromX509 (Buffer, Size, &RsaPubKey) == FALSE) {
- DEBUG ((DEBUG_ERROR, "%a: Invalid key format: %d\n", __FUNCTION__, KeyIndex));
+ DEBUG ((DEBUG_ERROR, "%a: Invalid key format: %d\n", __func__, KeyIndex));
if (EfiSig != NULL) {
FreePool (EfiSig);
}