SecurityPkg: Clean up source files
1. Do not use tab characters 2. No trailing white space in one line 3. All files must end with CRLF Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
@@ -2,13 +2,13 @@
|
||||
Implement authentication services for the authenticated variable
|
||||
service in UEFI2.2.
|
||||
|
||||
Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
@@ -61,13 +61,13 @@ AutenticatedVariableServiceInitialize (
|
||||
mVariableModuleGlobal->HashContext[Physical] = AllocateRuntimePool (CtxSize);
|
||||
ASSERT (mVariableModuleGlobal->HashContext[Physical] != NULL);
|
||||
//
|
||||
// Check "AuthVarKeyDatabase" variable's existence.
|
||||
// If it doesn't exist, create a new one with initial value of 0 and EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS set.
|
||||
// Check "AuthVarKeyDatabase" variable's existence.
|
||||
// If it doesn't exist, create a new one with initial value of 0 and EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS set.
|
||||
//
|
||||
Status = FindVariable (
|
||||
mVariableModuleGlobal->VariableName[Physical][VAR_AUTH_KEY_DB],
|
||||
&gEfiAuthenticatedVariableGuid,
|
||||
&Variable,
|
||||
mVariableModuleGlobal->VariableName[Physical][VAR_AUTH_KEY_DB],
|
||||
&gEfiAuthenticatedVariableGuid,
|
||||
&Variable,
|
||||
&mVariableModuleGlobal->VariableGlobal[Physical],
|
||||
mVariableModuleGlobal->FvbInstance
|
||||
);
|
||||
@@ -96,10 +96,10 @@ AutenticatedVariableServiceInitialize (
|
||||
// Load database in global variable for cache.
|
||||
//
|
||||
Valid = IsValidVariableHeader (
|
||||
Variable.CurrPtr,
|
||||
Variable.Volatile,
|
||||
&mVariableModuleGlobal->VariableGlobal[Physical],
|
||||
mVariableModuleGlobal->FvbInstance,
|
||||
Variable.CurrPtr,
|
||||
Variable.Volatile,
|
||||
&mVariableModuleGlobal->VariableGlobal[Physical],
|
||||
mVariableModuleGlobal->FvbInstance,
|
||||
&VariableHeader
|
||||
);
|
||||
ASSERT (Valid);
|
||||
@@ -117,23 +117,23 @@ AutenticatedVariableServiceInitialize (
|
||||
mPubKeyNumber = (UINT32) (DataSize / EFI_CERT_TYPE_RSA2048_SIZE);
|
||||
}
|
||||
//
|
||||
// Check "SetupMode" variable's existence.
|
||||
// Check "SetupMode" variable's existence.
|
||||
// If it doesn't exist, check PK database's existence to determine the value.
|
||||
// Then create a new one with EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS set.
|
||||
// Then create a new one with EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS set.
|
||||
//
|
||||
Status = FindVariable (
|
||||
mVariableModuleGlobal->VariableName[Physical][VAR_SETUP_MODE],
|
||||
&gEfiGlobalVariableGuid,
|
||||
&Variable,
|
||||
mVariableModuleGlobal->VariableName[Physical][VAR_SETUP_MODE],
|
||||
&gEfiGlobalVariableGuid,
|
||||
&Variable,
|
||||
&mVariableModuleGlobal->VariableGlobal[Physical],
|
||||
mVariableModuleGlobal->FvbInstance
|
||||
);
|
||||
|
||||
if (Variable.CurrPtr == 0x0) {
|
||||
Status = FindVariable (
|
||||
mVariableModuleGlobal->VariableName[Physical][VAR_PLATFORM_KEY],
|
||||
&gEfiGlobalVariableGuid,
|
||||
&Variable,
|
||||
mVariableModuleGlobal->VariableName[Physical][VAR_PLATFORM_KEY],
|
||||
&gEfiGlobalVariableGuid,
|
||||
&Variable,
|
||||
&mVariableModuleGlobal->VariableGlobal[Physical],
|
||||
mVariableModuleGlobal->FvbInstance
|
||||
);
|
||||
@@ -169,13 +169,13 @@ AutenticatedVariableServiceInitialize (
|
||||
);
|
||||
}
|
||||
//
|
||||
// Check "SignatureSupport" variable's existence.
|
||||
// If it doesn't exist, then create a new one with EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS set.
|
||||
// Check "SignatureSupport" variable's existence.
|
||||
// If it doesn't exist, then create a new one with EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS set.
|
||||
//
|
||||
Status = FindVariable (
|
||||
EFI_SIGNATURE_SUPPORT_NAME,
|
||||
&gEfiGlobalVariableGuid,
|
||||
&Variable,
|
||||
EFI_SIGNATURE_SUPPORT_NAME,
|
||||
&gEfiGlobalVariableGuid,
|
||||
&Variable,
|
||||
&mVariableModuleGlobal->VariableGlobal[Physical],
|
||||
mVariableModuleGlobal->FvbInstance
|
||||
);
|
||||
@@ -364,7 +364,7 @@ VerifyDataPayload (
|
||||
//
|
||||
Rsa = RsaNew ();
|
||||
ASSERT (Rsa != NULL);
|
||||
//
|
||||
//
|
||||
// Set RSA Key Components.
|
||||
// NOTE: Only N and E are needed to be set as RSA public key for signature verification.
|
||||
//
|
||||
@@ -380,10 +380,10 @@ VerifyDataPayload (
|
||||
// Verify the signature.
|
||||
//
|
||||
Status = RsaPkcs1Verify (
|
||||
Rsa,
|
||||
Digest,
|
||||
SHA256_DIGEST_SIZE,
|
||||
CertBlock->Signature,
|
||||
Rsa,
|
||||
Digest,
|
||||
SHA256_DIGEST_SIZE,
|
||||
CertBlock->Signature,
|
||||
EFI_CERT_TYPE_RSA2048_SHA256_SIZE
|
||||
);
|
||||
|
||||
@@ -419,9 +419,9 @@ UpdatePlatformMode (
|
||||
UINT32 VarAttr;
|
||||
|
||||
Status = FindVariable (
|
||||
Global->VariableName[VirtualMode][VAR_SETUP_MODE],
|
||||
Global->GlobalVariableGuid[VirtualMode],
|
||||
&Variable,
|
||||
Global->VariableName[VirtualMode][VAR_SETUP_MODE],
|
||||
Global->GlobalVariableGuid[VirtualMode],
|
||||
&Variable,
|
||||
&Global->VariableGlobal[VirtualMode],
|
||||
Global->FvbInstance
|
||||
);
|
||||
@@ -459,8 +459,8 @@ UpdatePlatformMode (
|
||||
@param[in] IsPk Indicates whether to process pk.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_SECURITY_VIOLATION The variable does NOT pass the validation
|
||||
check carried out by the firmware.
|
||||
@retval EFI_SECURITY_VIOLATION The variable does NOT pass the validation
|
||||
check carried out by the firmware.
|
||||
@retval EFI_SUCCESS The variable passed validation successfully.
|
||||
|
||||
**/
|
||||
@@ -507,10 +507,10 @@ ProcessVarWithPk (
|
||||
|
||||
if (Variable->CurrPtr != 0x0) {
|
||||
Valid = IsValidVariableHeader (
|
||||
Variable->CurrPtr,
|
||||
Variable->Volatile,
|
||||
&Global->VariableGlobal[VirtualMode],
|
||||
Global->FvbInstance,
|
||||
Variable->CurrPtr,
|
||||
Variable->Volatile,
|
||||
&Global->VariableGlobal[VirtualMode],
|
||||
Global->FvbInstance,
|
||||
&VariableHeader
|
||||
);
|
||||
ASSERT (Valid);
|
||||
@@ -526,9 +526,9 @@ ProcessVarWithPk (
|
||||
// Get platform key from variable.
|
||||
//
|
||||
Status = FindVariable (
|
||||
Global->VariableName[VirtualMode][VAR_PLATFORM_KEY],
|
||||
Global->GlobalVariableGuid[VirtualMode],
|
||||
&PkVariable,
|
||||
Global->VariableName[VirtualMode][VAR_PLATFORM_KEY],
|
||||
Global->GlobalVariableGuid[VirtualMode],
|
||||
&PkVariable,
|
||||
&Global->VariableGlobal[VirtualMode],
|
||||
Global->FvbInstance
|
||||
);
|
||||
@@ -548,14 +548,14 @@ ProcessVarWithPk (
|
||||
Status = VerifyDataPayload (VirtualMode, Global, Data, DataSize, OldPkData->SignatureData);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = UpdateVariable (
|
||||
VariableName,
|
||||
VendorGuid,
|
||||
(UINT8*)Data + AUTHINFO_SIZE,
|
||||
DataSize - AUTHINFO_SIZE,
|
||||
Attributes,
|
||||
0,
|
||||
CertData->MonotonicCount,
|
||||
VirtualMode,
|
||||
VariableName,
|
||||
VendorGuid,
|
||||
(UINT8*)Data + AUTHINFO_SIZE,
|
||||
DataSize - AUTHINFO_SIZE,
|
||||
Attributes,
|
||||
0,
|
||||
CertData->MonotonicCount,
|
||||
VirtualMode,
|
||||
Global,
|
||||
Variable
|
||||
);
|
||||
@@ -596,8 +596,8 @@ ProcessVarWithPk (
|
||||
@param[in] Attributes The attribute value of the variable.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_SECURITY_VIOLATION The variable did NOT pass the validation
|
||||
check carried out by the firmware.
|
||||
@retval EFI_SECURITY_VIOLATION The variable did NOT pass the validation
|
||||
check carried out by the firmware.
|
||||
@retval EFI_SUCCESS The variable passed validation successfully.
|
||||
|
||||
**/
|
||||
@@ -640,10 +640,10 @@ ProcessVarWithKek (
|
||||
CertBlock = (EFI_CERT_BLOCK_RSA_2048_SHA256 *) (CertData->AuthInfo.CertData);
|
||||
if (Variable->CurrPtr != 0x0) {
|
||||
Valid = IsValidVariableHeader (
|
||||
Variable->CurrPtr,
|
||||
Variable->Volatile,
|
||||
&Global->VariableGlobal[VirtualMode],
|
||||
Global->FvbInstance,
|
||||
Variable->CurrPtr,
|
||||
Variable->Volatile,
|
||||
&Global->VariableGlobal[VirtualMode],
|
||||
Global->FvbInstance,
|
||||
&VariableHeader
|
||||
);
|
||||
ASSERT (Valid);
|
||||
@@ -659,9 +659,9 @@ ProcessVarWithKek (
|
||||
// Get KEK database from variable.
|
||||
//
|
||||
Status = FindVariable (
|
||||
Global->VariableName[VirtualMode][VAR_KEY_EXCHANGE_KEY],
|
||||
Global->GlobalVariableGuid[VirtualMode],
|
||||
&KekVariable,
|
||||
Global->VariableName[VirtualMode][VAR_KEY_EXCHANGE_KEY],
|
||||
Global->GlobalVariableGuid[VirtualMode],
|
||||
&KekVariable,
|
||||
&Global->VariableGlobal[VirtualMode],
|
||||
Global->FvbInstance
|
||||
);
|
||||
@@ -698,13 +698,13 @@ ProcessVarWithKek (
|
||||
Status = VerifyDataPayload (VirtualMode, Global, Data, DataSize, CertBlock->PublicKey);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = UpdateVariable (
|
||||
VariableName,
|
||||
VendorGuid,
|
||||
(UINT8*)Data + AUTHINFO_SIZE,
|
||||
DataSize - AUTHINFO_SIZE,
|
||||
Attributes,
|
||||
0,
|
||||
CertData->MonotonicCount,
|
||||
VariableName,
|
||||
VendorGuid,
|
||||
(UINT8*)Data + AUTHINFO_SIZE,
|
||||
DataSize - AUTHINFO_SIZE,
|
||||
Attributes,
|
||||
0,
|
||||
CertData->MonotonicCount,
|
||||
VirtualMode,
|
||||
Global,
|
||||
Variable
|
||||
@@ -715,13 +715,13 @@ ProcessVarWithKek (
|
||||
// If in setup mode, no authentication needed.
|
||||
//
|
||||
Status = UpdateVariable (
|
||||
VariableName,
|
||||
VendorGuid,
|
||||
Data,
|
||||
DataSize,
|
||||
Attributes,
|
||||
0,
|
||||
0,
|
||||
VariableName,
|
||||
VendorGuid,
|
||||
Data,
|
||||
DataSize,
|
||||
Attributes,
|
||||
0,
|
||||
0,
|
||||
VirtualMode,
|
||||
Global,
|
||||
Variable
|
||||
@@ -748,8 +748,8 @@ ProcessVarWithKek (
|
||||
@retval EFI_WRITE_PROTECTED The variable is write-protected and needs authentication with
|
||||
EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS set.
|
||||
@retval EFI_SECURITY_VIOLATION The variable is with EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS
|
||||
set, but the AuthInfo does NOT pass the validation
|
||||
check carried out by the firmware.
|
||||
set, but the AuthInfo does NOT pass the validation
|
||||
check carried out by the firmware.
|
||||
@retval EFI_SUCCESS The variable is not write-protected, or passed validation successfully.
|
||||
|
||||
**/
|
||||
@@ -789,10 +789,10 @@ VerifyVariable (
|
||||
ZeroMem (&VariableHeader, sizeof (AUTHENTICATED_VARIABLE_HEADER));
|
||||
if (Variable->CurrPtr != 0x0) {
|
||||
Valid = IsValidVariableHeader (
|
||||
Variable->CurrPtr,
|
||||
Variable->Volatile,
|
||||
&Global->VariableGlobal[VirtualMode],
|
||||
Global->FvbInstance,
|
||||
Variable->CurrPtr,
|
||||
Variable->Volatile,
|
||||
&Global->VariableGlobal[VirtualMode],
|
||||
Global->FvbInstance,
|
||||
&VariableHeader
|
||||
);
|
||||
ASSERT (Valid);
|
||||
@@ -820,7 +820,7 @@ VerifyVariable (
|
||||
*KeyIndex = VariableHeader.PubKeyIndex;
|
||||
IsFirstTime = FALSE;
|
||||
}
|
||||
} else if (Valid && (VariableHeader.Attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) != 0) {
|
||||
} else if (Valid && (VariableHeader.Attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) != 0) {
|
||||
//
|
||||
// If the variable is already write-protected, it always needs authentication before update.
|
||||
//
|
||||
@@ -864,7 +864,7 @@ VerifyVariable (
|
||||
//
|
||||
return EFI_SECURITY_VIOLATION;
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// Verify the certificate in Data payload.
|
||||
//
|
||||
|
@@ -2,13 +2,13 @@
|
||||
The internal header file includes the common header files, defines
|
||||
internal structure and functions used by AuthService module.
|
||||
|
||||
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
@@ -46,8 +46,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
@retval EFI_WRITE_PROTECTED The variable is write-protected and needs authentication with
|
||||
EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS set.
|
||||
@retval EFI_SECURITY_VIOLATION The variable is with EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS
|
||||
set, but the AuthInfo does NOT pass the validation
|
||||
check carried out by the firmware.
|
||||
set, but the AuthInfo does NOT pass the validation
|
||||
check carried out by the firmware.
|
||||
@retval EFI_SUCCESS The variable is not write-protected, or passed validation successfully.
|
||||
|
||||
**/
|
||||
@@ -99,8 +99,8 @@ CryptLibraryInitialize (
|
||||
@param[in] IsPk Indicates whether to process pk.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_SECURITY_VIOLATION The variable does NOT pass the validation
|
||||
check carried out by the firmware.
|
||||
@retval EFI_SECURITY_VIOLATION The variable does NOT pass the validation
|
||||
check carried out by the firmware.
|
||||
@retval EFI_SUCCESS The variable passed validation successfully.
|
||||
|
||||
**/
|
||||
@@ -131,8 +131,8 @@ ProcessVarWithPk (
|
||||
@param[in] Attributes The attribute value of the variable.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_SECURITY_VIOLATION The variable does NOT pass the validation
|
||||
check carried out by the firmware.
|
||||
@retval EFI_SECURITY_VIOLATION The variable does NOT pass the validation
|
||||
check carried out by the firmware.
|
||||
@retval EFI_SUCCESS The variable passed validation successfully.
|
||||
|
||||
**/
|
||||
|
@@ -4,7 +4,7 @@
|
||||
# This module installs variable arch protocol and variable write arch protocol to provide
|
||||
# four EFI_RUNTIME_SERVICES: SetVariable, GetVariable, GetNextVariableName and QueryVariableInfo.
|
||||
#
|
||||
# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -29,7 +29,7 @@
|
||||
#
|
||||
# VALID_ARCHITECTURES = IPF
|
||||
#
|
||||
# VIRTUAL_ADDRESS_MAP_CALLBACK = VariableClassAddressChangeEvent
|
||||
# VIRTUAL_ADDRESS_MAP_CALLBACK = VariableClassAddressChangeEvent
|
||||
#
|
||||
|
||||
[Sources.common]
|
||||
@@ -73,13 +73,13 @@
|
||||
## CONSUMES ## Variable:L"SignatureSupport"
|
||||
## PRODUCES ## Variable:L"SignatureSupport"
|
||||
gEfiGlobalVariableGuid
|
||||
|
||||
|
||||
## PRODUCES ## GUID # Variable store header
|
||||
## CONSUMES ## GUID # Variable store header
|
||||
## SOMETIMES_CONSUMES ## HOB
|
||||
## SOMETIMES_PRODUCES ## SystemTable
|
||||
gEfiAuthenticatedVariableGuid
|
||||
|
||||
|
||||
gEfiEventVirtualAddressChangeGuid ## CONSUMES ## Event
|
||||
gEfiCertRsa2048Sha256Guid ## CONSUMES ## GUID # Unique ID for the format of the CertType.
|
||||
|
||||
@@ -94,12 +94,12 @@
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize ## CONSUMES
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize ## CONSUMES
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdHwErrStorageSize ## CONSUMES
|
||||
|
||||
|
||||
[FeaturePcd.common]
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdVariableCollectStatistics ## CONSUMES # statistic the information of variable.
|
||||
|
||||
[Depex]
|
||||
gEfiExtendedSalFvBlockServicesProtocolGuid AND gEfiFaultTolerantWriteProtocolGuid
|
||||
gEfiExtendedSalFvBlockServicesProtocolGuid AND gEfiFaultTolerantWriteProtocolGuid
|
||||
|
||||
[UserExtensions.TianoCore."ExtraFiles"]
|
||||
EsalVariableDxeSalExtra.uni
|
||||
EsalVariableDxeSalExtra.uni
|
||||
|
@@ -1,7 +1,7 @@
|
||||
// /** @file
|
||||
// EsalVariableDxeSal Localized Strings and Content
|
||||
//
|
||||
// Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
// Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
//
|
||||
// This program and the accompanying materials
|
||||
// are licensed and made available under the terms and conditions of the BSD License
|
||||
@@ -12,8 +12,8 @@
|
||||
//
|
||||
// **/
|
||||
|
||||
#string STR_PROPERTIES_MODULE_NAME
|
||||
#language en-US
|
||||
#string STR_PROPERTIES_MODULE_NAME
|
||||
#language en-US
|
||||
"Esal Authenticated Variable DXE"
|
||||
|
||||
|
||||
|
@@ -1,13 +1,13 @@
|
||||
/** @file
|
||||
Entrypoint of Extended SAL variable service module.
|
||||
|
||||
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
@@ -55,7 +55,7 @@ EsalVariableCommonEntry (
|
||||
)
|
||||
{
|
||||
SAL_RETURN_REGS ReturnVal;
|
||||
|
||||
|
||||
ReturnVal.r9 = 0;
|
||||
ReturnVal.r10 = 0;
|
||||
ReturnVal.r11 = 0;
|
||||
|
@@ -2,13 +2,13 @@
|
||||
Handles non-volatile variable store garbage collection, using FTW
|
||||
(Fault Tolerant Write) protocol.
|
||||
|
||||
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
@@ -1,13 +1,13 @@
|
||||
/** @file
|
||||
The implementation of Extended SAL variable services.
|
||||
|
||||
Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
@@ -162,7 +162,7 @@ AccessVariableStore (
|
||||
if ((StartAddress + DataSize) > ((UINTN) ((UINT8 *) VolatileBase + VolatileBase->Size))) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// For volatile variable, a simple memory copy is enough.
|
||||
//
|
||||
@@ -181,13 +181,13 @@ AccessVariableStore (
|
||||
Status = (EFI_STATUS) EsalCall (
|
||||
EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO,
|
||||
EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_HI,
|
||||
GetPhysicalAddressFunctionId,
|
||||
Instance,
|
||||
(UINT64) &FvVolHdr,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
GetPhysicalAddressFunctionId,
|
||||
Instance,
|
||||
(UINT64) &FvVolHdr,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
).Status;
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
@@ -199,7 +199,7 @@ AccessVariableStore (
|
||||
if ((StartAddress + DataSize) > ((EFI_PHYSICAL_ADDRESS) (UINTN) ((CHAR8 *)VariableStoreHeader + VariableStoreHeader->Size))) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
LinearOffset = (UINTN) FwVolHeader;
|
||||
CurrWritePtr = StartAddress;
|
||||
CurrWriteSize = DataSize;
|
||||
@@ -227,26 +227,26 @@ AccessVariableStore (
|
||||
Status = (EFI_STATUS) EsalCall (
|
||||
EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO,
|
||||
EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_HI,
|
||||
WriteFunctionId,
|
||||
Instance,
|
||||
LbaNumber,
|
||||
(CurrWritePtr - LinearOffset),
|
||||
(UINT64) &CurrWriteSize,
|
||||
(UINT64) CurrBuffer,
|
||||
0,
|
||||
WriteFunctionId,
|
||||
Instance,
|
||||
LbaNumber,
|
||||
(CurrWritePtr - LinearOffset),
|
||||
(UINT64) &CurrWriteSize,
|
||||
(UINT64) CurrBuffer,
|
||||
0,
|
||||
0
|
||||
).Status;
|
||||
} else {
|
||||
Status = (EFI_STATUS) EsalCall (
|
||||
EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO,
|
||||
EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_HI,
|
||||
ReadFunctionId,
|
||||
Instance,
|
||||
LbaNumber,
|
||||
(CurrWritePtr - LinearOffset),
|
||||
(UINT64) &CurrWriteSize,
|
||||
(UINT64) CurrBuffer,
|
||||
0,
|
||||
ReadFunctionId,
|
||||
Instance,
|
||||
LbaNumber,
|
||||
(CurrWritePtr - LinearOffset),
|
||||
(UINT64) &CurrWriteSize,
|
||||
(UINT64) CurrBuffer,
|
||||
0,
|
||||
0
|
||||
).Status;
|
||||
}
|
||||
@@ -260,26 +260,26 @@ AccessVariableStore (
|
||||
Status = (EFI_STATUS) EsalCall (
|
||||
EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO,
|
||||
EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_HI,
|
||||
WriteFunctionId,
|
||||
Instance,
|
||||
LbaNumber,
|
||||
(CurrWritePtr - LinearOffset),
|
||||
(UINT64) &Size,
|
||||
(UINT64) CurrBuffer,
|
||||
0,
|
||||
WriteFunctionId,
|
||||
Instance,
|
||||
LbaNumber,
|
||||
(CurrWritePtr - LinearOffset),
|
||||
(UINT64) &Size,
|
||||
(UINT64) CurrBuffer,
|
||||
0,
|
||||
0
|
||||
).Status;
|
||||
} else {
|
||||
Status = (EFI_STATUS) EsalCall (
|
||||
EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO,
|
||||
EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_HI,
|
||||
ReadFunctionId,
|
||||
Instance,
|
||||
LbaNumber,
|
||||
(CurrWritePtr - LinearOffset),
|
||||
(UINT64) &Size,
|
||||
(UINT64) CurrBuffer,
|
||||
0,
|
||||
ReadFunctionId,
|
||||
Instance,
|
||||
LbaNumber,
|
||||
(CurrWritePtr - LinearOffset),
|
||||
(UINT64) &Size,
|
||||
(UINT64) CurrBuffer,
|
||||
0,
|
||||
0
|
||||
).Status;
|
||||
}
|
||||
@@ -332,7 +332,7 @@ GetVarStoreHeader (
|
||||
Instance,
|
||||
VarStoreAddress,
|
||||
sizeof (VARIABLE_STORE_HEADER),
|
||||
VarStoreHeader
|
||||
VarStoreHeader
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
@@ -372,7 +372,7 @@ IsValidVariableHeader (
|
||||
Instance,
|
||||
VariableAddress,
|
||||
sizeof (AUTHENTICATED_VARIABLE_HEADER),
|
||||
&LocalVariableHeader
|
||||
&LocalVariableHeader
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status) || LocalVariableHeader.StartId != VARIABLE_DATA) {
|
||||
@@ -520,7 +520,7 @@ GetVariableNamePtr (
|
||||
Instance,
|
||||
Address,
|
||||
VariableHeader.NameSize,
|
||||
VariableName
|
||||
VariableName
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
@@ -571,7 +571,7 @@ GetVariableDataPtr (
|
||||
Instance,
|
||||
Address,
|
||||
VariableHeader.DataSize,
|
||||
VariableData
|
||||
VariableData
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
@@ -626,7 +626,7 @@ GetNextVariablePtr (
|
||||
/**
|
||||
Gets the pointer to the first variable header in given variable store area.
|
||||
|
||||
This function gets the pointer to the first variable header in given variable
|
||||
This function gets the pointer to the first variable header in given variable
|
||||
store area. The variable store area is given by its start address.
|
||||
|
||||
@param[in] VarStoreHeaderAddress Pointer to the header of variable store area.
|
||||
@@ -675,7 +675,7 @@ GetEndPointer (
|
||||
Instance,
|
||||
VarStoreHeaderAddress,
|
||||
sizeof (VARIABLE_STORE_HEADER),
|
||||
&VariableStoreHeader
|
||||
&VariableStoreHeader
|
||||
);
|
||||
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
@@ -685,12 +685,12 @@ GetEndPointer (
|
||||
/**
|
||||
Updates variable info entry in EFI system table for statistical information.
|
||||
|
||||
Routine used to track statistical information about variable usage.
|
||||
Routine used to track statistical information about variable usage.
|
||||
The data is stored in the EFI system table so it can be accessed later.
|
||||
VariableInfo.efi can dump out the table. Only Boot Services variable
|
||||
VariableInfo.efi can dump out the table. Only Boot Services variable
|
||||
accesses are tracked by this code. The PcdVariableCollectStatistics
|
||||
build flag controls if this feature is enabled.
|
||||
A read that hits in the cache will have Read and Cache true for
|
||||
build flag controls if this feature is enabled.
|
||||
A read that hits in the cache will have Read and Cache true for
|
||||
the transaction. Data is allocated by this routine, but never
|
||||
freed.
|
||||
|
||||
@@ -742,7 +742,7 @@ UpdateVariableInfo (
|
||||
gBS->InstallConfigurationTable (&gEfiAuthenticatedVariableGuid, gVariableInfo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (Entry = gVariableInfo; Entry != NULL; Entry = Entry->Next) {
|
||||
if (CompareGuid (VendorGuid, &Entry->VendorGuid)) {
|
||||
if (StrCmp (VariableName, Entry->Name) == 0) {
|
||||
@@ -826,7 +826,7 @@ UpdateVariableCache (
|
||||
//
|
||||
for (Index = 0, Entry = mVariableCache; Index < sizeof (mVariableCache)/sizeof (VARIABLE_CACHE_ENTRY); Index++, Entry++) {
|
||||
if (CompareGuid (VendorGuid, Entry->Guid)) {
|
||||
if (StrCmp (VariableName, Entry->Name) == 0) {
|
||||
if (StrCmp (VariableName, Entry->Name) == 0) {
|
||||
Entry->Attributes = Attributes;
|
||||
if (DataSize == 0) {
|
||||
//
|
||||
@@ -928,7 +928,7 @@ FindVariableInCache (
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
@@ -1003,7 +1003,7 @@ FindVariable (
|
||||
Volatile = FALSE;
|
||||
}
|
||||
while (IsValidVariableHeader (Variable[Index], Volatile, Global, Instance, &VariableHeader)) {
|
||||
if (VariableHeader.State == VAR_ADDED ||
|
||||
if (VariableHeader.State == VAR_ADDED ||
|
||||
VariableHeader.State == (VAR_IN_DELETED_TRANSITION & VAR_ADDED)
|
||||
) {
|
||||
if (!EfiAtRuntime () || ((VariableHeader.Attributes & EFI_VARIABLE_RUNTIME_ACCESS) != 0)) {
|
||||
@@ -1162,7 +1162,7 @@ Reclaim (
|
||||
//
|
||||
// Collect VAR_ADDED variables, and variables in delete transition status.
|
||||
//
|
||||
if (VariableHeader.State == VAR_ADDED ||
|
||||
if (VariableHeader.State == VAR_ADDED ||
|
||||
VariableHeader.State == (VAR_IN_DELETED_TRANSITION & VAR_ADDED)
|
||||
) {
|
||||
VariableSize = NextVariable - Variable;
|
||||
@@ -1173,9 +1173,9 @@ Reclaim (
|
||||
}
|
||||
|
||||
//
|
||||
// Reserve the 1 Bytes with Oxff to identify the
|
||||
// end of the variable buffer.
|
||||
//
|
||||
// Reserve the 1 Bytes with Oxff to identify the
|
||||
// end of the variable buffer.
|
||||
//
|
||||
MaximumBufferSize += 1;
|
||||
ValidBuffer = AllocatePool (MaximumBufferSize);
|
||||
if (ValidBuffer == NULL) {
|
||||
@@ -1192,7 +1192,7 @@ Reclaim (
|
||||
|
||||
//
|
||||
// Reinstall all ADDED variables
|
||||
//
|
||||
//
|
||||
Variable = GetStartPointer (VariableBase);
|
||||
while (IsValidVariableHeader (Variable, IsVolatile, VariableGlobal, Instance, &VariableHeader)) {
|
||||
NextVariable = GetNextVariablePtr (Variable, IsVolatile, VariableGlobal, Instance);
|
||||
@@ -1210,17 +1210,17 @@ Reclaim (
|
||||
}
|
||||
//
|
||||
// Reinstall in delete transition variables
|
||||
//
|
||||
//
|
||||
Variable = GetStartPointer (VariableBase);
|
||||
while (IsValidVariableHeader (Variable, IsVolatile, VariableGlobal, Instance, &VariableHeader)) {
|
||||
NextVariable = GetNextVariablePtr (Variable, IsVolatile, VariableGlobal, Instance);
|
||||
if (VariableHeader.State == (VAR_IN_DELETED_TRANSITION & VAR_ADDED)) {
|
||||
|
||||
//
|
||||
// Buffer has cached all ADDED variable.
|
||||
// Buffer has cached all ADDED variable.
|
||||
// Per IN_DELETED variable, we have to guarantee that
|
||||
// no ADDED one in previous buffer.
|
||||
//
|
||||
// no ADDED one in previous buffer.
|
||||
//
|
||||
FoundAdded = FALSE;
|
||||
AddedVariable = GetStartPointer ((EFI_PHYSICAL_ADDRESS) ValidBuffer);
|
||||
while (IsValidVariableHeader (AddedVariable, IsVolatile, VariableGlobal, Instance, &AddedVariableHeader)) {
|
||||
@@ -1327,7 +1327,7 @@ GetIndexFromSupportedLangCodes(
|
||||
IN CHAR8 *SupportedLang,
|
||||
IN CHAR8 *Lang,
|
||||
IN BOOLEAN Iso639Language
|
||||
)
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
UINTN CompareLength;
|
||||
@@ -1362,8 +1362,8 @@ GetIndexFromSupportedLangCodes(
|
||||
// Determine the length of the next language code in SupportedLang
|
||||
//
|
||||
for (CompareLength = 0; SupportedLang[CompareLength] != '\0' && SupportedLang[CompareLength] != ';'; CompareLength++);
|
||||
|
||||
if ((CompareLength == LanguageLength) &&
|
||||
|
||||
if ((CompareLength == LanguageLength) &&
|
||||
(AsciiStrnCmp (Lang, SupportedLang, CompareLength) == 0)) {
|
||||
//
|
||||
// Successfully find the index of Lang string in SupportedLang string.
|
||||
@@ -1465,10 +1465,10 @@ GetLangFromSupportedLangCodes (
|
||||
}
|
||||
|
||||
/**
|
||||
Returns a pointer to an allocated buffer that contains the best matching language
|
||||
from a set of supported languages.
|
||||
|
||||
This function supports both ISO 639-2 and RFC 4646 language codes, but language
|
||||
Returns a pointer to an allocated buffer that contains the best matching language
|
||||
from a set of supported languages.
|
||||
|
||||
This function supports both ISO 639-2 and RFC 4646 language codes, but language
|
||||
code types may not be mixed in a single call to this function. This function
|
||||
supports a variable argument list that allows the caller to pass in a prioritized
|
||||
list of language codes to test against all the language codes in SupportedLanguages.
|
||||
@@ -1476,37 +1476,37 @@ GetLangFromSupportedLangCodes (
|
||||
If SupportedLanguages is NULL, then ASSERT().
|
||||
|
||||
@param[in] SupportedLanguages A pointer to a Null-terminated ASCII string that
|
||||
contains a set of language codes in the format
|
||||
contains a set of language codes in the format
|
||||
specified by Iso639Language.
|
||||
@param[in] Iso639Language If TRUE, then all language codes are assumed to be
|
||||
in ISO 639-2 format. If FALSE, then all language
|
||||
codes are assumed to be in RFC 4646 language format.
|
||||
@param[in] VirtualMode Current calling mode for this function.
|
||||
@param[in] ... A variable argument list that contains pointers to
|
||||
@param[in] ... A variable argument list that contains pointers to
|
||||
Null-terminated ASCII strings that contain one or more
|
||||
language codes in the format specified by Iso639Language.
|
||||
The first language code from each of these language
|
||||
code lists is used to determine if it is an exact or
|
||||
close match to any of the language codes in
|
||||
close match to any of the language codes in
|
||||
SupportedLanguages. Close matches only apply to RFC 4646
|
||||
language codes, and the matching algorithm from RFC 4647
|
||||
is used to determine if a close match is present. If
|
||||
is used to determine if a close match is present. If
|
||||
an exact or close match is found, then the matching
|
||||
language code from SupportedLanguages is returned. If
|
||||
no matches are found, then the next variable argument
|
||||
parameter is evaluated. The variable argument list
|
||||
parameter is evaluated. The variable argument list
|
||||
is terminated by a NULL.
|
||||
|
||||
@retval NULL The best matching language could not be found in SupportedLanguages.
|
||||
@retval NULL There are not enough resources available to return the best matching
|
||||
@retval NULL There are not enough resources available to return the best matching
|
||||
language.
|
||||
@retval Other A pointer to a Null-terminated ASCII string that is the best matching
|
||||
@retval Other A pointer to a Null-terminated ASCII string that is the best matching
|
||||
language in SupportedLanguages.
|
||||
|
||||
**/
|
||||
CHAR8 *
|
||||
VariableGetBestLanguage (
|
||||
IN CONST CHAR8 *SupportedLanguages,
|
||||
IN CONST CHAR8 *SupportedLanguages,
|
||||
IN BOOLEAN Iso639Language,
|
||||
IN BOOLEAN VirtualMode,
|
||||
...
|
||||
@@ -1582,7 +1582,7 @@ VariableGetBestLanguage (
|
||||
LanguageLength = 0;
|
||||
} else {
|
||||
//
|
||||
// If RFC 4646 mode, then trim Language from the right to the next '-' character
|
||||
// If RFC 4646 mode, then trim Language from the right to the next '-' character
|
||||
//
|
||||
for (LanguageLength--; LanguageLength > 0 && Language[LanguageLength] != '-'; LanguageLength--);
|
||||
}
|
||||
@@ -1591,7 +1591,7 @@ VariableGetBestLanguage (
|
||||
VA_END (Args);
|
||||
|
||||
//
|
||||
// No matches were found
|
||||
// No matches were found
|
||||
//
|
||||
return NULL;
|
||||
}
|
||||
@@ -1664,7 +1664,7 @@ AutoUpdateLangVariable(
|
||||
ASSERT (Global->PlatformLangCodes[VirtualMode] != NULL);
|
||||
|
||||
//
|
||||
// PlatformLang holds a single language from PlatformLangCodes,
|
||||
// PlatformLang holds a single language from PlatformLangCodes,
|
||||
// so the size of PlatformLangCodes is enough for the PlatformLang.
|
||||
//
|
||||
if (Global->PlatformLang[VirtualMode] != NULL) {
|
||||
@@ -1694,7 +1694,7 @@ AutoUpdateLangVariable(
|
||||
ASSERT (Global->LangCodes[VirtualMode] != NULL);
|
||||
}
|
||||
|
||||
if (SetLanguageCodes
|
||||
if (SetLanguageCodes
|
||||
&& (Global->PlatformLangCodes[VirtualMode] != NULL)
|
||||
&& (Global->LangCodes[VirtualMode] != NULL)) {
|
||||
//
|
||||
@@ -1732,7 +1732,7 @@ AutoUpdateLangVariable(
|
||||
(UINTN) &(((AUTHENTICATED_VARIABLE_HEADER *)Variable.CurrPtr)->DataSize),
|
||||
sizeof (DataSize),
|
||||
&DataSize
|
||||
);
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
|
||||
@@ -1811,15 +1811,15 @@ AutoUpdateLangVariable(
|
||||
FindVariable (PredefinedVariableName[VAR_PLATFORM_LANG], Global->GlobalVariableGuid[VirtualMode], &Variable, VariableGlobal, Instance);
|
||||
|
||||
Status = UpdateVariable (
|
||||
PredefinedVariableName[VAR_PLATFORM_LANG],
|
||||
Global->GlobalVariableGuid[VirtualMode],
|
||||
BestPlatformLang,
|
||||
AsciiStrSize (BestPlatformLang),
|
||||
Attributes,
|
||||
PredefinedVariableName[VAR_PLATFORM_LANG],
|
||||
Global->GlobalVariableGuid[VirtualMode],
|
||||
BestPlatformLang,
|
||||
AsciiStrSize (BestPlatformLang),
|
||||
Attributes,
|
||||
0,
|
||||
0,
|
||||
VirtualMode,
|
||||
Global,
|
||||
VirtualMode,
|
||||
Global,
|
||||
&Variable
|
||||
);
|
||||
|
||||
@@ -1831,7 +1831,7 @@ AutoUpdateLangVariable(
|
||||
}
|
||||
|
||||
/**
|
||||
Update the variable region with Variable information. These are the same
|
||||
Update the variable region with Variable information. These are the same
|
||||
arguments as the EFI Variable services.
|
||||
|
||||
@param[in] VariableName Name of variable.
|
||||
@@ -1840,7 +1840,7 @@ AutoUpdateLangVariable(
|
||||
@param[in] DataSize Size of data. 0 means delete.
|
||||
@param[in] Attributes Attributes of the variable.
|
||||
@param[in] KeyIndex Index of associated public key.
|
||||
@param[in] MonotonicCount Value of associated monotonic count.
|
||||
@param[in] MonotonicCount Value of associated monotonic count.
|
||||
@param[in] VirtualMode Current calling mode for this function.
|
||||
@param[in] Global Context of this Extended SAL Variable Services Class call.
|
||||
@param[in] Variable The variable information which is used to keep track of variable usage.
|
||||
@@ -1856,7 +1856,7 @@ UpdateVariable (
|
||||
IN EFI_GUID *VendorGuid,
|
||||
IN VOID *Data,
|
||||
IN UINTN DataSize,
|
||||
IN UINT32 Attributes OPTIONAL,
|
||||
IN UINT32 Attributes OPTIONAL,
|
||||
IN UINT32 KeyIndex OPTIONAL,
|
||||
IN UINT64 MonotonicCount OPTIONAL,
|
||||
IN BOOLEAN VirtualMode,
|
||||
@@ -1898,11 +1898,11 @@ UpdateVariable (
|
||||
// Update/Delete existing variable
|
||||
//
|
||||
Volatile = Variable->Volatile;
|
||||
|
||||
if (EfiAtRuntime ()) {
|
||||
|
||||
if (EfiAtRuntime ()) {
|
||||
//
|
||||
// If EfiAtRuntime and the variable is Volatile and Runtime Access,
|
||||
// the volatile is ReadOnly, and SetVariable should be aborted and
|
||||
// If EfiAtRuntime and the variable is Volatile and Runtime Access,
|
||||
// the volatile is ReadOnly, and SetVariable should be aborted and
|
||||
// return EFI_WRITE_PROTECTED.
|
||||
//
|
||||
if (Variable->Volatile) {
|
||||
@@ -1914,14 +1914,14 @@ UpdateVariable (
|
||||
//
|
||||
if ((VariableHeader.Attributes & EFI_VARIABLE_NON_VOLATILE) == 0) {
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
goto Done;
|
||||
goto Done;
|
||||
}
|
||||
}
|
||||
//
|
||||
// Setting a data variable with no access, or zero DataSize attributes
|
||||
// specified causes it to be deleted.
|
||||
//
|
||||
if (DataSize == 0 || (Attributes & (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) == 0) {
|
||||
if (DataSize == 0 || (Attributes & (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) == 0) {
|
||||
State = VariableHeader.State;
|
||||
State &= VAR_DELETED;
|
||||
|
||||
@@ -1933,12 +1933,12 @@ UpdateVariable (
|
||||
(UINTN) &(((AUTHENTICATED_VARIABLE_HEADER *)Variable->CurrPtr)->State),
|
||||
sizeof (UINT8),
|
||||
&State
|
||||
);
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
UpdateVariableInfo (VariableName, VendorGuid, Volatile, FALSE, FALSE, TRUE, FALSE);
|
||||
UpdateVariableCache (VariableName, VendorGuid, Attributes, DataSize, Data);
|
||||
}
|
||||
goto Done;
|
||||
goto Done;
|
||||
}
|
||||
//
|
||||
// Logic comes here to update variable.
|
||||
@@ -1971,25 +1971,25 @@ UpdateVariable (
|
||||
(UINTN) &(((AUTHENTICATED_VARIABLE_HEADER *)Variable->CurrPtr)->State),
|
||||
sizeof (UINT8),
|
||||
&State
|
||||
);
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Done;
|
||||
goto Done;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//
|
||||
// Create a new variable
|
||||
//
|
||||
|
||||
//
|
||||
|
||||
//
|
||||
// Make sure we are trying to create a new variable.
|
||||
// Setting a data variable with no access, or zero DataSize attributes means to delete it.
|
||||
// Setting a data variable with no access, or zero DataSize attributes means to delete it.
|
||||
//
|
||||
if (DataSize == 0 || (Attributes & (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) == 0) {
|
||||
Status = EFI_NOT_FOUND;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Only variable have NV|RT attribute can be created in Runtime
|
||||
//
|
||||
@@ -1997,7 +1997,7 @@ UpdateVariable (
|
||||
(((Attributes & EFI_VARIABLE_RUNTIME_ACCESS) == 0) || ((Attributes & EFI_VARIABLE_NON_VOLATILE) == 0))) {
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
goto Done;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -2050,11 +2050,11 @@ UpdateVariable (
|
||||
// Create a nonvolatile variable
|
||||
//
|
||||
Volatile = FALSE;
|
||||
|
||||
|
||||
GetVarStoreHeader (VariableGlobal->NonVolatileVariableBase, FALSE, VariableGlobal, Instance, &VariableStoreHeader);
|
||||
if ((((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) != 0)
|
||||
if ((((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) != 0)
|
||||
&& ((HEADER_ALIGN (VarSize) + Global->HwErrVariableTotalSize) > PcdGet32(PcdHwErrStorageSize)))
|
||||
|| (((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == 0)
|
||||
|| (((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == 0)
|
||||
&& ((HEADER_ALIGN (VarSize) + Global->CommonVariableTotalSize) > VariableStoreHeader.Size - sizeof (VARIABLE_STORE_HEADER) - PcdGet32(PcdHwErrStorageSize)))) {
|
||||
if (EfiAtRuntime ()) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
@@ -2072,9 +2072,9 @@ UpdateVariable (
|
||||
//
|
||||
// If still no enough space, return out of resources
|
||||
//
|
||||
if ((((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) != 0)
|
||||
if ((((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) != 0)
|
||||
&& ((HEADER_ALIGN (VarSize) + Global->HwErrVariableTotalSize) > PcdGet32(PcdHwErrStorageSize)))
|
||||
|| (((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == 0)
|
||||
|| (((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == 0)
|
||||
&& ((HEADER_ALIGN (VarSize) + Global->CommonVariableTotalSize) > VariableStoreHeader.Size - sizeof (VARIABLE_STORE_HEADER) - PcdGet32(PcdHwErrStorageSize)))) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto Done;
|
||||
@@ -2083,7 +2083,7 @@ UpdateVariable (
|
||||
//
|
||||
// Four steps
|
||||
// 1. Write variable header
|
||||
// 2. Set variable state to header valid
|
||||
// 2. Set variable state to header valid
|
||||
// 3. Write variable data
|
||||
// 4. Set variable state to valid
|
||||
//
|
||||
@@ -2165,7 +2165,7 @@ UpdateVariable (
|
||||
} else {
|
||||
//
|
||||
// Create a volatile variable
|
||||
//
|
||||
//
|
||||
Volatile = TRUE;
|
||||
|
||||
if ((UINT32) (HEADER_ALIGN(VarSize) + Global->VolatileLastVariableOffset) >
|
||||
@@ -2240,22 +2240,22 @@ Done:
|
||||
|
||||
This function implements EsalGetVariable function of Extended SAL Variable Services Class.
|
||||
It is equivalent in functionality to the EFI Runtime Service GetVariable().
|
||||
|
||||
|
||||
@param[in] VariableName A Null-terminated Unicode string that is the name of
|
||||
the vendor's variable.
|
||||
@param[in] VendorGuid A unique identifier for the vendor.
|
||||
@param[out] Attributes If not NULL, a pointer to the memory location to return the
|
||||
@param[out] Attributes If not NULL, a pointer to the memory location to return the
|
||||
attributes bitmask for the variable.
|
||||
@param[in, out] DataSize Size of Data found. If size is less than the
|
||||
data, this value contains the required size.
|
||||
@param[out] Data On input, the size in bytes of the return Data buffer.
|
||||
@param[out] Data On input, the size in bytes of the return Data buffer.
|
||||
On output, the size of data returned in Data.
|
||||
@param[in] VirtualMode Current calling mode for this function.
|
||||
@param[in] Global Context of this Extended SAL Variable Services Class call.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_NOT_FOUND The variable was not found.
|
||||
@retval EFI_BUFFER_TOO_SMALL DataSize is too small for the result. DataSize has
|
||||
@retval EFI_BUFFER_TOO_SMALL DataSize is too small for the result. DataSize has
|
||||
been updated with the size needed to complete the request.
|
||||
@retval EFI_INVALID_PARAMETER VariableName is NULL.
|
||||
@retval EFI_INVALID_PARAMETER VendorGuid is NULL.
|
||||
@@ -2349,7 +2349,7 @@ EsalGetVariable (
|
||||
*DataSize = VarDataSize;
|
||||
UpdateVariableInfo (VariableName, VendorGuid, Variable.Volatile, TRUE, FALSE, FALSE, FALSE);
|
||||
UpdateVariableCache (VariableName, VendorGuid, VariableHeader.Attributes, VarDataSize, Data);
|
||||
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
goto Done;
|
||||
} else {
|
||||
@@ -2371,18 +2371,18 @@ Done:
|
||||
|
||||
This function implements EsalGetNextVariableName function of Extended SAL Variable Services Class.
|
||||
It is equivalent in functionality to the EFI Runtime Service GetNextVariableName().
|
||||
|
||||
|
||||
@param[in, out] VariableNameSize Size of the variable
|
||||
@param[in, out] VariableName On input, supplies the last VariableName that was returned by GetNextVariableName().
|
||||
On output, returns the Null-terminated Unicode string of the current variable.
|
||||
@param[in, out] VendorGuid On input, supplies the last VendorGuid that was returned by GetNextVariableName().
|
||||
On output, returns the VendorGuid of the current variable.
|
||||
On output, returns the VendorGuid of the current variable.
|
||||
@param[in] VirtualMode Current calling mode for this function.
|
||||
@param[in] Global Context of this Extended SAL Variable Services Class call.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_NOT_FOUND The next variable was not found.
|
||||
@retval EFI_BUFFER_TOO_SMALL VariableNameSize is too small for the result.
|
||||
@retval EFI_BUFFER_TOO_SMALL VariableNameSize is too small for the result.
|
||||
VariableNameSize has been updated with the size needed to complete the request.
|
||||
@retval EFI_INVALID_PARAMETER VariableNameSize is NULL.
|
||||
@retval EFI_INVALID_PARAMETER VariableName is NULL.
|
||||
@@ -2512,11 +2512,11 @@ Done:
|
||||
|
||||
This function implements EsalSetVariable function of Extended SAL Variable Services Class.
|
||||
It is equivalent in functionality to the EFI Runtime Service SetVariable().
|
||||
|
||||
|
||||
@param[in] VariableName A Null-terminated Unicode string that is the name of the vendor's
|
||||
variable. Each VariableName is unique for each
|
||||
VendorGuid. VariableName must contain 1 or more
|
||||
Unicode characters. If VariableName is an empty Unicode
|
||||
variable. Each VariableName is unique for each
|
||||
VendorGuid. VariableName must contain 1 or more
|
||||
Unicode characters. If VariableName is an empty Unicode
|
||||
string, then EFI_INVALID_PARAMETER is returned.
|
||||
@param[in] VendorGuid A unique identifier for the vendor.
|
||||
@param[in] Attributes Attributes bitmask to set for the variable.
|
||||
@@ -2526,9 +2526,9 @@ Done:
|
||||
@param[in] VirtualMode Current calling mode for this function.
|
||||
@param[in] Global Context of this Extended SAL Variable Services Class call.
|
||||
|
||||
@retval EFI_SUCCESS The firmware has successfully stored the variable and its data as
|
||||
@retval EFI_SUCCESS The firmware has successfully stored the variable and its data as
|
||||
defined by the Attributes.
|
||||
@retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied, or the
|
||||
@retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied, or the
|
||||
DataSize exceeds the maximum allowed.
|
||||
@retval EFI_INVALID_PARAMETER VariableName is an empty Unicode string.
|
||||
@retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.
|
||||
@@ -2566,7 +2566,7 @@ EsalSetVariable (
|
||||
//
|
||||
if (VariableName == NULL || VariableName[0] == 0 || VendorGuid == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
|
||||
if (DataSize != 0 && Data == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
@@ -2585,17 +2585,17 @@ EsalSetVariable (
|
||||
// Try to write Authencated Variable without AuthInfo
|
||||
//
|
||||
return EFI_SECURITY_VIOLATION;
|
||||
}
|
||||
PayloadSize = DataSize - AUTHINFO_SIZE;
|
||||
}
|
||||
PayloadSize = DataSize - AUTHINFO_SIZE;
|
||||
} else {
|
||||
PayloadSize = DataSize;
|
||||
PayloadSize = DataSize;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ((UINTN)(~0) - PayloadSize < StrSize(VariableName)){
|
||||
//
|
||||
// Prevent whole variable size overflow
|
||||
//
|
||||
// Prevent whole variable size overflow
|
||||
//
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -2625,8 +2625,8 @@ EsalSetVariable (
|
||||
//
|
||||
if (StrSize (VariableName) + PayloadSize > PcdGet32(PcdMaxVariableSize) - sizeof (AUTHENTICATED_VARIABLE_HEADER)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AcquireLockOnlyAtBootTime(&VariableGlobal->VariableServicesLock);
|
||||
|
||||
@@ -2676,31 +2676,31 @@ EsalSetVariable (
|
||||
// Cut the certificate size before set
|
||||
//
|
||||
Status = UpdateVariable (
|
||||
VariableName,
|
||||
VendorGuid,
|
||||
(UINT8*)Data + AUTHINFO_SIZE,
|
||||
DataSize - AUTHINFO_SIZE,
|
||||
Attributes,
|
||||
KeyIndex,
|
||||
MonotonicCount,
|
||||
VirtualMode,
|
||||
Global,
|
||||
VariableName,
|
||||
VendorGuid,
|
||||
(UINT8*)Data + AUTHINFO_SIZE,
|
||||
DataSize - AUTHINFO_SIZE,
|
||||
Attributes,
|
||||
KeyIndex,
|
||||
MonotonicCount,
|
||||
VirtualMode,
|
||||
Global,
|
||||
&Variable
|
||||
);
|
||||
} else {
|
||||
//
|
||||
// Update variable as usual
|
||||
// Update variable as usual
|
||||
//
|
||||
Status = UpdateVariable (
|
||||
VariableName,
|
||||
VendorGuid,
|
||||
Data,
|
||||
DataSize,
|
||||
Attributes,
|
||||
0,
|
||||
0,
|
||||
VirtualMode,
|
||||
Global,
|
||||
VariableName,
|
||||
VendorGuid,
|
||||
Data,
|
||||
DataSize,
|
||||
Attributes,
|
||||
0,
|
||||
0,
|
||||
VirtualMode,
|
||||
Global,
|
||||
&Variable
|
||||
);
|
||||
}
|
||||
@@ -2720,19 +2720,19 @@ EsalSetVariable (
|
||||
|
||||
@param[in] Attributes Attributes bitmask to specify the type of variables
|
||||
on which to return information.
|
||||
@param[out] MaximumVariableStorageSize On output the maximum size of the storage space available for
|
||||
the EFI variables associated with the attributes specified.
|
||||
@param[out] RemainingVariableStorageSize Returns the remaining size of the storage space available for EFI
|
||||
@param[out] MaximumVariableStorageSize On output the maximum size of the storage space available for
|
||||
the EFI variables associated with the attributes specified.
|
||||
@param[out] RemainingVariableStorageSize Returns the remaining size of the storage space available for EFI
|
||||
variables associated with the attributes specified.
|
||||
@param[out] MaximumVariableSize Returns the maximum size of an individual EFI variable
|
||||
@param[out] MaximumVariableSize Returns the maximum size of an individual EFI variable
|
||||
associated with the attributes specified.
|
||||
@param[in] VirtualMode Current calling mode for this function
|
||||
@param[in] Global Context of this Extended SAL Variable Services Class call
|
||||
|
||||
@retval EFI_SUCCESS Valid answer returned.
|
||||
@retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied.
|
||||
@retval EFI_UNSUPPORTED The attribute is not supported on this platform, and the
|
||||
MaximumVariableStorageSize, RemainingVariableStorageSize,
|
||||
@retval EFI_UNSUPPORTED The attribute is not supported on this platform, and the
|
||||
MaximumVariableStorageSize, RemainingVariableStorageSize,
|
||||
MaximumVariableSize are undefined.
|
||||
**/
|
||||
EFI_STATUS
|
||||
@@ -2764,12 +2764,12 @@ EsalQueryVariableInfo (
|
||||
if(MaximumVariableStorageSize == NULL || RemainingVariableStorageSize == NULL || MaximumVariableSize == NULL || Attributes == 0) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
if((Attributes & (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_HARDWARE_ERROR_RECORD)) == 0) {
|
||||
//
|
||||
// Make sure the Attributes combination is supported by the platform.
|
||||
//
|
||||
return EFI_UNSUPPORTED;
|
||||
return EFI_UNSUPPORTED;
|
||||
} else if ((Attributes & (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) == EFI_VARIABLE_RUNTIME_ACCESS) {
|
||||
//
|
||||
// Make sure if runtime bit is set, boot service bit is set also.
|
||||
@@ -2917,20 +2917,20 @@ ReclaimForOS(
|
||||
UINTN RemainingHwErrVariableSpace;
|
||||
|
||||
VarSize = ((VARIABLE_STORE_HEADER *) ((UINTN) mVariableModuleGlobal->VariableGlobal[Physical].NonVolatileVariableBase))->Size;
|
||||
Status = EFI_SUCCESS;
|
||||
Status = EFI_SUCCESS;
|
||||
//
|
||||
//Allowable max size of common variable storage space
|
||||
//
|
||||
CommonVariableSpace = VarSize - sizeof (VARIABLE_STORE_HEADER) - PcdGet32(PcdHwErrStorageSize);
|
||||
|
||||
RemainingCommonVariableSpace = CommonVariableSpace - mVariableModuleGlobal->CommonVariableTotalSize;
|
||||
|
||||
|
||||
RemainingHwErrVariableSpace = PcdGet32 (PcdHwErrStorageSize) - mVariableModuleGlobal->HwErrVariableTotalSize;
|
||||
//
|
||||
// If the free area is below a threshold, then performs reclaim operation.
|
||||
//
|
||||
if ((RemainingCommonVariableSpace < PcdGet32 (PcdMaxVariableSize))
|
||||
|| ((PcdGet32 (PcdHwErrStorageSize) != 0) &&
|
||||
|| ((PcdGet32 (PcdHwErrStorageSize) != 0) &&
|
||||
(RemainingHwErrVariableSpace < PcdGet32 (PcdMaxHardwareErrorVariableSize)))){
|
||||
Status = Reclaim (
|
||||
mVariableModuleGlobal->VariableGlobal[Physical].NonVolatileVariableBase,
|
||||
@@ -3056,7 +3056,7 @@ VariableCommonInitialize (
|
||||
//
|
||||
// Note that in EdkII variable driver implementation, Hardware Error Record type variable
|
||||
// is stored with common variable in the same NV region. So the platform integrator should
|
||||
// ensure that the value of PcdHwErrStorageSize is less than or equal to the value of
|
||||
// ensure that the value of PcdHwErrStorageSize is less than or equal to the value of
|
||||
// PcdFlashNvStorageVariableSize.
|
||||
//
|
||||
ASSERT (PcdGet32(PcdHwErrStorageSize) <= PcdGet32 (PcdFlashNvStorageVariableSize));
|
||||
@@ -3133,13 +3133,13 @@ VariableCommonInitialize (
|
||||
Status = (EFI_STATUS) EsalCall (
|
||||
EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO,
|
||||
EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_HI,
|
||||
GetPhysicalAddressFunctionId,
|
||||
Instance,
|
||||
(UINT64) &FvVolHdr,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
GetPhysicalAddressFunctionId,
|
||||
Instance,
|
||||
(UINT64) &FvVolHdr,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
).Status;
|
||||
if (EFI_ERROR (Status)) {
|
||||
@@ -3237,9 +3237,9 @@ VariableCommonInitialize (
|
||||
// Register the event handling function to reclaim variable for OS usage.
|
||||
//
|
||||
Status = EfiCreateEventReadyToBootEx (
|
||||
TPL_NOTIFY,
|
||||
ReclaimForOS,
|
||||
NULL,
|
||||
TPL_NOTIFY,
|
||||
ReclaimForOS,
|
||||
NULL,
|
||||
&ReadyToBootEvent
|
||||
);
|
||||
} else {
|
||||
|
@@ -1,13 +1,13 @@
|
||||
/** @file
|
||||
Internal header file for Extended SAL variable service module.
|
||||
|
||||
Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
@@ -63,7 +63,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#define AUTHVAR_KEYDB_NAME_SIZE 38
|
||||
|
||||
///
|
||||
/// The maximum size of the public key database, restricted by maximum individal EFI
|
||||
/// The maximum size of the public key database, restricted by maximum individal EFI
|
||||
/// varible size, and excluding the variable header and name size.
|
||||
///
|
||||
#define MAX_KEYDB_SIZE (FixedPcdGet32 (PcdMaxVariableSize) - sizeof (AUTHENTICATED_VARIABLE_HEADER) - AUTHVAR_KEYDB_NAME_SIZE)
|
||||
@@ -191,22 +191,22 @@ VariableClassAddressChangeEvent (
|
||||
|
||||
This function implements EsalGetVariable function of Extended SAL Variable Services Class.
|
||||
It is equivalent in functionality to the EFI Runtime Service GetVariable().
|
||||
|
||||
|
||||
@param[in] VariableName A Null-terminated Unicode string that is the name of
|
||||
the vendor's variable.
|
||||
@param[in] VendorGuid A unique identifier for the vendor.
|
||||
@param[out] Attributes If not NULL, a pointer to the memory location to return the
|
||||
@param[out] Attributes If not NULL, a pointer to the memory location to return the
|
||||
attributes bitmask for the variable.
|
||||
@param[in, out] DataSize Size of Data found. If size is less than the
|
||||
data, this value contains the required size.
|
||||
@param[out] Data On input, the size in bytes of the return Data buffer.
|
||||
@param[out] Data On input, the size in bytes of the return Data buffer.
|
||||
On output, the size of data returned in Data.
|
||||
@param[in] VirtualMode Current calling mode for this function.
|
||||
@param[in] Global Context of this Extended SAL Variable Services Class call.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_NOT_FOUND The variable was not found.
|
||||
@retval EFI_BUFFER_TOO_SMALL DataSize is too small for the result. DataSize has
|
||||
@retval EFI_BUFFER_TOO_SMALL DataSize is too small for the result. DataSize has
|
||||
been updated with the size needed to complete the request.
|
||||
@retval EFI_INVALID_PARAMETER VariableName is NULL.
|
||||
@retval EFI_INVALID_PARAMETER VendorGuid is NULL.
|
||||
@@ -233,18 +233,18 @@ EsalGetVariable (
|
||||
|
||||
This function implements EsalGetNextVariableName function of Extended SAL Variable Services Class.
|
||||
It is equivalent in functionality to the EFI Runtime Service GetNextVariableName().
|
||||
|
||||
|
||||
@param[in, out] VariableNameSize Size of the variable
|
||||
@param[in, out] VariableName On input, supplies the last VariableName that was returned by GetNextVariableName().
|
||||
On output, returns the Null-terminated Unicode string of the current variable.
|
||||
@param[in, out] VendorGuid On input, supplies the last VendorGuid that was returned by GetNextVariableName().
|
||||
On output, returns the VendorGuid of the current variable.
|
||||
On output, returns the VendorGuid of the current variable.
|
||||
@param[in] VirtualMode Current calling mode for this function.
|
||||
@param[in] Global Context of this Extended SAL Variable Services Class call.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_NOT_FOUND The next variable was not found.
|
||||
@retval EFI_BUFFER_TOO_SMALL VariableNameSize is too small for the result.
|
||||
@retval EFI_BUFFER_TOO_SMALL VariableNameSize is too small for the result.
|
||||
VariableNameSize has been updated with the size needed to complete the request.
|
||||
@retval EFI_INVALID_PARAMETER VariableNameSize is NULL.
|
||||
@retval EFI_INVALID_PARAMETER VariableName is NULL.
|
||||
@@ -267,11 +267,11 @@ EsalGetNextVariableName (
|
||||
|
||||
This function implements EsalSetVariable function of Extended SAL Variable Services Class.
|
||||
It is equivalent in functionality to the EFI Runtime Service SetVariable().
|
||||
|
||||
|
||||
@param[in] VariableName A Null-terminated Unicode string that is the name of the vendor's
|
||||
variable. Each VariableName is unique for each
|
||||
VendorGuid. VariableName must contain 1 or more
|
||||
Unicode characters. If VariableName is an empty Unicode
|
||||
variable. Each VariableName is unique for each
|
||||
VendorGuid. VariableName must contain 1 or more
|
||||
Unicode characters. If VariableName is an empty Unicode
|
||||
string, then EFI_INVALID_PARAMETER is returned.
|
||||
@param[in] VendorGuid A unique identifier for the vendor.
|
||||
@param[in] Attributes Attributes bitmask to set for the variable.
|
||||
@@ -281,9 +281,9 @@ EsalGetNextVariableName (
|
||||
@param[in] VirtualMode Current calling mode for this function.
|
||||
@param[in] Global Context of this Extended SAL Variable Services Class call.
|
||||
|
||||
@retval EFI_SUCCESS The firmware has successfully stored the variable and its data as
|
||||
@retval EFI_SUCCESS The firmware has successfully stored the variable and its data as
|
||||
defined by the Attributes.
|
||||
@retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied, or the
|
||||
@retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied, or the
|
||||
DataSize exceeds the maximum allowed.
|
||||
@retval EFI_INVALID_PARAMETER VariableName is an empty Unicode string.
|
||||
@retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.
|
||||
@@ -314,19 +314,19 @@ EsalSetVariable (
|
||||
|
||||
@param[in] Attributes Attributes bitmask to specify the type of variables
|
||||
on which to return information.
|
||||
@param[out] MaximumVariableStorageSize On output the maximum size of the storage space available for
|
||||
the EFI variables associated with the attributes specified.
|
||||
@param[out] RemainingVariableStorageSize Returns the remaining size of the storage space available for EFI
|
||||
@param[out] MaximumVariableStorageSize On output the maximum size of the storage space available for
|
||||
the EFI variables associated with the attributes specified.
|
||||
@param[out] RemainingVariableStorageSize Returns the remaining size of the storage space available for EFI
|
||||
variables associated with the attributes specified.
|
||||
@param[out] MaximumVariableSize Returns the maximum size of an individual EFI variable
|
||||
@param[out] MaximumVariableSize Returns the maximum size of an individual EFI variable
|
||||
associated with the attributes specified.
|
||||
@param[in] VirtualMode Current calling mode for this function
|
||||
@param[in] Global Context of this Extended SAL Variable Services Class call
|
||||
|
||||
@retval EFI_SUCCESS Valid answer returned.
|
||||
@retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied.
|
||||
@retval EFI_UNSUPPORTED The attribute is not supported on this platform, and the
|
||||
MaximumVariableStorageSize, RemainingVariableStorageSize,
|
||||
@retval EFI_UNSUPPORTED The attribute is not supported on this platform, and the
|
||||
MaximumVariableStorageSize, RemainingVariableStorageSize,
|
||||
MaximumVariableSize are undefined.
|
||||
**/
|
||||
EFI_STATUS
|
||||
@@ -436,7 +436,7 @@ DataSizeOfVariable (
|
||||
);
|
||||
|
||||
/**
|
||||
Update the variable region with Variable information. These are the same
|
||||
Update the variable region with Variable information. These are the same
|
||||
arguments as the EFI Variable services.
|
||||
|
||||
@param[in] VariableName Name of variable.
|
||||
@@ -445,7 +445,7 @@ DataSizeOfVariable (
|
||||
@param[in] DataSize Size of data. 0 means delete.
|
||||
@param[in] Attributes Attributes of the variable.
|
||||
@param[in] KeyIndex Index of associated public key.
|
||||
@param[in] MonotonicCount Value of associated monotonic count.
|
||||
@param[in] MonotonicCount Value of associated monotonic count.
|
||||
@param[in] VirtualMode Current calling mode for this function.
|
||||
@param[in] Global Context of this Extended SAL Variable Services Class call.
|
||||
@param[in] Variable The variable information which is used to keep track of variable usage.
|
||||
@@ -461,7 +461,7 @@ UpdateVariable (
|
||||
IN EFI_GUID *VendorGuid,
|
||||
IN VOID *Data,
|
||||
IN UINTN DataSize,
|
||||
IN UINT32 Attributes OPTIONAL,
|
||||
IN UINT32 Attributes OPTIONAL,
|
||||
IN UINT32 KeyIndex OPTIONAL,
|
||||
IN UINT64 MonotonicCount OPTIONAL,
|
||||
IN BOOLEAN VirtualMode,
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
VFR file used by the SecureBoot configuration component.
|
||||
|
||||
Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -608,4 +608,4 @@ formset
|
||||
|
||||
endform;
|
||||
|
||||
endformset;
|
||||
endformset;
|
||||
|
@@ -1,13 +1,13 @@
|
||||
/** @file
|
||||
The module entry point for SecureBoot configuration module.
|
||||
|
||||
Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
@@ -35,7 +35,7 @@ SecureBootConfigDriverEntryPoint (
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
SECUREBOOT_CONFIG_PRIVATE_DATA *PrivateData;
|
||||
|
||||
|
||||
//
|
||||
// If already started, return.
|
||||
//
|
||||
@@ -50,7 +50,7 @@ SecureBootConfigDriverEntryPoint (
|
||||
if (!EFI_ERROR (Status)) {
|
||||
return EFI_ALREADY_STARTED;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Create a private data structure.
|
||||
//
|
||||
@@ -58,7 +58,7 @@ SecureBootConfigDriverEntryPoint (
|
||||
if (PrivateData == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Install SecureBoot configuration form
|
||||
//
|
||||
@@ -69,7 +69,7 @@ SecureBootConfigDriverEntryPoint (
|
||||
|
||||
//
|
||||
// Install private GUID.
|
||||
//
|
||||
//
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&ImageHandle,
|
||||
&gEfiCallerIdGuid,
|
||||
@@ -86,8 +86,8 @@ SecureBootConfigDriverEntryPoint (
|
||||
ErrorExit:
|
||||
if (PrivateData != NULL) {
|
||||
UninstallSecureBootConfigForm (PrivateData);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -113,11 +113,11 @@ SecureBootConfigDriverUnload (
|
||||
ImageHandle,
|
||||
&gEfiCallerIdGuid,
|
||||
(VOID **) &PrivateData
|
||||
);
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
ASSERT (PrivateData->Signature == SECUREBOOT_CONFIG_PRIVATE_DATA_SIGNATURE);
|
||||
|
||||
gBS->UninstallMultipleProtocolInterfaces (
|
||||
@@ -126,7 +126,7 @@ SecureBootConfigDriverUnload (
|
||||
PrivateData,
|
||||
NULL
|
||||
);
|
||||
|
||||
|
||||
UninstallSecureBootConfigForm (PrivateData);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
// /** @file
|
||||
// SecureBootConfigDxe Localized Strings and Content
|
||||
//
|
||||
// Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
// Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
//
|
||||
// This program and the accompanying materials
|
||||
// are licensed and made available under the terms and conditions of the BSD License
|
||||
@@ -12,8 +12,8 @@
|
||||
//
|
||||
// **/
|
||||
|
||||
#string STR_PROPERTIES_MODULE_NAME
|
||||
#language en-US
|
||||
#string STR_PROPERTIES_MODULE_NAME
|
||||
#language en-US
|
||||
"Secure Boot Config DXE"
|
||||
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
HII Config Access protocol implementation of SecureBoot configuration module.
|
||||
|
||||
Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
(C) Copyright 2018 Hewlett Packard Enterprise Development LP<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
@@ -1816,7 +1816,7 @@ LoadPeImage (
|
||||
Calculate hash of Pe/Coff image based on the authenticode image hashing in
|
||||
PE/COFF Specification 8.0 Appendix A
|
||||
|
||||
Notes: PE/COFF image has been checked by BasePeCoffLib PeCoffLoaderGetImageInfo() in
|
||||
Notes: PE/COFF image has been checked by BasePeCoffLib PeCoffLoaderGetImageInfo() in
|
||||
the function LoadPeImage ().
|
||||
|
||||
@param[in] HashAlg Hash algorithm type.
|
||||
@@ -3327,12 +3327,12 @@ SecureBootExtractConfigFromVariable (
|
||||
}
|
||||
|
||||
//
|
||||
// Check SecureBootEnable & Pk status, fix the inconsistence.
|
||||
// Check SecureBootEnable & Pk status, fix the inconsistence.
|
||||
// If the SecureBootEnable Variable doesn't exist, hide the SecureBoot Enable/Disable
|
||||
// Checkbox.
|
||||
//
|
||||
ConfigData->AttemptSecureBoot = FALSE;
|
||||
GetVariable2 (EFI_SECURE_BOOT_ENABLE_NAME, &gEfiSecureBootEnableDisableGuid, (VOID**)&SecureBootEnable, NULL);
|
||||
GetVariable2 (EFI_SECURE_BOOT_ENABLE_NAME, &gEfiSecureBootEnableDisableGuid, (VOID**)&SecureBootEnable, NULL);
|
||||
|
||||
//
|
||||
// Fix Pk, SecureBootEnable inconsistence
|
||||
@@ -4385,7 +4385,7 @@ SecureBootCallback (
|
||||
Value->u8 = SECURE_BOOT_MODE_STANDARD;
|
||||
Status = EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Helper functions for SecureBoot configuration module.
|
||||
|
||||
Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -15,15 +15,15 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#include "SecureBootConfigImpl.h"
|
||||
|
||||
/**
|
||||
Read file content into BufferPtr, the size of the allocate buffer
|
||||
Read file content into BufferPtr, the size of the allocate buffer
|
||||
is *FileSize plus AddtionAllocateSize.
|
||||
|
||||
@param[in] FileHandle The file to be read.
|
||||
@param[in, out] BufferPtr Pointers to the pointer of allocated buffer.
|
||||
@param[out] FileSize Size of input file
|
||||
@param[in] AddtionAllocateSize Addtion size the buffer need to be allocated.
|
||||
@param[in] AddtionAllocateSize Addtion size the buffer need to be allocated.
|
||||
In case the buffer need to contain others besides the file content.
|
||||
|
||||
|
||||
@retval EFI_SUCCESS The file was read into the buffer.
|
||||
@retval EFI_INVALID_PARAMETER A parameter was invalid.
|
||||
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
|
||||
@@ -62,7 +62,7 @@ ReadFileContent (
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto ON_EXIT;
|
||||
}
|
||||
|
||||
|
||||
Status = FileHandle->SetPosition (FileHandle, 0);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto ON_EXIT;
|
||||
@@ -86,7 +86,7 @@ ReadFileContent (
|
||||
}
|
||||
|
||||
ON_EXIT:
|
||||
|
||||
|
||||
*BufferPtr = Buffer;
|
||||
return Status;
|
||||
}
|
||||
@@ -95,7 +95,7 @@ ON_EXIT:
|
||||
Close an open file handle.
|
||||
|
||||
@param[in] FileHandle The file handle to close.
|
||||
|
||||
|
||||
**/
|
||||
VOID
|
||||
CloseFile (
|
||||
@@ -103,7 +103,7 @@ CloseFile (
|
||||
)
|
||||
{
|
||||
if (FileHandle != NULL) {
|
||||
FileHandle->Close (FileHandle);
|
||||
FileHandle->Close (FileHandle);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ CloseFile (
|
||||
|
||||
@param[in] Integer Pointer to the nonnegative integer to be converted
|
||||
@param[in] IntSizeInWords Length of integer buffer in words
|
||||
@param[out] OctetString Converted octet string of the specified length
|
||||
@param[out] OctetString Converted octet string of the specified length
|
||||
@param[in] OSSizeInBytes Intended length of resulting octet string in bytes
|
||||
|
||||
Returns:
|
||||
@@ -138,17 +138,17 @@ Int2OctStr (
|
||||
Ptr1++, Ptr2--) {
|
||||
*Ptr2 = *Ptr1;
|
||||
}
|
||||
|
||||
|
||||
for (; Ptr1 < (CONST UINT8 *)(Integer + IntSizeInWords) && *Ptr1 == 0; Ptr1++);
|
||||
|
||||
|
||||
if (Ptr1 < (CONST UINT8 *)(Integer + IntSizeInWords)) {
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
|
||||
if (Ptr2 >= OctetString) {
|
||||
ZeroMem (OctetString, Ptr2 - OctetString + 1);
|
||||
}
|
||||
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ Int2OctStr (
|
||||
@param[in] Guid Pointer to GUID to print.
|
||||
@param[in] Buffer Buffer to print Guid into.
|
||||
@param[in] BufferSize Size of Buffer.
|
||||
|
||||
|
||||
@retval Number of characters printed.
|
||||
|
||||
**/
|
||||
@@ -173,9 +173,9 @@ GuidToString (
|
||||
|
||||
Size = UnicodeSPrint (
|
||||
Buffer,
|
||||
BufferSize,
|
||||
BufferSize,
|
||||
L"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
|
||||
(UINTN)Guid->Data1,
|
||||
(UINTN)Guid->Data1,
|
||||
(UINTN)Guid->Data2,
|
||||
(UINTN)Guid->Data3,
|
||||
(UINTN)Guid->Data4[0],
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
String definitions for Secure Boot Configuration form.
|
||||
|
||||
Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -98,7 +98,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#string STR_SECURE_BOOT_ENROLL_PK_FILE #language en-US "Enroll PK Using File"
|
||||
|
||||
#string STR_DELETE_PK #language en-US "Delete Pk"
|
||||
#string STR_DELETE_PK_HELP #language en-US "Choose to Delete PK, Otherwise keep the PK"
|
||||
#string STR_DELETE_PK_HELP #language en-US "Choose to Delete PK, Otherwise keep the PK"
|
||||
|
||||
#string STR_ENROLL_PK_TITLE #language en-US "Enroll PK"
|
||||
|
||||
@@ -106,7 +106,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#string STR_ENROLL_KEK_HELP #language en-US "Enter into Enroll KEK Form"
|
||||
|
||||
#string STR_DELETE_KEK #language en-US "Delete KEK"
|
||||
#string STR_DELETE_KEK_HELP #language en-US "Enter into Delete KEK Form"
|
||||
#string STR_DELETE_KEK_HELP #language en-US "Enter into Delete KEK Form"
|
||||
|
||||
#string STR_ENROLL_KEK_TITLE #language en-US "Enroll KEK"
|
||||
#string STR_DELETE_KEK_TITLE #language en-US "Delete KEK"
|
||||
|
Reference in New Issue
Block a user