summaryrefslogtreecommitdiff
path: root/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c
diff options
context:
space:
mode:
Diffstat (limited to 'SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c')
-rw-r--r--SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c85
1 files changed, 42 insertions, 43 deletions
diff --git a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c
index 8bea707..5a23dc5 100644
--- a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c
+++ b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c
@@ -8,10 +8,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "SecureBootConfigImpl.h"
-VOID *mStartOpCodeHandle = NULL;
-VOID *mEndOpCodeHandle = NULL;
-EFI_IFR_GUID_LABEL *mStartLabel = NULL;
-EFI_IFR_GUID_LABEL *mEndLabel = NULL;
+VOID *mStartOpCodeHandle = NULL;
+VOID *mEndOpCodeHandle = NULL;
+EFI_IFR_GUID_LABEL *mStartLabel = NULL;
+EFI_IFR_GUID_LABEL *mEndLabel = NULL;
/**
Refresh the global UpdateData structure.
@@ -37,12 +37,12 @@ RefreshUpdateData (
//
// Create Hii Extend Label OpCode as the start opcode
//
- mStartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (
- mStartOpCodeHandle,
- &gEfiIfrTianoGuid,
- NULL,
- sizeof (EFI_IFR_GUID_LABEL)
- );
+ mStartLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (
+ mStartOpCodeHandle,
+ &gEfiIfrTianoGuid,
+ NULL,
+ sizeof (EFI_IFR_GUID_LABEL)
+ );
mStartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
}
@@ -55,8 +55,8 @@ RefreshUpdateData (
**/
VOID
CleanUpPage (
- IN UINT16 LabelId,
- IN SECUREBOOT_CONFIG_PRIVATE_DATA *PrivateData
+ IN UINT16 LabelId,
+ IN SECUREBOOT_CONFIG_PRIVATE_DATA *PrivateData
)
{
RefreshUpdateData ();
@@ -87,39 +87,38 @@ CleanUpPage (
**/
CHAR16 *
ExtractFileNameFromDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
- CHAR16 *String;
- CHAR16 *MatchString;
- CHAR16 *LastMatch;
- CHAR16 *FileName;
- UINTN Length;
+ CHAR16 *String;
+ CHAR16 *MatchString;
+ CHAR16 *LastMatch;
+ CHAR16 *FileName;
+ UINTN Length;
- ASSERT(DevicePath != NULL);
+ ASSERT (DevicePath != NULL);
- String = DevicePathToStr(DevicePath);
+ String = DevicePathToStr (DevicePath);
MatchString = String;
LastMatch = String;
FileName = NULL;
- while(MatchString != NULL){
+ while (MatchString != NULL) {
LastMatch = MatchString + 1;
- MatchString = StrStr(LastMatch,L"\\");
+ MatchString = StrStr (LastMatch, L"\\");
}
- Length = StrLen(LastMatch);
- FileName = AllocateCopyPool ((Length + 1) * sizeof(CHAR16), LastMatch);
+ Length = StrLen (LastMatch);
+ FileName = AllocateCopyPool ((Length + 1) * sizeof (CHAR16), LastMatch);
if (FileName != NULL) {
*(FileName + Length) = 0;
}
- FreePool(String);
+ FreePool (String);
return FileName;
}
-
/**
Update the form base on the selected file.
@@ -131,19 +130,20 @@ ExtractFileNameFromDevicePath (
**/
BOOLEAN
-UpdatePage(
+UpdatePage (
IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
IN EFI_FORM_ID FormId
)
{
- CHAR16 *FileName;
- EFI_STRING_ID StringToken;
+ CHAR16 *FileName;
+ EFI_STRING_ID StringToken;
FileName = NULL;
if (FilePath != NULL) {
- FileName = ExtractFileNameFromDevicePath(FilePath);
+ FileName = ExtractFileNameFromDevicePath (FilePath);
}
+
if (FileName == NULL) {
//
// FileName = NULL has two case:
@@ -153,6 +153,7 @@ UpdatePage(
//
return TRUE;
}
+
StringToken = HiiSetString (gSecureBootPrivateData->HiiHandle, 0, FileName, NULL);
gSecureBootPrivateData->FileContext->FileName = FileName;
@@ -175,7 +176,7 @@ UpdatePage(
0,
0,
0
- );
+ );
HiiUpdateForm (
gSecureBootPrivateData->HiiHandle,
@@ -199,11 +200,10 @@ UpdatePage(
BOOLEAN
EFIAPI
UpdatePKFromFile (
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath
+ IN EFI_DEVICE_PATH_PROTOCOL *FilePath
)
{
- return UpdatePage(FilePath, FORMID_ENROLL_PK_FORM);
-
+ return UpdatePage (FilePath, FORMID_ENROLL_PK_FORM);
}
/**
@@ -217,10 +217,10 @@ UpdatePKFromFile (
BOOLEAN
EFIAPI
UpdateKEKFromFile (
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath
+ IN EFI_DEVICE_PATH_PROTOCOL *FilePath
)
{
- return UpdatePage(FilePath, FORMID_ENROLL_KEK_FORM);
+ return UpdatePage (FilePath, FORMID_ENROLL_KEK_FORM);
}
/**
@@ -234,10 +234,10 @@ UpdateKEKFromFile (
BOOLEAN
EFIAPI
UpdateDBFromFile (
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath
+ IN EFI_DEVICE_PATH_PROTOCOL *FilePath
)
{
- return UpdatePage(FilePath, SECUREBOOT_ENROLL_SIGNATURE_TO_DB);
+ return UpdatePage (FilePath, SECUREBOOT_ENROLL_SIGNATURE_TO_DB);
}
/**
@@ -251,10 +251,10 @@ UpdateDBFromFile (
BOOLEAN
EFIAPI
UpdateDBXFromFile (
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath
+ IN EFI_DEVICE_PATH_PROTOCOL *FilePath
)
{
- return UpdatePage(FilePath, SECUREBOOT_ENROLL_SIGNATURE_TO_DBX);
+ return UpdatePage (FilePath, SECUREBOOT_ENROLL_SIGNATURE_TO_DBX);
}
/**
@@ -268,9 +268,8 @@ UpdateDBXFromFile (
BOOLEAN
EFIAPI
UpdateDBTFromFile (
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath
+ IN EFI_DEVICE_PATH_PROTOCOL *FilePath
)
{
- return UpdatePage(FilePath, SECUREBOOT_ENROLL_SIGNATURE_TO_DBT);
+ return UpdatePage (FilePath, SECUREBOOT_ENROLL_SIGNATURE_TO_DBT);
}
-