From 762d8ddb2877581eaf20e0f090692f06a83c7588 Mon Sep 17 00:00:00 2001 From: Dandan Bi Date: Thu, 28 Jan 2016 09:36:43 +0800 Subject: SecurityPkg: Use FileExplorerLib in SecureBootConfigDxe Using existing library FileExplorerLib to replace the same logic in SecureBootConfigDxe to make the code clear. After using FileExplorerLib, the UI behavior for enroll PK will change, previously when select one PK file, commit/discard changes will return to Device Manager,press ESC will return to FileExplorer. Now using FileExplorerLib the behavior will keep same with enroll KEK/DB/..., commit/discard changes will return to Custom Secure Boot Options form and ESC will return to PK options form. Cc: Chao Zhang Cc: Eric Dong Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi Acked-by: Laszlo Ersek Reviewed-by: Eric Dong Reviewed-by: Chao Zhang --- .../SecureBootConfigDxe/SecureBootConfigImpl.h | 142 ++++++++++----------- 1 file changed, 69 insertions(+), 73 deletions(-) (limited to 'SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.h') diff --git a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.h b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.h index bcb1c12e23..a8dbd92ee4 100644 --- a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.h +++ b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.h @@ -2,7 +2,7 @@ The header file of HII Config Access protocol implementation of SecureBoot configuration module. -Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.
+Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.
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 @@ -39,6 +39,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include +#include + #include #include #include @@ -118,22 +120,6 @@ typedef struct { CHAR16 TargetName[1]; } ISCSI_DEVICE_PATH_WITH_NAME; -typedef enum _FILE_EXPLORER_DISPLAY_CONTEXT { - FileExplorerDisplayFileSystem, - FileExplorerDisplayDirectory, - FileExplorerDisplayUnknown -} FILE_EXPLORER_DISPLAY_CONTEXT; - -typedef enum _FILE_EXPLORER_STATE { - FileExplorerStateInActive = 0, - FileExplorerStateEnrollPkFile, - FileExplorerStateEnrollKekFile, - FileExplorerStateEnrollSignatureFileToDb, - FileExplorerStateEnrollSignatureFileToDbx, - FileExplorerStateEnrollSignatureFileToDbt, - FileExplorerStateUnknown -} FILE_EXPLORER_STATE; - typedef struct { CHAR16 *Str; UINTN Len; @@ -159,32 +145,9 @@ typedef struct { UINTN MenuNumber; } SECUREBOOT_MENU_OPTION; -extern SECUREBOOT_MENU_OPTION FsOptionMenu; -extern SECUREBOOT_MENU_OPTION DirectoryMenu; - -typedef struct { - UINTN Signature; - LIST_ENTRY Link; - UINTN OptionNumber; - UINT16 *DisplayString; - UINT16 *HelpString; - EFI_STRING_ID DisplayStringToken; - EFI_STRING_ID HelpStringToken; - VOID *FileContext; -} SECUREBOOT_MENU_ENTRY; - typedef struct { - EFI_HANDLE Handle; - EFI_DEVICE_PATH_PROTOCOL *DevicePath; EFI_FILE_HANDLE FHandle; UINT16 *FileName; - EFI_FILE_SYSTEM_VOLUME_LABEL *Info; - - BOOLEAN IsRoot; - BOOLEAN IsDir; - BOOLEAN IsRemovableMedia; - BOOLEAN IsLoadFile; - BOOLEAN IsBootLegacy; } SECUREBOOT_FILE_CONTEXT; @@ -216,16 +179,13 @@ typedef struct { EFI_HII_HANDLE HiiHandle; EFI_HANDLE DriverHandle; - FILE_EXPLORER_STATE FeCurrentState; - FILE_EXPLORER_DISPLAY_CONTEXT FeDisplayContext; - - SECUREBOOT_MENU_ENTRY *MenuEntry; SECUREBOOT_FILE_CONTEXT *FileContext; EFI_GUID *SignatureGUID; } SECUREBOOT_CONFIG_PRIVATE_DATA; extern SECUREBOOT_CONFIG_PRIVATE_DATA mSecureBootConfigPrivateDateTemplate; +extern SECUREBOOT_CONFIG_PRIVATE_DATA *gSecureBootPrivateData; #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) @@ -495,35 +455,6 @@ CleanUpPage ( ); -/** - Update the file explorer page with the refreshed file system. - - @param[in] PrivateData Module private data. - @param[in] KeyValue Key value to identify the type of data to expect. - - @retval TRUE Inform the caller to create a callback packet to exit file explorer. - @retval FALSE Indicate that there is no need to exit file explorer. - -**/ -BOOLEAN -UpdateFileExplorer ( - IN SECUREBOOT_CONFIG_PRIVATE_DATA *PrivateData, - IN UINT16 KeyValue - ); - - -/** - Free resources allocated in Allocate Rountine. - - @param[in, out] MenuOption Menu to be freed - -**/ -VOID -FreeMenu ( - IN OUT SECUREBOOT_MENU_OPTION *MenuOption - ); - - /** Read file content into BufferPtr, the size of the allocate buffer is *FileSize plus AddtionAllocateSize. @@ -621,4 +552,69 @@ GuidToString ( IN UINTN BufferSize ); +/** + Update the PK form base on the input file path info. + + @param FilePath Point to the file path. + + @retval TRUE Exit caller function. + @retval FALSE Not exit caller function. +**/ +BOOLEAN +UpdatePKFromFile ( + IN EFI_DEVICE_PATH_PROTOCOL *FilePath + ); + +/** + Update the KEK form base on the input file path info. + + @param FilePath Point to the file path. + + @retval TRUE Exit caller function. + @retval FALSE Not exit caller function. +**/ +BOOLEAN +UpdateKEKFromFile ( + IN EFI_DEVICE_PATH_PROTOCOL *FilePath + ); + +/** + Update the DB form base on the input file path info. + + @param FilePath Point to the file path. + + @retval TRUE Exit caller function. + @retval FALSE Not exit caller function. +**/ +BOOLEAN +UpdateDBFromFile ( + IN EFI_DEVICE_PATH_PROTOCOL *FilePath + ); + +/** + Update the DBX form base on the input file path info. + + @param FilePath Point to the file path. + + @retval TRUE Exit caller function. + @retval FALSE Not exit caller function. +**/ +BOOLEAN +UpdateDBXFromFile ( + IN EFI_DEVICE_PATH_PROTOCOL *FilePath + ); + +/** + Update the DBT form base on the input file path info. + + @param FilePath Point to the file path. + + @retval TRUE Exit caller function. + @retval FALSE Not exit caller function. +**/ +BOOLEAN +UpdateDBTFromFile ( + IN EFI_DEVICE_PATH_PROTOCOL *FilePath + ); + #endif -- cgit v1.2.3