/** @file\r
Measure TrEE required variable.\r
\r
-Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2013 - 2017, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
{EFI_KEY_EXCHANGE_KEY_NAME, &gEfiGlobalVariableGuid},\r
{EFI_IMAGE_SECURITY_DATABASE, &gEfiImageSecurityDatabaseGuid},\r
{EFI_IMAGE_SECURITY_DATABASE1, &gEfiImageSecurityDatabaseGuid},\r
+ {EFI_IMAGE_SECURITY_DATABASE2, &gEfiImageSecurityDatabaseGuid},\r
};\r
\r
+//\r
+// "SecureBoot" may update following PK Del/Add\r
+// Cache its value to detect value update\r
+//\r
+UINT8 *mSecureBootVarData = NULL;\r
+UINTN mSecureBootVarDataSize = 0;\r
+\r
/**\r
This function will return if this variable is SecureBootPolicy Variable.\r
\r
FreePool (VariableData);\r
}\r
\r
+ //\r
+ // "SecureBoot" is 8bit & read-only. It can only be changed according to PK update\r
+ //\r
+ if ((StrCmp (VariableName, EFI_PLATFORM_KEY_NAME) == 0) &&\r
+ CompareGuid (VendorGuid, &gEfiGlobalVariableGuid)) {\r
+ Status = InternalGetVariable (\r
+ EFI_SECURE_BOOT_MODE_NAME,\r
+ &gEfiGlobalVariableGuid,\r
+ &VariableData,\r
+ &VariableDataSize\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return;\r
+ }\r
+\r
+ //\r
+ // If PK update is successful. "SecureBoot" shall always exist ever since variable write service is ready\r
+ //\r
+ ASSERT(mSecureBootVarData != NULL);\r
+\r
+ if (CompareMem(mSecureBootVarData, VariableData, VariableDataSize) != 0) {\r
+ FreePool(mSecureBootVarData);\r
+ mSecureBootVarData = VariableData;\r
+ mSecureBootVarDataSize = VariableDataSize;\r
+\r
+ DEBUG((DEBUG_INFO, "%s variable updated according to PK change. Remeasure the value!\n", EFI_SECURE_BOOT_MODE_NAME));\r
+ Status = MeasureVariable (\r
+ EFI_SECURE_BOOT_MODE_NAME,\r
+ &gEfiGlobalVariableGuid,\r
+ mSecureBootVarData,\r
+ mSecureBootVarDataSize\r
+ );\r
+ DEBUG ((DEBUG_INFO, "MeasureBootPolicyVariable - %r\n", Status));\r
+ } else {\r
+ //\r
+ // "SecureBoot" variable is not changed\r
+ //\r
+ FreePool(VariableData);\r
+ }\r
+ }\r
+\r
return ;\r
}\r
+\r
+/**\r
+ Some Secure Boot Policy Variable may update following other variable changes(SecureBoot follows PK change, etc).\r
+ Record their initial State when variable write service is ready.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+RecordSecureBootPolicyVarData(\r
+ VOID\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+\r
+ //\r
+ // Record initial "SecureBoot" variable value.\r
+ // It is used to detect SecureBoot variable change in SecureBootHook.\r
+ //\r
+ Status = InternalGetVariable (\r
+ EFI_SECURE_BOOT_MODE_NAME,\r
+ &gEfiGlobalVariableGuid,\r
+ (VOID **)&mSecureBootVarData,\r
+ &mSecureBootVarDataSize\r
+ );\r
+ if (EFI_ERROR(Status)) {\r
+ //\r
+ // Read could fail when Auth Variable solution is not supported\r
+ //\r
+ DEBUG((DEBUG_INFO, "RecordSecureBootPolicyVarData GetVariable %s Status %x\n", EFI_SECURE_BOOT_MODE_NAME, Status));\r
+ }\r
+}\r
and volatile storage space and install variable architecture protocol.\r
\r
Copyright (C) 2013, Red Hat, Inc.\r
-Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
VarCheckVariablePropertySet,\r
VarCheckVariablePropertyGet };\r
\r
+/**\r
+ Some Secure Boot Policy Variable may update following other variable changes(SecureBoot follows PK change, etc).\r
+ Record their initial State when variable write service is ready.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+RecordSecureBootPolicyVarData(\r
+ VOID\r
+ );\r
+\r
/**\r
Return TRUE if ExitBootServices () has been called.\r
\r
DEBUG ((DEBUG_ERROR, "Variable write service initialization failed. Status = %r\n", Status));\r
}\r
\r
+ //\r
+ // Some Secure Boot Policy Var (SecureBoot, etc) updates following other\r
+ // Secure Boot Policy Variable change. Record their initial value.\r
+ //\r
+ RecordSecureBootPolicyVarData();\r
+\r
//\r
// Install the Variable Write Architectural protocol.\r
//\r
# This external input must be validated carefully to avoid security issues such as\r
# buffer overflow or integer overflow.\r
#\r
-# Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
# which accompanies this distribution. The full text of the license may be found at\r
## SOMETIMES_PRODUCES ## Variable:L"PlatformLang"\r
## SOMETIMES_CONSUMES ## Variable:L"Lang"\r
## SOMETIMES_PRODUCES ## Variable:L"Lang"\r
+ ## SOMETIMES_CONSUMES ## Variable:L"PK"\r
+ ## SOMETIMES_CONSUMES ## Variable:L"KEK"\r
+ ## SOMETIMES_CONSUMES ## Variable:L"SecureBoot"\r
gEfiGlobalVariableGuid\r
\r
gEfiMemoryOverwriteControlDataGuid ## SOMETIMES_CONSUMES ## Variable:L"MemoryOverwriteRequestControl"\r
## SOMETIMES_PRODUCES ## Variable:L"VarErrorFlag"\r
gEdkiiVarErrorFlagGuid\r
\r
- ## SOMETIMES_CONSUMES ## Variable:L"DB"\r
- ## SOMETIMES_CONSUMES ## Variable:L"DBX"\r
+ ## SOMETIMES_CONSUMES ## Variable:L"db"\r
+ ## SOMETIMES_CONSUMES ## Variable:L"dbx"\r
+ ## SOMETIMES_CONSUMES ## Variable:L"dbt"\r
gEfiImageSecurityDatabaseGuid\r
\r
[Pcd]\r
\r
InitCommunicateBuffer() is really function to check the variable data size.\r
\r
-Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
IN EFI_GUID *VendorGuid\r
);\r
\r
+/**\r
+ Some Secure Boot Policy Variable may update following other variable changes(SecureBoot follows PK change, etc).\r
+ Record their initial State when variable write service is ready.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+RecordSecureBootPolicyVarData(\r
+ VOID\r
+ );\r
+\r
/**\r
Acquires lock only at boot time. Simply returns at runtime.\r
\r
return;\r
}\r
\r
+ //\r
+ // Some Secure Boot Policy Var (SecureBoot, etc) updates following other\r
+ // Secure Boot Policy Variable change. Record their initial value.\r
+ //\r
+ RecordSecureBootPolicyVarData();\r
+\r
Status = gBS->InstallProtocolInterface (\r
&mHandle,\r
&gEfiVariableWriteArchProtocolGuid,\r
# may not be modified without authorization. If platform fails to protect these resources,\r
# the authentication service provided in this driver will be broken, and the behavior is undefined.\r
#\r
-# Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
# which accompanies this distribution. The full text of the license may be found at\r
## SOMETIMES_CONSUMES ## Variable:L"SecureBoot"\r
gEfiGlobalVariableGuid\r
\r
- ## SOMETIMES_CONSUMES ## Variable:L"DB"\r
- ## SOMETIMES_CONSUMES ## Variable:L"DBX"\r
+ ## SOMETIMES_CONSUMES ## Variable:L"db"\r
+ ## SOMETIMES_CONSUMES ## Variable:L"dbx"\r
+ ## SOMETIMES_CONSUMES ## Variable:L"dbt"\r
gEfiImageSecurityDatabaseGuid\r
\r
[Depex]\r