Skip to content

Commit

Permalink
Fix format to pass the EDKII CI
Browse files Browse the repository at this point in the history
Signed-off-by: Wenxing Hou <[email protected]>
  • Loading branch information
Wenxing-hou authored and jyao1 committed Feb 20, 2024
1 parent 59ab214 commit 73a4204
Show file tree
Hide file tree
Showing 43 changed files with 297 additions and 206 deletions.
32 changes: 16 additions & 16 deletions MdeModulePkg/Universal/Variable/RuntimeDxe/Measurement.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ typedef struct {
} VARIABLE_TYPE;

VARIABLE_TYPE mVariableType[] = {
{ EFI_SECURE_BOOT_MODE_NAME, &gEfiGlobalVariableGuid },
{ EFI_PLATFORM_KEY_NAME, &gEfiGlobalVariableGuid },
{ EFI_KEY_EXCHANGE_KEY_NAME, &gEfiGlobalVariableGuid },
{ EFI_IMAGE_SECURITY_DATABASE, &gEfiImageSecurityDatabaseGuid },
{ EFI_IMAGE_SECURITY_DATABASE1, &gEfiImageSecurityDatabaseGuid },
{ EFI_IMAGE_SECURITY_DATABASE2, &gEfiImageSecurityDatabaseGuid },
{ EFI_SECURE_BOOT_MODE_NAME, &gEfiGlobalVariableGuid },
{ EFI_PLATFORM_KEY_NAME, &gEfiGlobalVariableGuid },
{ EFI_KEY_EXCHANGE_KEY_NAME, &gEfiGlobalVariableGuid },
{ EFI_IMAGE_SECURITY_DATABASE, &gEfiImageSecurityDatabaseGuid },
{ EFI_IMAGE_SECURITY_DATABASE1, &gEfiImageSecurityDatabaseGuid },
{ EFI_IMAGE_SECURITY_DATABASE2, &gEfiImageSecurityDatabaseGuid },
{ EFI_DEVICE_SECURITY_DATABASE, &gEfiDeviceSignatureDatabaseGuid },
};

Expand Down Expand Up @@ -126,18 +126,17 @@ MeasureVariable (
}

