]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.h
SecurityPkg/SecureBootConfigDxe: Declare EFIAPI for the ChooseFile handlers
[mirror_edk2.git] / SecurityPkg / VariableAuthenticated / SecureBootConfigDxe / SecureBootConfigImpl.h
index 789150363134ed46b0178550736438000f260bbe..1ee9580140596ff6f11a00a7ff16771891a84f61 100644 (file)
@@ -2,7 +2,7 @@
   The header file of HII Config Access protocol implementation of SecureBoot\r
   configuration module.\r
 \r
-Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2011 - 2016, 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
@@ -23,7 +23,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Protocol/SimpleFileSystem.h>\r
 #include <Protocol/BlockIo.h>\r
 #include <Protocol/DevicePath.h>\r
-#include <Protocol/DevicePathToText.h>\r
 #include <Protocol/DebugPort.h>\r
 #include <Protocol/LoadFile.h>\r
 \r
@@ -40,6 +39,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/PrintLib.h>\r
 #include <Library/PlatformSecureLib.h>\r
 #include <Library/BaseCryptLib.h>\r
+#include <Library/FileExplorerLib.h>\r
+\r
 #include <Guid/MdeModuleHii.h>\r
 #include <Guid/AuthenticatedVariableFormat.h>\r
 #include <Guid/FileSystemVolumeLabelInfo.h>\r
@@ -74,9 +75,18 @@ extern  EFI_IFR_GUID_LABEL         *mEndLabel;
 //\r
 #define SHA256_DIGEST_SIZE  32\r
 //\r
-// Set max digest size as SHA256 Output (32 bytes) by far\r
+// SHA-384 digest size in bytes\r
+//\r
+#define SHA384_DIGEST_SIZE  48\r
+//\r
+// SHA-512 digest size in bytes\r
+//\r
+#define SHA512_DIGEST_SIZE  64\r
+\r
+//\r
+// Set max digest size as SHA512 Output (64 bytes) by far\r
 //\r
-#define MAX_DIGEST_SIZE    SHA256_DIGEST_SIZE\r
+#define MAX_DIGEST_SIZE    SHA512_DIGEST_SIZE\r
 \r
 #define WIN_CERT_UEFI_RSA2048_SIZE               256\r
 \r
@@ -88,6 +98,7 @@ extern  EFI_IFR_GUID_LABEL         *mEndLabel;
 #define HASHALG_SHA256                         0x00000002\r
 #define HASHALG_SHA384                         0x00000003\r
 #define HASHALG_SHA512                         0x00000004\r
+#define HASHALG_RAW                            0x00000005\r
 #define HASHALG_MAX                            0x00000005\r
 \r
 \r
@@ -109,21 +120,6 @@ typedef struct {
   CHAR16                    TargetName[1];\r
 } ISCSI_DEVICE_PATH_WITH_NAME;\r
 \r
