mirror of https://github.com/acidanthera/audk.git
Update ConfigAcess Protocol which is produced by SecureBootConfigDxe to follow the UEFI SPEC (Handle the Request parameter is NULL in ExtractConfig interface).
Signed-off-by: qianouyang Reviewed-by: ydong10 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12707 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
9cc86267ce
commit
bc0c99b3df
|
@ -2,12 +2,12 @@
|
||||||
HII Config Access protocol implementation of SecureBoot configuration module.
|
HII Config Access protocol implementation of SecureBoot configuration module.
|
||||||
|
|
||||||
Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
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.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -40,7 +40,7 @@ HII_VENDOR_DEVICE_PATH mSecureBootHiiVendorDevicePath = {
|
||||||
{
|
{
|
||||||
END_DEVICE_PATH_TYPE,
|
END_DEVICE_PATH_TYPE,
|
||||||
END_ENTIRE_DEVICE_PATH_SUBTYPE,
|
END_ENTIRE_DEVICE_PATH_SUBTYPE,
|
||||||
{
|
{
|
||||||
(UINT8) (END_DEVICE_PATH_LENGTH),
|
(UINT8) (END_DEVICE_PATH_LENGTH),
|
||||||
(UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)
|
(UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)
|
||||||
}
|
}
|
||||||
|
@ -62,12 +62,12 @@ SaveSecureBootVariable (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
Status = gRT->SetVariable (
|
Status = gRT->SetVariable (
|
||||||
EFI_SECURE_BOOT_ENABLE_NAME,
|
EFI_SECURE_BOOT_ENABLE_NAME,
|
||||||
&gEfiSecureBootEnableDisableGuid,
|
&gEfiSecureBootEnableDisableGuid,
|
||||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||||
sizeof (UINT8),
|
sizeof (UINT8),
|
||||||
&VarValue
|
&VarValue
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
|
@ -114,25 +114,36 @@ SecureBootExtractConfig (
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINTN BufferSize;
|
UINTN BufferSize;
|
||||||
|
UINTN Size;
|
||||||
SECUREBOOT_CONFIGURATION Configuration;
|
SECUREBOOT_CONFIGURATION Configuration;
|
||||||
|
|
||||||
EFI_STRING ConfigRequest;
|
EFI_STRING ConfigRequest;
|
||||||
|
EFI_STRING ConfigRequestHdr;
|
||||||
UINT8 *SecureBootEnable;
|
UINT8 *SecureBootEnable;
|
||||||
|
SECUREBOOT_CONFIG_PRIVATE_DATA *PrivateData;
|
||||||
|
BOOLEAN AllocatedRequest;
|
||||||
|
|
||||||
if (Progress == NULL || Results == NULL) {
|
if (Progress == NULL || Results == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
AllocatedRequest = FALSE;
|
||||||
*Progress = Request;
|
ConfigRequestHdr = NULL;
|
||||||
|
ConfigRequest = NULL;
|
||||||
|
Size = 0;
|
||||||
|
|
||||||
|
PrivateData = SECUREBOOT_CONFIG_PRIVATE_FROM_THIS (This);
|
||||||
|
*Progress = Request;
|
||||||
|
|
||||||
if ((Request != NULL) && !HiiIsConfigHdrMatch (Request, &gSecureBootConfigFormSetGuid, mSecureBootStorageName)) {
|
if ((Request != NULL) && !HiiIsConfigHdrMatch (Request, &gSecureBootConfigFormSetGuid, mSecureBootStorageName)) {
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the SecureBoot Variable
|
// Get the SecureBoot Variable
|
||||||
//
|
//
|
||||||
SecureBootEnable = GetVariable (EFI_SECURE_BOOT_ENABLE_NAME, &gEfiSecureBootEnableDisableGuid);
|
SecureBootEnable = GetVariable (EFI_SECURE_BOOT_ENABLE_NAME, &gEfiSecureBootEnableDisableGuid);
|
||||||
|
|
||||||
//
|
//
|
||||||
// If the SecureBoot Variable doesn't exist, hide the SecureBoot Enable/Disable
|
// If the SecureBoot Variable doesn't exist, hide the SecureBoot Enable/Disable
|
||||||
// Checkbox.
|
// Checkbox.
|
||||||
|
@ -144,8 +155,26 @@ SecureBootExtractConfig (
|
||||||
Configuration.SecureBootState = *SecureBootEnable;
|
Configuration.SecureBootState = *SecureBootEnable;
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferSize = sizeof (Configuration);
|
BufferSize = sizeof (SECUREBOOT_CONFIGURATION);
|
||||||
ConfigRequest = Request;
|
ConfigRequest = Request;
|
||||||
|
if ((Request == NULL) || (StrStr (Request, L"OFFSET") == NULL)) {
|
||||||
|
//
|
||||||
|
// Request is set to NULL or OFFSET is NULL, construct full request string.
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// Allocate and fill a buffer large enough to hold the <ConfigHdr> template
|
||||||
|
// followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a Null-terminator
|
||||||
|
//
|
||||||
|
ConfigRequestHdr = HiiConstructConfigHdr (&gSecureBootConfigFormSetGuid, mSecureBootStorageName, PrivateData->DriverHandle);
|
||||||
|
Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
|
||||||
|
ConfigRequest = AllocateZeroPool (Size);
|
||||||
|
ASSERT (ConfigRequest != NULL);
|
||||||
|
AllocatedRequest = TRUE;
|
||||||
|
UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize);
|
||||||
|
FreePool (ConfigRequestHdr);
|
||||||
|
ConfigRequestHdr = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
Status = gHiiConfigRouting->BlockToConfig (
|
Status = gHiiConfigRouting->BlockToConfig (
|
||||||
gHiiConfigRouting,
|
gHiiConfigRouting,
|
||||||
|
@ -155,7 +184,14 @@ SecureBootExtractConfig (
|
||||||
Results,
|
Results,
|
||||||
Progress
|
Progress
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Free the allocated config request string.
|
||||||
|
//
|
||||||
|
if (AllocatedRequest) {
|
||||||
|
FreePool (ConfigRequest);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set Progress string to the original request string.
|
// Set Progress string to the original request string.
|
||||||
//
|
//
|
||||||
|
@ -198,7 +234,7 @@ SecureBootRouteConfig (
|
||||||
UINTN BufferSize;
|
UINTN BufferSize;
|
||||||
SECUREBOOT_CONFIGURATION SecureBootConfiguration;
|
SECUREBOOT_CONFIGURATION SecureBootConfiguration;
|
||||||
UINT8 *SecureBootEnable;
|
UINT8 *SecureBootEnable;
|
||||||
|
|
||||||
|
|
||||||
if (Configuration == NULL || Progress == NULL) {
|
if (Configuration == NULL || Progress == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
|
@ -224,17 +260,17 @@ SecureBootRouteConfig (
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
SecureBootEnable = GetVariable (EFI_SECURE_BOOT_ENABLE_NAME, &gEfiSecureBootEnableDisableGuid);
|
SecureBootEnable = GetVariable (EFI_SECURE_BOOT_ENABLE_NAME, &gEfiSecureBootEnableDisableGuid);
|
||||||
if (SecureBootEnable == NULL) {
|
if (SecureBootEnable == NULL) {
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*SecureBootEnable) != SecureBootConfiguration.SecureBootState) {
|
if ((*SecureBootEnable) != SecureBootConfiguration.SecureBootState) {
|
||||||
//
|
//
|
||||||
// If the configure is changed, update the SecureBoot Variable.
|
// If the configure is changed, update the SecureBoot Variable.
|
||||||
//
|
//
|
||||||
SaveSecureBootVariable (SecureBootConfiguration.SecureBootState);
|
SaveSecureBootVariable (SecureBootConfiguration.SecureBootState);
|
||||||
}
|
}
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,7 +308,7 @@ SecureBootCallback (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
BOOLEAN SecureBootEnable;
|
BOOLEAN SecureBootEnable;
|
||||||
|
|
||||||
if ((This == NULL) || (Value == NULL) || (ActionRequest == NULL)) {
|
if ((This == NULL) || (Value == NULL) || (ActionRequest == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
@ -280,13 +316,13 @@ SecureBootCallback (
|
||||||
if ((Action != EFI_BROWSER_ACTION_CHANGING) || (QuestionId != KEY_SECURE_BOOT_ENABLE)) {
|
if ((Action != EFI_BROWSER_ACTION_CHANGING) || (QuestionId != KEY_SECURE_BOOT_ENABLE)) {
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL == GetVariable (EFI_SECURE_BOOT_ENABLE_NAME, &gEfiSecureBootEnableDisableGuid)) {
|
if (NULL == GetVariable (EFI_SECURE_BOOT_ENABLE_NAME, &gEfiSecureBootEnableDisableGuid)) {
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
SecureBootEnable = Value->u8;
|
SecureBootEnable = Value->u8;
|
||||||
SaveSecureBootVariable (Value->u8);
|
SaveSecureBootVariable (Value->u8);
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -346,13 +382,13 @@ InstallSecureBootConfigForm (
|
||||||
&gEfiHiiConfigAccessProtocolGuid,
|
&gEfiHiiConfigAccessProtocolGuid,
|
||||||
ConfigAccess,
|
ConfigAccess,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
PrivateData->HiiHandle = HiiHandle;
|
PrivateData->HiiHandle = HiiHandle;
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -388,6 +424,6 @@ UninstallSecureBootConfigForm (
|
||||||
);
|
);
|
||||||
PrivateData->DriverHandle = NULL;
|
PrivateData->DriverHandle = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (PrivateData);
|
FreePool (PrivateData);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,12 +3,12 @@
|
||||||
configuration module.
|
configuration module.
|
||||||
|
|
||||||
Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
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.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -31,6 +31,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#include <Library/UefiLib.h>
|
#include <Library/UefiLib.h>
|
||||||
#include <Library/HiiLib.h>
|
#include <Library/HiiLib.h>
|
||||||
#include <Library/DevicePathLib.h>
|
#include <Library/DevicePathLib.h>
|
||||||
|
#include <Library/PrintLib.h>
|
||||||
|
|
||||||
#include <Guid/MdeModuleHii.h>
|
#include <Guid/MdeModuleHii.h>
|
||||||
#include <Guid/AuthenticatedVariableFormat.h>
|
#include <Guid/AuthenticatedVariableFormat.h>
|
||||||
|
@ -63,6 +64,8 @@ typedef struct {
|
||||||
extern SECUREBOOT_CONFIG_PRIVATE_DATA mSecureBootConfigPrivateDateTemplate;
|
extern SECUREBOOT_CONFIG_PRIVATE_DATA mSecureBootConfigPrivateDateTemplate;
|
||||||
|
|
||||||
#define SECUREBOOT_CONFIG_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('S', 'E', 'C', 'B')
|
#define SECUREBOOT_CONFIG_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('S', 'E', 'C', 'B')
|
||||||
|
#define SECUREBOOT_CONFIG_PRIVATE_FROM_THIS(a) CR (a, SECUREBOOT_CONFIG_PRIVATE_DATA, ConfigAccess, SECUREBOOT_CONFIG_PRIVATE_DATA_SIGNATURE)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function publish the SecureBoot configuration Form.
|
This function publish the SecureBoot configuration Form.
|
||||||
|
|
Loading…
Reference in New Issue