if (CompareGuid (VendorGuid, &gEfiDeviceSignatureDatabaseGuid)) {

DEBUG ((DEBUG_INFO, "VariableDxe: MeasureVariable (Pcr - %x, EventType - %x, ", PCR_INDEX_FOR_SIGNATURE_DB, (UINTN)EV_EFI_SPDM_DEVICE_POLICY));
DEBUG ((DEBUG_INFO, "VariableName - %s, VendorGuid - %g)\n", VarName, VendorGuid));

Status = TpmMeasureAndLogData (
PCR_INDEX_FOR_SIGNATURE_DB,
EV_EFI_SPDM_DEVICE_POLICY,
VarLog,
VarLogSize,
VarLog,
VarLogSize
);
PCR_INDEX_FOR_SIGNATURE_DB,
EV_EFI_SPDM_DEVICE_POLICY,
VarLog,
VarLogSize,
VarLog,
VarLogSize
);
FreePool (VarLog);
return Status;
}
Expand Down Expand Up @@ -249,8 +248,9 @@ SecureBootHook (

if (CompareGuid (VendorGuid, &gEfiDeviceSignatureDatabaseGuid)) {
if ((PcdGet32 (PcdTcgPfpMeasurementRevision) < TCG_EfiSpecIDEventStruct_SPEC_ERRATA_TPM2_REV_106) ||
(PcdGet8(PcdEnableSpdmDeviceAuthenticaion) == 0)) {
return ;
(PcdGet8 (PcdEnableSpdmDeviceAuthenticaion) == 0))
{
return;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@
gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable ## SOMETIMES_CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved ## SOMETIMES_CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdTcgPfpMeasurementRevision ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdEnableSpdmDeviceAuthenticaion ## PRODUCES AND CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdEnableSpdmDeviceAuthenticaion ## PRODUCES AND CONSUMES

[FeaturePcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdVariableCollectStatistics ## CONSUMES # statistic the information of variable.
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangDeprecate ## CONSUMES # Auto update PlatformLang/Lang
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
[Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdAllowVariablePolicyEnforcementDisable ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdTcgPfpMeasurementRevision ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdEnableSpdmDeviceAuthenticaion ## PRODUCES AND CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdEnableSpdmDeviceAuthenticaion ## PRODUCES AND CONSUMES

[Guids]
## PRODUCES ## GUID # Signature of Variable store header
Expand Down
2 changes: 1 addition & 1 deletion MdePkg/Include/Guid/DeviceAuthentication.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @file
Guid & data structure used for Device Security.
Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2024, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
Expand Down
2 changes: 1 addition & 1 deletion MdePkg/Include/Guid/GlobalVariable.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @file
GUID for EFI (NVRAM) Variables.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2006 - 2024, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@par Revision Reference:
Expand Down
6 changes: 3 additions & 3 deletions MdePkg/Include/Guid/ImageAuthentication.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @file
Image signature database are defined for the signed image validation.
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2009 - 2024, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@par Revision Reference:
Expand Down Expand Up @@ -41,8 +41,8 @@
#define SETUP_MODE 1
#define USER_MODE 0

#define DEVICE_AUTH_BOOT_MODE_ENABLE 1
#define DEVICE_AUTH_BOOT_MODE_DISABLE 0
#define DEVICE_AUTH_BOOT_MODE_ENABLE 1
#define DEVICE_AUTH_BOOT_MODE_DISABLE 0

// ***********************************************************************
// Signature Database
Expand Down
2 changes: 1 addition & 1 deletion MdePkg/Include/IndustryStandard/UefiTcgPlatform.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
TCG EFI Platform Definition in TCG_EFI_Platform_1_20_Final and
TCG PC Client Platform Firmware Profile Specification, Revision 1.06
Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2006 - 2024, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
Expand Down
3 changes: 2 additions & 1 deletion MdePkg/MdePkg.ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# CI configuration for MdePkg
#
# Copyright (c) Microsoft Corporation
# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2020 - 2024, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2021, Arm Limited. All rights reserved.<BR>
# Copyright (c) 2023, Loongson Technology Corporation Limited. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
Expand Down Expand Up @@ -67,6 +67,7 @@
"Include/IndustryStandard/Tpm20.h",
"Include/IndustryStandard/IoRemappingTable.h",
"Include/IndustryStandard/UefiTcgPlatform.h",
"Include/IndustryStandard/Spdm.h",
"Include/Library/PcdLib.h",
"Include/Library/SafeIntLib.h",
"Include/Protocol/DebugSupport.h",
Expand Down
4 changes: 2 additions & 2 deletions MdePkg/MdePkg.dec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# It also provides the definitions(including PPIs/PROTOCOLs/GUIDs) of
# EFI1.10/UEFI2.7/PI1.7 and some Industry Standards.
#
# Copyright (c) 2007 - 2022, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2007 - 2024, Intel Corporation. All rights reserved.<BR>
# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
# (C) Copyright 2016 - 2021 Hewlett Packard Enterprise Development LP<BR>
# Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
Expand Down Expand Up @@ -743,7 +743,7 @@
#
## GUID used to specify section with devdb content
## Include/Guid/DeviceAuthentication.h
gEfiDeviceSignatureDatabaseGuid = {0xb9c2b4f4, 0xbf5f, 0x462d, {0x8a, 0xdf, 0xc5, 0xc7, 0xa, 0xc3, 0x5d, 0xad}}
gEfiDeviceSignatureDatabaseGuid = { 0xb9c2b4f4, 0xbf5f, 0x462d, {0x8a, 0xdf, 0xc5, 0xc7, 0xa, 0xc3, 0x5d, 0xad }}

#
# GUID defined in PI1.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
EDKII Device Security library for SPDM device.
It follows the SPDM Specification.
Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2024, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
Expand Down Expand Up @@ -473,16 +473,22 @@ libspdm_rsa_get_public_key_from_x509 (
return RsaGetPublicKeyFromX509 (cert, cert_size, rsa_context);
}

bool libspdm_ec_get_public_key_from_der(const uint8_t *der_data,
size_t der_size,
void **ec_context)
bool
libspdm_ec_get_public_key_from_der (
const uint8_t *der_data,
size_t der_size,
void **ec_context
)
{
return false;
}

bool libspdm_rsa_get_public_key_from_der(const uint8_t *der_data,
size_t der_size,
void **rsa_context)
bool
libspdm_rsa_get_public_key_from_der (
const uint8_t *der_data,
size_t der_size,
void **rsa_context
)
{
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
EDKII Device Security library for SPDM device.
It follows the SPDM Specification.
Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2024, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
EDKII Device Security library for SPDM device.
It follows the SPDM Specification.
Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2024, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
Expand Down
6 changes: 3 additions & 3 deletions SecurityPkg/DeviceSecurity/SpdmLib/Include/Stub/SpdmLibStub.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @file
Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2024, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
Expand Down Expand Up @@ -259,12 +259,12 @@ typedef enum {
// Other component is busy.
//
SpdmResponseStateBusy,
#if LIBSPDM_RESPOND_IF_READY_SUPPORT
#if LIBSPDM_RESPOND_IF_READY_SUPPORT
//
// Hardware is not ready.
//
SpdmResponseStateNotReady,
#endif /* LIBSPDM_RESPOND_IF_READY_SUPPORT */
#endif /* LIBSPDM_RESPOND_IF_READY_SUPPORT */
//
// Firmware Update is done. Need resync.
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@
* License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md
**/

/** @file
EDKII Device Security library for SPDM device.
It follows the SPDM Specification.
Copyright (c) 2024, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/

#ifndef LIBSPDM_STDBOOL_ALT_H
#define LIBSPDM_STDBOOL_ALT_H

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@
* License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md
**/

/** @file
EDKII Device Security library for SPDM device.
It follows the SPDM Specification.
Copyright (c) 2024, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/

#ifndef LIBSPDM_STD_DEF_ALT_H
#define LIBSPDM_STD_DEF_ALT_H

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@
* License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md
**/

/** @file
EDKII Device Security library for SPDM device.
It follows the SPDM Specification.
Copyright (c) 2024, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/

#ifndef LIBSPDM_STD_INT_ALT_H
#define LIBSPDM_STD_INT_ALT_H

Expand Down
33 changes: 21 additions & 12 deletions SecurityPkg/DeviceSecurity/SpdmLib/Include/hal/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@
* License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md
**/

/** @file
EDKII Device Security library for SPDM device.
It follows the SPDM Specification.
Copyright (c) 2024, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/

#ifndef BASE_H
#define BASE_H

Expand All @@ -13,7 +22,7 @@

#ifndef LIBSPDM_STDINT_ALT

#include <stdint.h>
#include <stdint.h>

/* LIBSPDM_OPENSSL_STDINT_WORKAROUND */

Expand All @@ -40,25 +49,25 @@
/* In the future libspdm intends to use the Windows native compilation flags and defines,
* in place of the UEFI profile / personality. */

#ifdef LIBSPDM_OPENSSL_STDINT_WORKAROUND
#undef _WIN32
#undef _WIN64
#endif
#ifdef LIBSPDM_OPENSSL_STDINT_WORKAROUND
#undef _WIN32
#undef _WIN64
#endif

#else /* LIBSPDM_STDINT_ALT */
#include LIBSPDM_STDINT_ALT
#include LIBSPDM_STDINT_ALT
#endif /* LIBSPDM_STDINT_ALT */

#ifndef LIBSPDM_STDBOOL_ALT
#include <stdbool.h>
#include <stdbool.h>
#else
#include LIBSPDM_STDBOOL_ALT
#include LIBSPDM_STDBOOL_ALT
#endif

#ifndef LIBSPDM_STDDEF_ALT
#include <stddef.h>
#include <stddef.h>
#else
#include LIBSPDM_STDDEF_ALT
#include LIBSPDM_STDDEF_ALT
#endif

/**
Expand All @@ -73,7 +82,7 @@
* @return Minimum of two operands.
*
**/
#define LIBSPDM_MIN(a, b) (((a) < (b)) ? (a) : (b))
#define LIBSPDM_MIN(a, b) (((a) < (b)) ? (a) : (b))

/**
* Return the number of elements in an array.
Expand All @@ -86,6 +95,6 @@
* @return The number of elements in Array. The result has type size_t.
*
**/
#define LIBSPDM_ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
#define LIBSPDM_ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))

#endif /* BASE_H */
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@
License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md
**/

/** @file
EDKII Device Security library for SPDM device.
It follows the SPDM Specification.
Copyright (c) 2024, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/

/** @file
Provides services to print debug and assert messages to a debug output device.
Expand Down Expand Up @@ -31,6 +40,6 @@
#define LIBSPDM_DEBUG_CODE_BEGIN DEBUG_CODE_BEGIN
#define LIBSPDM_DEBUG_CODE_END DEBUG_CODE_END

#define LIBSPDM_DEBUG_CODE DEBUG_CODE
#define LIBSPDM_DEBUG_CODE DEBUG_CODE

#endif /* DEBUG_LIB_H */
Loading

0 comments on commit 73a4204

Please sign in to comment.