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:
qianouyang 2011-11-15 10:22:35 +00:00
parent 9cc86267ce
commit bc0c99b3df
2 changed files with 74 additions and 35 deletions

View File

@ -114,20 +114,31 @@ SecureBootExtractConfig (
{
EFI_STATUS Status;
UINTN BufferSize;
UINTN Size;
SECUREBOOT_CONFIGURATION Configuration;
EFI_STRING ConfigRequest;
EFI_STRING ConfigRequestHdr;
UINT8 *SecureBootEnable;
SECUREBOOT_CONFIG_PRIVATE_DATA *PrivateData;
BOOLEAN AllocatedRequest;
if (Progress == NULL || Results == NULL) {
return EFI_INVALID_PARAMETER;
}
AllocatedRequest = FALSE;
ConfigRequestHdr = NULL;
ConfigRequest = NULL;
Size = 0;
PrivateData = SECUREBOOT_CONFIG_PRIVATE_FROM_THIS (This);
*Progress = Request;
if ((Request != NULL) && !HiiIsConfigHdrMatch (Request, &gSecureBootConfigFormSetGuid, mSecureBootStorageName)) {
return EFI_NOT_FOUND;
}
//
// Get the SecureBoot Variable
//
@ -144,8 +155,26 @@ SecureBootExtractConfig (
Configuration.SecureBootState = *SecureBootEnable;
}
BufferSize = sizeof (Configuration);
BufferSize = sizeof (SECUREBOOT_CONFIGURATION);
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 (
gHiiConfigRouting,
@ -156,6 +185,13 @@ SecureBootExtractConfig (
Progress
);
//
// Free the allocated config request string.
//
if (AllocatedRequest) {
FreePool (ConfigRequest);
}
//
// Set Progress string to the original request string.
//

View File

@ -31,6 +31,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/UefiLib.h>
#include <Library/HiiLib.h>
#include <Library/DevicePathLib.h>
#include <Library/PrintLib.h>
#include <Guid/MdeModuleHii.h>
#include <Guid/AuthenticatedVariableFormat.h>
@ -63,6 +64,8 @@ typedef struct {
extern SECUREBOOT_CONFIG_PRIVATE_DATA mSecureBootConfigPrivateDateTemplate;
#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.