-typedef enum _FILE_EXPLORER_DISPLAY_CONTEXT {\r
-  FileExplorerDisplayFileSystem,\r
-  FileExplorerDisplayDirectory,\r
-  FileExplorerDisplayUnknown\r
-} FILE_EXPLORER_DISPLAY_CONTEXT;\r
-\r
-typedef enum _FILE_EXPLORER_STATE {\r
-  FileExplorerStateInActive                      = 0,\r
-  FileExplorerStateEnrollPkFile,\r
-  FileExplorerStateEnrollKekFile,\r
-  FileExplorerStateEnrollSignatureFileToDb,\r
-  FileExplorerStateEnrollSignatureFileToDbx,\r
-  FileExplorerStateUnknown\r
-} FILE_EXPLORER_STATE;\r
-\r
 typedef struct {\r
   CHAR16  *Str;\r
   UINTN   Len;\r
@@ -149,32 +145,9 @@ typedef struct {
   UINTN             MenuNumber;\r
 } SECUREBOOT_MENU_OPTION;\r
 \r
-extern  SECUREBOOT_MENU_OPTION     FsOptionMenu;\r
-extern  SECUREBOOT_MENU_OPTION     DirectoryMenu;\r
-\r
 typedef struct {\r
-  UINTN             Signature;\r
-  LIST_ENTRY        Link;\r
-  UINTN             OptionNumber;\r
-  UINT16            *DisplayString;\r
-  UINT16            *HelpString;\r
-  EFI_STRING_ID     DisplayStringToken;\r
-  EFI_STRING_ID     HelpStringToken;\r
-  VOID              *FileContext;\r
-} SECUREBOOT_MENU_ENTRY;\r
-\r
-typedef struct {\r
-  EFI_HANDLE                        Handle;\r
-  EFI_DEVICE_PATH_PROTOCOL          *DevicePath;\r
   EFI_FILE_HANDLE                   FHandle;\r
   UINT16                            *FileName;\r
-  EFI_FILE_SYSTEM_VOLUME_LABEL      *Info;\r
-\r
-  BOOLEAN                           IsRoot;\r
-  BOOLEAN                           IsDir;\r
-  BOOLEAN                           IsRemovableMedia;\r
-  BOOLEAN                           IsLoadFile;\r
-  BOOLEAN                           IsBootLegacy;\r
 } SECUREBOOT_FILE_CONTEXT;\r
 \r
 \r
@@ -206,16 +179,13 @@ typedef struct {
   EFI_HII_HANDLE                    HiiHandle;\r
   EFI_HANDLE                        DriverHandle;\r
 \r
-  FILE_EXPLORER_STATE               FeCurrentState;\r
-  FILE_EXPLORER_DISPLAY_CONTEXT     FeDisplayContext;\r
-\r
-  SECUREBOOT_MENU_ENTRY             *MenuEntry;\r
   SECUREBOOT_FILE_CONTEXT           *FileContext;\r
 \r
   EFI_GUID                          *SignatureGUID;\r
 } SECUREBOOT_CONFIG_PRIVATE_DATA;\r
 \r
 extern SECUREBOOT_CONFIG_PRIVATE_DATA      mSecureBootConfigPrivateDateTemplate;\r
+extern SECUREBOOT_CONFIG_PRIVATE_DATA      *gSecureBootPrivateData;\r
 \r
 #define SECUREBOOT_CONFIG_PRIVATE_DATA_SIGNATURE     SIGNATURE_32 ('S', 'E', 'C', 'B')\r
 #define SECUREBOOT_CONFIG_PRIVATE_FROM_THIS(a)  CR (a, SECUREBOOT_CONFIG_PRIVATE_DATA, ConfigAccess, SECUREBOOT_CONFIG_PRIVATE_DATA_SIGNATURE)\r
@@ -223,7 +193,7 @@ extern SECUREBOOT_CONFIG_PRIVATE_DATA      mSecureBootConfigPrivateDateTemplate;
 //\r
 // Cryptograhpic Key Information\r
 //\r
-#pragma pack (push, 1)\r
+#pragma pack(1)\r
 typedef struct _CPL_KEY_INFO {\r
   UINT32        KeyLengthInBits;    // Key Length In Bits\r
   UINT32        BlockSize;          // Operation Block Size in Bytes\r
@@ -232,7 +202,7 @@ typedef struct _CPL_KEY_INFO {
   UINT32        CipherMode;         // Cipher Mode for Symmetric Algorithm\r
   UINT32        Flags;              // Additional Key Property Flags\r
 } CPL_KEY_INFO;\r
-#pragma pack (pop)\r
+#pragma pack()\r
 \r
 \r
 /**\r
@@ -317,7 +287,7 @@ BOOLEAN
 typedef struct {\r
   CHAR16                   *Name;           ///< Name for Hash Algorithm\r
   UINTN                    DigestLength;    ///< Digest Length\r
-  UINT8                    *OidValue;       ///< Hash Algorithm OID ASN.1 Value \r
+  UINT8                    *OidValue;       ///< Hash Algorithm OID ASN.1 Value\r
   UINTN                    OidLength;       ///< Length of Hash OID Value\r
   HASH_GET_CONTEXT_SIZE    GetContextSize;  ///< Pointer to Hash GetContentSize function\r
   HASH_INIT                HashInit;        ///< Pointer to Hash Init function\r
@@ -472,7 +442,7 @@ DevicePathToStr (
 \r
 \r
 /**\r
-  Clean up the dynamic opcode at label and form specified by both LabelId. \r
+  Clean up the dynamic opcode at label and form specified by both LabelId.\r
 \r
   @param[in] LabelId         It is both the Form ID and Label ID for opcode deletion.\r
   @param[in] PrivateData     Module private data.\r
@@ -486,44 +456,15 @@ CleanUpPage (
 \r
 \r
 /**\r
-  Update the file explorer page with the refreshed file system.\r
-\r
-  @param[in] PrivateData     Module private data.\r
-  @param[in] KeyValue        Key value to identify the type of data to expect.\r
-\r
-  @retval  TRUE           Inform the caller to create a callback packet to exit file explorer.\r
-  @retval  FALSE          Indicate that there is no need to exit file explorer.\r
-\r
-**/\r
-BOOLEAN\r
-UpdateFileExplorer (\r
-  IN SECUREBOOT_CONFIG_PRIVATE_DATA   *PrivateData,\r
-  IN UINT16                           KeyValue\r
-  );\r
-\r
-\r
-/**\r
-  Free resources allocated in Allocate Rountine.\r
-\r
-  @param[in, out]  MenuOption        Menu to be freed\r
-  \r
-**/\r
-VOID\r
-FreeMenu (\r
-  IN OUT SECUREBOOT_MENU_OPTION        *MenuOption\r
-  );\r
-\r
-\r
-/**\r
-  Read file content into BufferPtr, the size of the allocate buffer \r
+  Read file content into BufferPtr, the size of the allocate buffer\r
   is *FileSize plus AddtionAllocateSize.\r
 \r
   @param[in]       FileHandle            The file to be read.\r
   @param[in, out]  BufferPtr             Pointers to the pointer of allocated buffer.\r
   @param[out]      FileSize              Size of input file\r
-  @param[in]       AddtionAllocateSize   Addtion size the buffer need to be allocated. \r
+  @param[in]       AddtionAllocateSize   Addtion size the buffer need to be allocated.\r
                                          In case the buffer need to contain others besides the file content.\r
-  \r
+\r
   @retval   EFI_SUCCESS                  The file was read into the buffer.\r
   @retval   EFI_INVALID_PARAMETER        A parameter was invalid.\r
   @retval   EFI_OUT_OF_RESOURCES         A memory allocation failed.\r
@@ -543,7 +484,7 @@ ReadFileContent (
   Close an open file handle.\r
 \r
   @param[in] FileHandle           The file handle to close.\r
-  \r
+\r
 **/\r
 VOID\r
 CloseFile (\r
@@ -556,7 +497,7 @@ CloseFile (
 \r
   @param[in]   Integer          Pointer to the nonnegative integer to be converted\r
   @param[in]   IntSizeInWords   Length of integer buffer in words\r
-  @param[out]  OctetString      Converted octet string of the specified length \r
+  @param[out]  OctetString      Converted octet string of the specified length\r
   @param[in]   OSSizeInBytes    Intended length of resulting octet string in bytes\r
 \r
 Returns:\r
@@ -588,8 +529,8 @@ Int2OctStr (
 **/\r
 EFI_STATUS\r
 StringToGuid (\r
-  IN   CHAR16           *Str, \r
-  IN   UINTN            StrLen, \r
+  IN   CHAR16           *Str,\r
+  IN   UINTN            StrLen,\r
   OUT  EFI_GUID         *Guid\r
   );\r
 \r
@@ -600,7 +541,7 @@ StringToGuid (
   @param[in]     Guid          Pointer to GUID to print.\r
   @param[in]     Buffer        Buffer to print Guid into.\r
   @param[in]     BufferSize    Size of Buffer.\r
-  \r
+\r
   @retval    Number of characters printed.\r
 \r
 **/\r
@@ -611,4 +552,74 @@ GuidToString (
   IN  UINTN     BufferSize\r
   );\r
 \r
+/**\r
+  Update the PK form base on the input file path info.\r
+\r
+  @param FilePath    Point to the file path.\r
+\r
+  @retval TRUE   Exit caller function.\r
+  @retval FALSE  Not exit caller function.\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+UpdatePKFromFile (\r
+  IN EFI_DEVICE_PATH_PROTOCOL    *FilePath\r
+  );\r
+\r
+/**\r
+  Update the KEK form base on the input file path info.\r
+\r
+  @param FilePath    Point to the file path.\r
+\r
+  @retval TRUE   Exit caller function.\r
+  @retval FALSE  Not exit caller function.\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+UpdateKEKFromFile (\r
+  IN EFI_DEVICE_PATH_PROTOCOL    *FilePath\r
+  );\r
+\r
+/**\r
+  Update the DB form base on the input file path info.\r
+\r
+  @param FilePath    Point to the file path.\r
+\r
+  @retval TRUE   Exit caller function.\r
+  @retval FALSE  Not exit caller function.\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+UpdateDBFromFile (\r
+  IN EFI_DEVICE_PATH_PROTOCOL    *FilePath\r
+  );\r
+\r
+/**\r
+  Update the DBX form base on the input file path info.\r
+\r
+  @param FilePath    Point to the file path.\r
+\r
+  @retval TRUE   Exit caller function.\r
+  @retval FALSE  Not exit caller function.\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+UpdateDBXFromFile (\r
+  IN EFI_DEVICE_PATH_PROTOCOL    *FilePath\r
+  );\r
+\r
+/**\r
+  Update the DBT form base on the input file path info.\r
+\r
+  @param FilePath    Point to the file path.\r
+\r
+  @retval TRUE   Exit caller function.\r
+  @retval FALSE  Not exit caller function.\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+UpdateDBTFromFile (\r
+  IN EFI_DEVICE_PATH_PROTOCOL    *FilePath\r
+  );\r
+\r
 #endif\r