SecurityPkg: Replace include guards with #pragma once

Replace traditional `#ifndef`/`#define`/`#endif` include guards with
`#pragma` once.

`#pragma once` is a widely supported preprocessor directive that
prevents header files from being included multiple times. It is
supported by all toolchains used to build edk2: GCC, Clang/LLVM, and
MSVC.

Compared to macro-based include guards, `#pragma once`:

- Eliminates the risk of macro name collisions or copy/paste errors
  where two headers inadvertently use the same guard macro.
- Eliminate inconsistency in the way include guard macros are named
  (e.g., some files use `__FILE_H__`, others use `FILE_H_`, etc.).
- Reduces boilerplate (three lines replaced by one).
- Avoids polluting the macro namespace with guard symbols.
- Can improve build times as the preprocessor can skip re-opening the
  file entirely, rather than re-reading it to find the matching
  `#endif` ("multiple-include optimization").
  - Note that some compilers may already optimize traditional include
    guards, by recognzining the idiomatic pattern.

This change is made acknowledging that overall portability of the
code will technically be reduced, as `#pragma once` is not part of the
C/C++ standards.

However, this is considered acceptable given:

1. edk2 already defines a subset of supported compilers in
   BaseTools/Conf/tools_def.template, all of which have supported
   `#pragma once` for over two decades.
2. There have been concerns raised to the project about inconsistent
   include guard naming and potential macro collisions.

Approximate compiler support dates:

- MSVC: Supported since Visual C++ 4.2 (1996)
- GCC: Supported since 3.4 (2004)
  (http://gnu.ist.utl.pt/software/gcc/gcc-3.4/changes.html)
- Clang (LLVM based): Since initial release in 2007

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
This commit is contained in:
Michael Kubacki 2026-02-03 14:20:09 -05:00 committed by mergify[bot]
parent 6181c85fa9
commit 9326c0eb0a
87 changed files with 87 additions and 348 deletions

View file

@ -5,8 +5,7 @@
**/
#ifndef __LIBSPDM_STUB_H__
#define __LIBSPDM_STUB_H__
#pragma once
#include <library/spdm_common_lib.h>
#include <library/spdm_return_status.h>
@ -148,5 +147,3 @@ typedef struct {
#define SpdmPskHandshakeSecretHkdfExpandFunc libspdm_psk_handshake_secret_hkdf_expand
#define SpdmMeasurementOpaqueData libspdm_measurement_opaque_data
#define SpdmChallengeOpaqueData libspdm_challenge_opaque_data
#endif

View file

@ -7,8 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef LIBSPDM_STDBOOL_ALT_H
#define LIBSPDM_STDBOOL_ALT_H
#pragma once
// In C23, bool is a built-in type
#if __STDC_VERSION__ < 202311L
@ -22,5 +21,3 @@ typedef BOOLEAN bool;
#ifndef false
#define false FALSE
#endif
#endif /* LIBSPDM_STDBOOL_ALT */

View file

@ -7,10 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef LIBSPDM_STD_DEF_ALT_H
#define LIBSPDM_STD_DEF_ALT_H
#pragma once
typedef UINTN size_t;
#define offsetof(type, member) OFFSET_OF(type,member)
#endif /* LIBSPDM_STDDEF_ALT */

View file

@ -7,8 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef LIBSPDM_STD_INT_ALT_H
#define LIBSPDM_STD_INT_ALT_H
#pragma once
typedef UINT64 uint64_t;
typedef INT64 int64_t;
@ -21,5 +20,3 @@ typedef UINT8 uint8_t;
#ifndef SIZE_MAX
#define SIZE_MAX MAX_UINTN
#endif
#endif /* LIBSPDM_STDINT_ALT */

View file

@ -7,8 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef BASE_H
#define BASE_H
#pragma once
#define LIBSPDM_STDINT_ALT "hal/LibspdmStdIntAlt.h"
#define LIBSPDM_STDBOOL_ALT "hal/LibspdmStdBoolAlt.h"
@ -90,5 +89,3 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
*
**/
#define LIBSPDM_ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
#endif /* BASE_H */

View file

@ -7,8 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef SPDM_LIB_CONFIG_H
#define SPDM_LIB_CONFIG_H
#pragma once
/* Enables assertions and debug printing. When `LIBSPDM_DEBUG_ENABLE` is defined it overrides or
* sets the values of `LIBSPDM_DEBUG_PRINT_ENABLE`, `LIBSPDM_DEBUG_ASSERT_ENABLE`, and
@ -390,5 +389,3 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#ifndef LIBSPDM_CHECK_SPDM_CONTEXT
#define LIBSPDM_CHECK_SPDM_CONTEXT 1
#endif
#endif /* SPDM_LIB_CONFIG_H */

View file

@ -7,8 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef SPDM_SECURITY_LIB_INTERNAL_H_
#define SPDM_SECURITY_LIB_INTERNAL_H_
#pragma once
#include <Uefi.h>
#include <hal/base.h>
@ -246,5 +245,3 @@ InternalDumpData (
CONST UINT8 *Data,
UINTN Size
);
#endif

View file

@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __FV_REPORT_PEI_H__
#define __FV_REPORT_PEI_H__
#pragma once
#include <PiPei.h>
@ -118,5 +117,3 @@ typedef struct {
HASH_FINAL_METHOD HashFinal;
HASH_ALL_METHOD HashAll;
} HASH_ALG_INFO;
#endif //__FV_REPORT_PEI_H__

View file

@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _HASH2_DRIVER_H_
#define _HASH2_DRIVER_H_
#pragma once
#include <Uefi.h>
@ -122,5 +121,3 @@ Hash2ServiceBindingDestroyChild (
);
extern EFI_HASH2_PROTOCOL mHash2Protocol;
#endif

View file

@ -7,8 +7,7 @@
**/
#ifndef _HDD_PASSWORD_COMMON_H_
#define _HDD_PASSWORD_COMMON_H_
#pragma once
//
// The payload length of HDD related ATA commands
@ -50,5 +49,3 @@ typedef struct {
UINT32 DevicePathLength;
EFI_DEVICE_PATH_PROTOCOL DevicePath[];
} HDD_PASSWORD_DEVICE_INFO;
#endif // _HDD_PASSWORD_COMMON_H_

View file

@ -7,8 +7,7 @@
**/
#ifndef _HDD_PASSWORD_DXE_H_
#define _HDD_PASSWORD_DXE_H_
#pragma once
#include <Uefi.h>
@ -131,5 +130,3 @@ typedef struct {
UINT32 Address;
S3_BOOT_SCRIPT_LIB_WIDTH Width;
} HDD_HC_PCI_REGISTER_SAVE;
#endif

View file

@ -7,8 +7,7 @@
**/
#ifndef _HDD_PASSWORD_HII_DATASTRUC_H_
#define _HDD_PASSWORD_HII_DATASTRUC_H_
#pragma once
#include <Guid/HiiPlatformSetupFormset.h>
@ -52,5 +51,3 @@ typedef struct _HDD_PASSWORD_CONFIG {
} HDD_PASSWORD_CONFIG;
#pragma pack()
#endif

View file

@ -7,8 +7,7 @@
**/
#ifndef _HDD_PASSWORD_PEI_H_
#define _HDD_PASSWORD_PEI_H_
#pragma once
#include <PiPei.h>
#include <IndustryStandard/Atapi.h>
@ -30,5 +29,3 @@
// Time out value for ATA PassThru PPI
//
#define ATA_TIMEOUT 30000000
#endif

View file

@ -10,8 +10,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __AUTHENTICATED_VARIABLE_FORMAT_H__
#define __AUTHENTICATED_VARIABLE_FORMAT_H__
#pragma once
#include <Guid/VariableFormat.h>
@ -65,5 +64,3 @@ extern EFI_GUID gEfiVendorKeysNvGuid;
#define EFI_VENDOR_KEYS_NV_VARIABLE_NAME L"VendorKeysNv"
#define VENDOR_KEYS_VALID 1
#define VENDOR_KEYS_MODIFIED 0
#endif // __AUTHENTICATED_VARIABLE_FORMAT_H__

View file

@ -8,8 +8,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef CC_EVENT_HOB_H_
#define CC_EVENT_HOB_H_
#pragma once
//
// The Global ID of a GUIDed HOB used to pass a CC_EVENT from SEC to a CC DXE Driver.
@ -18,5 +17,3 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
{ 0x20f8fd36, 0x6d00, 0x40fb, { 0xb7, 0x04, 0xd1, 0x2c, 0x15, 0x3c, 0x62, 0xeb } }
extern EFI_GUID gCcEventEntryHobGuid;
#endif

View file

@ -7,8 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _MEASURED_FV_HOB_H_
#define _MEASURED_FV_HOB_H_
#pragma once
#include <IndustryStandard/UefiTcgPlatform.h>
@ -26,5 +25,3 @@ typedef struct {
UINT32 Num;
EFI_PLATFORM_FIRMWARE_BLOB MeasuredFvBuf[1];
} MEASURED_HOB_DATA;
#endif

View file

@ -9,8 +9,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __PHYSICAL_PRESENCE_DATA_GUID_H__
#define __PHYSICAL_PRESENCE_DATA_GUID_H__
#pragma once
#define EFI_PHYSICAL_PRESENCE_DATA_GUID \
{ \
@ -76,5 +75,3 @@ typedef struct {
extern EFI_GUID gEfiPhysicalPresenceGuid;
extern EFI_GUID gEfiPhysicalPresenceAcpiGuid;
#endif

View file

@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __PWD_CREDENTIAL_PROVIDER_HII_H__
#define __PWD_CREDENTIAL_PROVIDER_HII_H__
#pragma once
//
// Used for save password credential and form browser.
@ -19,5 +18,3 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
}
extern EFI_GUID gPwdCredentialProviderGuid;
#endif

View file

@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __SECUREBOOT_CONFIG_HII_GUID_H__
#define __SECUREBOOT_CONFIG_HII_GUID_H__
#pragma once
#define SECUREBOOT_CONFIG_FORM_SET_GUID \
{ \
@ -15,5 +14,3 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
}
extern EFI_GUID gSecureBootConfigFormSetGuid;
#endif

View file

@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _SECURITYPKG_TOKEN_SPACE_GUID_H_
#define _SECURITYPKG_TOKEN_SPACE_GUID_H_
#pragma once
#define SECURITYPKG_TOKEN_SPACE_GUID \
{ \
@ -15,5 +14,3 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
}
extern EFI_GUID gEfiSecurityPkgTokenSpaceGuid;
#endif

View file

@ -9,8 +9,7 @@
**/
#ifndef TCG2_ACPI_COMMUNICATE_BUFFER_H_
#define TCG2_ACPI_COMMUNICATE_BUFFER_H_
#pragma once
#define TCG2_ACPI_COMMUNICATE_BUFFER_HOB_REVISION 1
@ -29,5 +28,3 @@ typedef struct {
} TCG2_ACPI_COMMUNICATE_BUFFER;
extern EFI_GUID gEdkiiTcg2AcpiCommunicateBufferHobGuid;
#endif

View file

@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __TCG2_CONFIG_HII_GUID_H__
#define __TCG2_CONFIG_HII_GUID_H__
#pragma once
#define TCG2_CONFIG_FORM_SET_GUID \
{ \
@ -15,5 +14,3 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
}
extern EFI_GUID gTcg2ConfigFormSetGuid;
#endif

View file

@ -9,8 +9,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __TCG2_PHYSICAL_PRESENCE_DATA_GUID_H__
#define __TCG2_PHYSICAL_PRESENCE_DATA_GUID_H__
#pragma once
#define EFI_TCG2_PHYSICAL_PRESENCE_DATA_GUID \
{ \
@ -36,5 +35,3 @@ typedef struct {
} EFI_TCG2_PHYSICAL_PRESENCE_FLAGS;
extern EFI_GUID gEfiTcg2PhysicalPresenceGuid;
#endif

View file

@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __TCG_CONFIG_HII_GUID_H__
#define __TCG_CONFIG_HII_GUID_H__
#pragma once
#define TCG_CONFIG_FORM_SET_GUID \
{ \
@ -15,5 +14,3 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
}
extern EFI_GUID gTcgConfigFormSetGuid;
#endif

View file

@ -8,8 +8,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _TCG_EVENT_HOB_H_
#define _TCG_EVENT_HOB_H_
#pragma once
///
/// The Global ID of a GUIDed HOB used to pass a TCG_PCR_EVENT from a TPM PEIM to a TPM DXE Driver.
@ -59,5 +58,3 @@ extern EFI_GUID gTpm2StartupLocalityHobGuid;
}
extern EFI_GUID gTcg800155PlatformIdEventHobGuid;
#endif

View file

@ -9,8 +9,7 @@
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef TPM2_SERVICE_FFA_H_
#define TPM2_SERVICE_FFA_H_
#pragma once
#define TPM2_SERVICE_FFA_GUID \
{ 0x17b862a4, 0x1806, 0x4faf, { 0x86, 0xb3, 0x08, 0x9a, 0x58, 0x35, 0x38, 0x61 } }
@ -53,5 +52,3 @@
extern EFI_GUID gTpm2ServiceFfaGuid;
typedef UINT32 TPM2_FFA_STATUS;
#endif /* TPM2_SERVICE_FFA_H_ */

View file

@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __TPM_INSTANCE_GUID_H__
#define __TPM_INSTANCE_GUID_H__
#pragma once
#define TPM_DEVICE_INTERFACE_NONE \
{ 0x00000000, 0x0000, 0x0000, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }
@ -26,5 +25,3 @@ extern EFI_GUID gEfiTpmDeviceInstanceTpm20DtpmGuid;
{ 0x7f4158d3, 0x74d, 0x456d, { 0x8c, 0xb2, 0x1, 0xf9, 0xc8, 0xf7, 0x9d, 0xaa } }
extern EFI_GUID gEfiTpmDeviceSelectedGuid;
#endif

View file

@ -8,8 +8,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef TCG2_NVS_MM_H_
#define TCG2_NVS_MM_H_
#pragma once
#define MM_TPM_NVS_HOB_GUID \
{ 0xc96c76eb, 0xbc78, 0x429c, { 0x9f, 0x4b, 0xda, 0x51, 0x78, 0xc2, 0x84, 0x57 }}
@ -64,5 +63,3 @@ typedef struct {
typedef enum {
TpmNvsMmExchangeInfo,
} TPM_NVS_MM_FUNCTION;
#endif // TCG2_NVS_MM_H_

View file

@ -8,8 +8,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _HASH_LIB_H_
#define _HASH_LIB_H_
#pragma once
#include <Uefi.h>
#include <Protocol/Hash.h>
@ -163,5 +162,3 @@ EFIAPI
RegisterHashInterfaceLib (
IN HASH_INTERFACE *HashInterface
);
#endif

View file

@ -6,8 +6,7 @@
**/
#ifndef PEILESS_SEC_MEASURE_LIB_H_
#define PEILESS_SEC_MEASURE_LIB_H_
#pragma once
/**
Measurement for PeilessSec.
@ -22,5 +21,3 @@ EFI_STATUS
MeasurePeilessSec (
VOID
);
#endif /* PEILESS_SEC_MEASURE_LIB_H_ */

View file

@ -6,8 +6,7 @@
**/
#ifndef PLATFORM_PK_PROTECTION_LIB_H_
#define PLATFORM_PK_PROTECTION_LIB_H_
#pragma once
/**
Disable any applicable protection against variable 'PK'. The implementation
@ -27,5 +26,3 @@ EFIAPI
DisablePKProtection (
VOID
);
#endif

View file

@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __PLATFORM_SECURE_LIB_H__
#define __PLATFORM_SECURE_LIB_H__
#pragma once
/**
@ -31,5 +30,3 @@ EFIAPI
UserPhysicalPresent (
VOID
);
#endif

View file

@ -11,8 +11,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef SECURE_BOOT_VARIABLE_LIB_H_
#define SECURE_BOOT_VARIABLE_LIB_H_
#pragma once
/**
Set the platform secure boot mode into "Custom" or "Standard" mode.
@ -229,5 +228,3 @@ EFIAPI
SetSecureBootVariablesToDefault (
IN CONST SECURE_BOOT_PAYLOAD_INFO *SecureBootPayload
);
#endif

View file

@ -9,8 +9,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef SECURE_BOOT_VARIABLE_PROVISION_LIB_H_
#define SECURE_BOOT_VARIABLE_PROVISION_LIB_H_
#pragma once
/**
Sets the content of the 'db' variable based on 'dbDefault' variable content.
@ -131,5 +130,3 @@ EFI_STATUS
SecureBootInitDbxDefault (
IN VOID
);
#endif

View file

@ -7,8 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef SPDM_SECURITY_LIB_H_
#define SPDM_SECURITY_LIB_H_
#pragma once
#include <Protocol/DeviceSecurity.h>
#include <Protocol/DeviceSecurityPolicy.h>
@ -433,5 +432,3 @@ EFIAPI
IsDeviceAuthBootEnabled (
VOID
);
#endif

View file

@ -7,8 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _TCG2_PHYSICAL_PRESENCE_LIB_H_
#define _TCG2_PHYSICAL_PRESENCE_LIB_H_
#pragma once
#include <IndustryStandard/Tpm20.h>
#include <IndustryStandard/TcgPhysicalPresence.h>
@ -163,5 +162,3 @@ EFIAPI
Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction (
IN UINT32 OperationRequest
);
#endif

View file

@ -12,8 +12,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _TCG2_PP_VENDOR_LIB_H_
#define _TCG2_PP_VENDOR_LIB_H_
#pragma once
#include <IndustryStandard/Tpm20.h>
#include <Protocol/Tcg2Protocol.h>
@ -119,5 +118,3 @@ Tcg2PpVendorLibGetUserConfirmationStatusFunction (
IN UINT32 OperationRequest,
IN UINT32 ManagementFlags
);
#endif

View file

@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _TCG_EVENTLOGRECORD_LIB_H_
#define _TCG_EVENTLOGRECORD_LIB_H_
#pragma once
#include <Uefi.h>
@ -93,5 +92,3 @@ MeasureHandoffTable (
IN VOID *TableAddress,
IN UINTN TableLength
);
#endif

View file

@ -7,8 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _TCG_PHYSICAL_PRESENCE_LIB_H_
#define _TCG_PHYSICAL_PRESENCE_LIB_H_
#pragma once
/**
Check and execute the pending TPM request and Lock TPM.
@ -44,5 +43,3 @@ EFIAPI
TcgPhysicalPresenceLibNeedUserConfirm (
VOID
);
#endif

View file

@ -12,8 +12,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _TCG_PP_VENDOR_LIB_H_
#define _TCG_PP_VENDOR_LIB_H_
#pragma once
//
// The definition of physical presence operation actions
@ -149,5 +148,3 @@ TcgPpVendorLibGetUserConfirmationStatusFunction (
IN UINT32 OperationRequest,
IN UINT32 ManagementFlags
);
#endif

View file

@ -11,8 +11,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _TCG_CORE_H_
#define _TCG_CORE_H_
#pragma once
#include <IndustryStandard/TcgStorageCore.h>
@ -1281,5 +1280,3 @@ TcgIsLocked (
);
#pragma pack()
#endif // _TCG_CORE_H_

View file

@ -26,8 +26,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _OPAL_CORE_H_
#define _OPAL_CORE_H_
#pragma once
#include <IndustryStandard/TcgStorageOpal.h>
@ -879,5 +878,3 @@ OpalUtilGetDataRemovalMechanismLists (
IN OPAL_SESSION *Session,
OUT UINT32 *RemovalMechanismLists
);
#endif // _OPAL_CORE_H_

View file

@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _TPM12_COMMAND_LIB_H_
#define _TPM12_COMMAND_LIB_H_
#pragma once
#include <IndustryStandard/Tpm12.h>
@ -216,5 +215,3 @@ EFIAPI
Tpm12GetCapabilityFlagVolatile (
OUT TPM_STCLEAR_FLAGS *VolatileFlags
);
#endif

View file

@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _TPM12_DEVICE_LIB_H_
#define _TPM12_DEVICE_LIB_H_
#pragma once
#include <IndustryStandard/Tpm12.h>
@ -44,5 +43,3 @@ EFIAPI
Tpm12RequestUseTpm (
VOID
);
#endif

View file

@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _TPM2_COMMAND_LIB_H_
#define _TPM2_COMMAND_LIB_H_
#pragma once
#include <IndustryStandard/Tpm20.h>
@ -1184,5 +1183,3 @@ Tpm2PcrReadForActiveBank (
IN TPMI_DH_PCR PcrHandle,
OUT TPML_DIGEST *HashList
);
#endif

View file

@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _TPM2_DEVICE_LIB_H_
#define _TPM2_DEVICE_LIB_H_
#pragma once
#include <Uefi.h>
@ -109,5 +108,3 @@ EFIAPI
Tpm2RegisterTpm2DeviceLib (
IN TPM2_DEVICE_INTERFACE *Tpm2Device
);
#endif

View file

@ -7,8 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _TPM_COMM_LIB_H_
#define _TPM_COMM_LIB_H_
#pragma once
#include <IndustryStandard/Tpm12.h>
@ -277,5 +276,3 @@ TpmCommHashAll (
IN UINTN DataLen,
OUT TPM_DIGEST *Digest
);
#endif

View file

@ -11,8 +11,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef TPM_PLATFORM_HIERARCHY_LIB_H_
#define TPM_PLATFORM_HIERARCHY_LIB_H_
#pragma once
/**
This service will perform the TPM Platform Hierarchy configuration at the SmmReadyToLock event.
@ -23,5 +22,3 @@ EFIAPI
ConfigureTpmPlatformHierarchy (
VOID
);
#endif

View file

@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _CC_MEASUREMENT_PPI_H_
#define _CC_MEASUREMENT_PPI_H_
#pragma once
#include <Protocol/CcMeasurement.h>
@ -74,5 +73,3 @@ struct _EDKII_CC_PPI {
};
extern EFI_GUID gEdkiiCcPpiGuid;
#endif

View file

@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __EFI_PEI_FIRMWARE_VOLUME_INFO_MEASUREMENT_EXCLUDED_H__
#define __EFI_PEI_FIRMWARE_VOLUME_INFO_MEASUREMENT_EXCLUDED_H__
#pragma once
#define EFI_PEI_FIRMWARE_VOLUME_INFO_MEASUREMENT_EXCLUDED_PPI_GUID \
{ 0x6e056ff9, 0xc695, 0x4364, { 0x9e, 0x2c, 0x61, 0x26, 0xf5, 0xce, 0xea, 0xae } }
@ -26,5 +25,3 @@ typedef struct {
} EFI_PEI_FIRMWARE_VOLUME_INFO_MEASUREMENT_EXCLUDED_PPI;
extern EFI_GUID gEfiPeiFirmwareVolumeInfoMeasurementExcludedPpiGuid;
#endif

View file

@ -8,8 +8,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __PEI_FIRMWARE_VOLUME_INFO_PREHASHED_FV_H__
#define __PEI_FIRMWARE_VOLUME_INFO_PREHASHED_FV_H__
#pragma once
#define EDKII_PEI_FIRMWARE_VOLUME_INFO_PREHASHED_FV_PPI_GUID \
{ 0x3ce1e631, 0x7008, 0x477c, { 0xad, 0xa7, 0x5d, 0xcf, 0xc7, 0xc1, 0x49, 0x4b } }
@ -39,5 +38,3 @@ typedef struct {
} EDKII_PEI_FIRMWARE_VOLUME_INFO_PREHASHED_FV_PPI;
extern EFI_GUID gEdkiiPeiFirmwareVolumeInfoPrehashedFvPpiGuid;
#endif

View file

@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __PEI_FIRMWARE_VOLUME_INFO_STORED_HASH_FV_H__
#define __PEI_FIRMWARE_VOLUME_INFO_STORED_HASH_FV_H__
#pragma once
#include <Ppi/FirmwareVolumeInfoPrehashedFV.h>
@ -57,5 +56,3 @@ struct _EDKII_PEI_FIRMWARE_VOLUME_INFO_STORED_HASH_FV_PPI {
};
extern EFI_GUID gEdkiiPeiFirmwareVolumeInfoStoredHashFvPpiGuid;
#endif

View file

@ -8,8 +8,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __PEI_LOCK_PHYSICAL_PRESENCE_H__
#define __PEI_LOCK_PHYSICAL_PRESENCE_H__
#pragma once
///
/// Global ID for the PEI_LOCK_PHYSICAL_PRESENCE_PPI_GUID.
@ -50,5 +49,3 @@ struct _PEI_LOCK_PHYSICAL_PRESENCE_PPI {
};
extern EFI_GUID gPeiLockPhysicalPresencePpiGuid;
#endif // __PEI_LOCK_PHYSICAL_PRESENCE_H__

View file

@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _TCG_PPI_H_
#define _TCG_PPI_H_
#pragma once
#include <IndustryStandard/UefiTcgPlatform.h>
@ -61,5 +60,3 @@ struct _EDKII_TCG_PPI {
};
extern EFI_GUID gEdkiiTcgPpiGuid;
#endif

View file

@ -8,8 +8,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _PEI_TPM_INITIALIZED_PPI_H_
#define _PEI_TPM_INITIALIZED_PPI_H_
#pragma once
///
/// Global ID for the PEI_TPM_INITIALIZED_PPI which always uses a NULL interface.
@ -30,5 +29,3 @@ extern EFI_GUID gPeiTpmInitializedPpiGuid;
}
extern EFI_GUID gPeiTpmInitializationDonePpiGuid;
#endif

View file

@ -6,8 +6,7 @@
**/
#ifndef EDKII_DEVICE_SECURITY_POLICY_PROTOCOL_H_
#define EDKII_DEVICE_SECURITY_POLICY_PROTOCOL_H_
#pragma once
#include <Uefi.h>
#include <Protocol/DeviceSecurity.h>
@ -129,5 +128,3 @@ struct _EDKII_DEVICE_SECURITY_POLICY_PROTOCOL {
};
extern EFI_GUID gEdkiiDeviceSecurityPolicyProtocolGuid;
#endif

View file

@ -6,8 +6,7 @@
**/
#ifndef UEFI_SECURE_BOOT_H_
#define UEFI_SECURE_BOOT_H_
#pragma once
#pragma pack (push, 1)
@ -90,5 +89,3 @@ typedef struct {
CONST VOID *PkPtr;
} SECURE_BOOT_PAYLOAD_INFO;
#pragma pack (pop)
#endif // UEFI_SECURE_BOOT_H_

View file

@ -17,8 +17,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _AUTHSERVICE_INTERNAL_H_
#define _AUTHSERVICE_INTERNAL_H_
#pragma once
#include <Library/AuthVariableLib.h>
#include <Library/BaseLib.h>
@ -366,5 +365,3 @@ AuthServiceInternalUpdateVariableWithTimeStamp (
IN UINT32 Attributes,
IN EFI_TIME *TimeStamp
);
#endif

View file

@ -7,8 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __IMAGEVERIFICATIONLIB_H__
#define __IMAGEVERIFICATIONLIB_H__
#pragma once
#include <Library/UefiDriverEntryPoint.h>
#include <Library/DebugLib.h>
@ -194,5 +193,3 @@ typedef struct {
//
HASH_FINAL HashFinal;
} HASH_TABLE;
#endif

View file

@ -5,8 +5,7 @@
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef DXE_IMAGE_VERIFICATION_LIB_GOOGLE_TEST_H
#define DXE_IMAGE_VERIFICATION_LIB_GOOGLE_TEST_H
#pragma once
/**
Provide verification service for signed images, which include both signature validation
@ -75,5 +74,3 @@ DxeImageVerificationHandler (
//
#define ALWAYS_EXECUTE 0x00000000
#define NEVER_EXECUTE 0x00000001
#endif // DXE_IMAGE_VERIFICATION_LIB_GOOGLE_TEST_H

View file

@ -17,8 +17,7 @@
**/
#ifndef DXE_TPM2_MEASURE_BOOT_LIB_SANITATION_
#define DXE_TPM2_MEASURE_BOOT_LIB_SANITATION_
#pragma once
#include <Uefi.h>
#include <Uefi/UefiSpec.h>
@ -135,5 +134,3 @@ Tpm2SanitizePeImageEventSize (
IN UINT32 FilePathSize,
OUT UINT32 *EventSize
);
#endif // DXE_TPM2_MEASURE_BOOT_LIB_VALIDATION_

View file

@ -17,8 +17,7 @@
**/
#ifndef DXE_TPM_MEASURE_BOOT_LIB_VALIDATION_
#define DXE_TPM_MEASURE_BOOT_LIB_VALIDATION_
#pragma once
#include <Uefi.h>
#include <Uefi/UefiSpec.h>
@ -133,5 +132,3 @@ TpmSanitizePeImageEventSize (
IN UINT32 FilePathSize,
OUT UINT32 *EventSize
);
#endif // DXE_TPM_MEASURE_BOOT_LIB_VALIDATION_

View file

@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _HASH_LIB_BASE_CRYPTO_ROUTER_COMMON_H_
#define _HASH_LIB_BASE_CRYPTO_ROUTER_COMMON_H_
#pragma once
/**
The function get hash mask info from algorithm.
@ -34,5 +33,3 @@ Tpm2SetHashToDigestList (
IN OUT TPML_DIGEST_VALUES *DigestList,
IN TPML_DIGEST_VALUES *Digest
);
#endif

View file

@ -15,8 +15,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _MM_TCG2_PHYSICAL_PRESENCE_LIB_COMMON_H_
#define _MM_TCG2_PHYSICAL_PRESENCE_LIB_COMMON_H_
#pragma once
#include <Guid/Tcg2PhysicalPresenceData.h>
@ -53,5 +52,3 @@ BOOLEAN
IsTcg2PPVerLowerThan_1_3 (
VOID
);
#endif

View file

@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _OPAL_INTERNAL_H_
#define _OPAL_INTERNAL_H_
#pragma once
#include <Library/TcgStorageOpalLib.h>
@ -86,5 +85,3 @@ OpalPyrite2AdminRevert (
UINT8 *MethodStatus,
UINT32 EstimateTimeCost
);
#endif // _OPAL_CORE_H_

View file

@ -7,8 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _TPM2_DEVICE_LIB_DTPM_H_
#define _TPM2_DEVICE_LIB_DTPM_H_
#pragma once
/**
Return PTP interface type.
@ -63,5 +62,3 @@ EFI_STATUS
InternalTpm2DeviceLibDTpmCommonConstructor (
VOID
);
#endif // _TPM2_DEVICE_LIB_DTPM_H_

View file

@ -31,8 +31,7 @@
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef TPM2_DEVICE_LIB_FFA_H_
#define TPM2_DEVICE_LIB_FFA_H_
#pragma once
#define TPM2_FFA_INTERFACE_TYPE_UNKNOWN 0xFF
#define TPM2_FFA_PARTITION_ID_INVALID 0x0000
@ -259,5 +258,3 @@ EFIAPI
GetTpmServicePartitionId (
OUT UINT16 *PartitionId
);
#endif /* _TPM2_DEVICE_LIB_SMC_H_ */

View file

@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _TPMCOMMLIB_COMMON_HEADER_H_
#define _TPMCOMMLIB_COMMON_HEADER_H_
#pragma once
#include <PiPei.h>
#include <IndustryStandard/Tpm12.h>
@ -19,5 +18,3 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Library/BaseCryptLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/DebugLib.h>
#endif

View file

@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __AES_CORE_H__
#define __AES_CORE_H__
#pragma once
/**
Encrypts one single block data (128 bits) with AES algorithm.
@ -27,5 +26,3 @@ AesEncrypt (
IN UINT8 *InData,
OUT UINT8 *OutData
);
#endif // __AES_CORE_H__

View file

@ -7,8 +7,7 @@
**/
#ifndef RNGDXE_INTERNALS_H_
#define RNGDXE_INTERNALS_H_
#pragma once
#include <Protocol/Rng.h>
@ -134,5 +133,3 @@ GenerateEntropy (
IN UINTN Length,
OUT UINT8 *Entropy
);
#endif // RNGDXE_INTERNALS_H_

View file

@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __TCG_MOR_H__
#define __TCG_MOR_H__
#pragma once
#include <PiDxe.h>
@ -37,5 +36,3 @@ typedef struct {
#define SECURITY_PROTOCOL_IEEE1667 0xEE
#define ROUNDUP512(x) (((x) % 512 == 0) ? (x) : ((x) / 512 + 1) * 512)
#endif

View file

@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _EFI_TCG_MOR_LOCK_H_
#define _EFI_TCG_MOR_LOCK_H_
#pragma once
/**
This service is a wrapper for the UEFI Runtime Service GetVariable().
@ -127,5 +126,3 @@ EFIAPI
MorLockDriverInit (
VOID
);
#endif

View file

@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _OPAL_DRIVER_H_
#define _OPAL_DRIVER_H_
#pragma once
#include <PiDxe.h>
@ -612,5 +611,3 @@ OpalEfiDriverComponentName2GetControllerName (
CHAR8 *Language,
CHAR16 **ControllerName
);
#endif //_OPAL_DRIVER_H_

View file

@ -7,8 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _OPAL_HII_H_
#define _OPAL_HII_H_
#pragma once
#include <Protocol/HiiConfigAccess.h>
@ -371,5 +370,3 @@ EFI_STATUS
OpalDiskUpdateOwnerShip (
OPAL_DISK *OpalDisk
);
#endif // _HII_H_

View file

@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _OPAL_HII_FORM_VALUES_H_
#define _OPAL_HII_FORM_VALUES_H_
#pragma once
// ID's for various forms that will be used by HII
#define FORMID_VALUE_MAIN_MENU 0x01
@ -109,5 +108,3 @@ typedef struct {
// {BBF1ACD2-28D8-44ea-A291-58A237FEDF1A}
#define SETUP_VARIABLE_GUID { 0xbbf1acd2, 0x28d8, 0x44ea, { 0xa2, 0x91, 0x58, 0xa2, 0x37, 0xfe, 0xdf, 0x1a } }
#endif //_HII_FORM_VALUES_H_

View file

@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _OPAL_PASSWORD_COMMON_H_
#define _OPAL_PASSWORD_COMMON_H_
#pragma once
#define OPAL_MAX_PASSWORD_SIZE 32
@ -34,5 +33,3 @@ typedef struct {
} OPAL_DEVICE_LOCKBOX_DATA;
#define OPAL_DEVICE_LOCKBOX_GUID { 0x56a77f0d, 0x6f05, 0x4d47, { 0xb9, 0x11, 0x4f, 0xd, 0xec, 0x5c, 0x58, 0x61 } }
#endif // _OPAL_PASSWORD_COMMON_H_

View file

@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _OPAL_PASSWORD_PEI_H_
#define _OPAL_PASSWORD_PEI_H_
#pragma once
#include <PiPei.h>
@ -54,5 +53,3 @@ typedef struct {
CR (a, OPAL_PEI_DEVICE, Sscp, OPAL_PEI_DEVICE_SIGNATURE)
#pragma pack()
#endif // _OPAL_PASSWORD_PEI_H_

View file

@ -7,8 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __TCG2_CONFIG_IMPL_H__
#define __TCG2_CONFIG_IMPL_H__
#pragma once
#include <Uefi.h>
@ -194,5 +193,3 @@ Tcg2Callback (
IN EFI_IFR_TYPE_VALUE *Value,
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
);
#endif

View file

@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __TCG2_CONFIG_NV_DATA_H__
#define __TCG2_CONFIG_NV_DATA_H__
#pragma once
#include <Guid/HiiPlatformSetupFormset.h>
#include <Guid/Tcg2ConfigHii.h>
@ -85,5 +84,3 @@ typedef struct {
#define TCG2_STORAGE_INFO_NAME L"TCG2_CONFIGURATION_INFO"
#define TCG2_DEVICE_DETECTION_NAME L"TCG2_DEVICE_DETECTION"
#define TCG2_VERSION_NAME L"TCG2_VERSION"
#endif

View file

@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __TCG2_INTERNAL_H__
#define __TCG2_INTERNAL_H__
#pragma once
#define EFI_TCG2_EVENT_LOG_FORMAT_DEFAULT EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2
#define EFI_TCG2_EVENT_LOG_FORMAT_ALL (EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2 | EFI_TCG2_EVENT_LOG_FORMAT_TCG_2)
@ -22,5 +21,3 @@ typedef struct {
GUID TpmInstanceGuid;
UINT8 TpmDevice;
} TPM_INSTANCE_ID;
#endif

View file

@ -7,8 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __TCG2_SMM_H__
#define __TCG2_SMM_H__
#pragma once
#include <PiMm.h>
@ -113,5 +112,3 @@ BOOLEAN
IsTpm20Dtpm (
VOID
);
#endif // __TCG_SMM_H__

View file

@ -7,8 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __TCG_CONFIG_IMPL_H__
#define __TCG_CONFIG_IMPL_H__
#pragma once
#include <Uefi.h>
@ -183,5 +182,3 @@ TcgCallback (
IN EFI_IFR_TYPE_VALUE *Value,
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
);
#endif

View file

@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __TCG_CONFIG_NV_DATA_H__
#define __TCG_CONFIG_NV_DATA_H__
#pragma once
#include <Guid/HiiPlatformSetupFormset.h>
#include <Guid/PhysicalPresenceData.h>
@ -29,5 +28,3 @@ typedef struct {
BOOLEAN TpmEnable;
BOOLEAN TpmActivate;
} TCG_CONFIGURATION;
#endif

View file

@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __TCG_SMM_H__
#define __TCG_SMM_H__
#pragma once
#include <PiDxe.h>
#include <IndustryStandard/Acpi.h>
@ -95,5 +94,3 @@ typedef struct {
//
#define MOR_REQUEST_SUCCESS 0
#define MOR_REQUEST_GENERAL_FAILURE 1
#endif // __TCG_SMM_H__

View file

@ -5,8 +5,7 @@
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef MOCK_PLATFORM_PK_PROTECTION_LIB_H_
#define MOCK_PLATFORM_PK_PROTECTION_LIB_H_
#pragma once
#include <Library/GoogleTestLib.h>
#include <Library/FunctionMockLib.h>
@ -24,5 +23,3 @@ struct MockPlatformPKProtectionLib {
()
);
};
#endif

View file

@ -7,8 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __SECUREBOOT_CONFIG_IMPL_H__
#define __SECUREBOOT_CONFIG_IMPL_H__
#pragma once
#include <Uefi.h>
@ -608,5 +607,3 @@ EFIAPI
UpdateDBTFromFile (
IN EFI_DEVICE_PATH_PROTOCOL *FilePath
);
#endif

View file

@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __SECUREBOOT_CONFIG_NV_DATA_H__
#define __SECUREBOOT_CONFIG_NV_DATA_H__
#pragma once
#include <Guid/HiiPlatformSetupFormset.h>
#include <Guid/SecureBootConfigHii.h>
@ -138,5 +137,3 @@ typedef struct {
UINT32 ListCount; // The count of signature list.
UINT32 CheckedDataCount; // The count of checked signature data.
} SECUREBOOT_CONFIGURATION;
#endif