]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.h
SecurityPkg: Implement AuthVariableLib library instance
[mirror_edk2.git] / SecurityPkg / VariableAuthenticated / RuntimeDxe / Variable.h
index 6865f0dc719bd10649c423966fad5e114a45ed1e..20f60d4a9e2261877185f89d3603346e71a5edcf 100644 (file)
@@ -2,7 +2,7 @@
   The internal header file includes the common header files, defines\r
   internal structure and functions used by Variable modules.\r
 \r
-Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2009 - 2015, 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
@@ -21,7 +21,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Protocol/FaultTolerantWrite.h>\r
 #include <Protocol/FirmwareVolumeBlock.h>\r
 #include <Protocol/Variable.h>\r
+#include <Protocol/VariableLock.h>\r
+#include <Protocol/VarCheck.h>\r
 #include <Library/PcdLib.h>\r
+#include <Library/HobLib.h>\r
 #include <Library/UefiDriverEntryPoint.h>\r
 #include <Library/DxeServicesTableLib.h>\r
 #include <Library/UefiRuntimeLib.h>\r
@@ -38,22 +41,60 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Guid/EventGroup.h>\r
 #include <Guid/AuthenticatedVariableFormat.h>\r
 #include <Guid/ImageAuthentication.h>\r
-\r
-#define VARIABLE_RECLAIM_THRESHOLD (1024)\r
+#include <Guid/SystemNvDataGuid.h>\r
+#include <Guid/FaultTolerantWrite.h>\r
+#include <Guid/HardwareErrorVariable.h>\r
+#include <Guid/VarErrorFlag.h>\r
+\r
+#define EFI_VARIABLE_ATTRIBUTES_MASK (EFI_VARIABLE_NON_VOLATILE | \\r
+                                      EFI_VARIABLE_BOOTSERVICE_ACCESS | \\r
+                                      EFI_VARIABLE_RUNTIME_ACCESS | \\r
+                                      EFI_VARIABLE_HARDWARE_ERROR_RECORD | \\r
+                                      EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS | \\r
+                                      EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS | \\r
+                                      EFI_VARIABLE_APPEND_WRITE)\r
+\r
+#define VARIABLE_ATTRIBUTE_NV_BS        (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS)\r
+#define VARIABLE_ATTRIBUTE_BS_RT        (EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS)\r
+#define VARIABLE_ATTRIBUTE_NV_BS_RT     (VARIABLE_ATTRIBUTE_BS_RT | EFI_VARIABLE_NON_VOLATILE)\r
+#define VARIABLE_ATTRIBUTE_NV_BS_RT_AT  (VARIABLE_ATTRIBUTE_NV_BS_RT | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS)\r
+#define VARIABLE_ATTRIBUTE_NV_BS_RT_HR  (VARIABLE_ATTRIBUTE_NV_BS_RT | EFI_VARIABLE_HARDWARE_ERROR_RECORD)\r
+#define VARIABLE_ATTRIBUTE_NV_BS_RT_AW  (VARIABLE_ATTRIBUTE_NV_BS_RT | EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS)\r
+#define VARIABLE_ATTRIBUTE_NV_BS_RT_AT_HR_AW  (VARIABLE_ATTRIBUTE_NV_BS_RT_AT | EFI_VARIABLE_HARDWARE_ERROR_RECORD | EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS)\r
+#define VARIABLE_ATTRIBUTE_AT_AW        (EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS | EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS)\r
+\r
+#define MAX_NV_VARIABLE_SIZE (MAX (MAX (PcdGet32 (PcdMaxVariableSize), \\r
+                                        PcdGet32 (PcdMaxAuthVariableSize)), \\r
+                                   PcdGet32 (PcdMaxHardwareErrorVariableSize)))\r
 \r
 ///\r
 /// The size of a 3 character ISO639 language code.\r
 ///\r
 #define ISO_639_2_ENTRY_SIZE    3\r
 \r
+typedef enum {\r
+  VariableStoreTypeVolatile,\r
+  VariableStoreTypeHob,\r
+  VariableStoreTypeNv,\r
+  VariableStoreTypeMax\r
+} VARIABLE_STORE_TYPE;\r
+\r
 typedef struct {\r
   VARIABLE_HEADER *CurrPtr;\r
+  //\r
+  // If both ADDED and IN_DELETED_TRANSITION variable are present,\r
+  // InDeletedTransitionPtr will point to the IN_DELETED_TRANSITION one.\r
+  // Otherwise, CurrPtr will point to the ADDED or IN_DELETED_TRANSITION one,\r
+  // and InDeletedTransitionPtr will be NULL at the same time.\r
+  //\r
+  VARIABLE_HEADER *InDeletedTransitionPtr;\r
   VARIABLE_HEADER *EndPtr;\r
   VARIABLE_HEADER *StartPtr;\r
   BOOLEAN         Volatile;\r
 } VARIABLE_POINTER_TRACK;\r
 \r
 typedef struct {\r
+  EFI_PHYSICAL_ADDRESS  HobVariableBase;\r
   EFI_PHYSICAL_ADDRESS  VolatileVariableBase;\r
   EFI_PHYSICAL_ADDRESS  NonVolatileVariableBase;\r
   EFI_LOCK              VariableServicesLock;\r
@@ -64,8 +105,15 @@ typedef struct {
   VARIABLE_GLOBAL VariableGlobal;\r
   UINTN           VolatileLastVariableOffset;\r
   UINTN           NonVolatileLastVariableOffset;\r
+  UINTN           CommonVariableSpace;\r
+  UINTN           CommonMaxUserVariableSpace;\r
+  UINTN           CommonRuntimeVariableSpace;\r
   UINTN           CommonVariableTotalSize;\r
+  UINTN           CommonUserVariableTotalSize;\r
   UINTN           HwErrVariableTotalSize;\r
+  UINTN           MaxVariableSize;\r
+  UINTN           MaxAuthVariableSize;\r
+  UINTN           ScratchBufferSize;\r
   CHAR8           *PlatformLangCodes;\r
   CHAR8           *LangCodes;\r
   CHAR8           *PlatformLang;\r
@@ -74,12 +122,23 @@ typedef struct {
 } VARIABLE_MODULE_GLOBAL;\r
 \r
 typedef struct {\r
-  EFI_GUID    *Guid;\r
-  CHAR16      *Name;\r
-  UINT32      Attributes;\r
-  UINTN       DataSize;\r
-  VOID        *Data;\r
-} VARIABLE_CACHE_ENTRY;\r
+  LIST_ENTRY  Link;\r
+  EFI_GUID    Guid;\r
+  //CHAR16      *Name;\r
+} VARIABLE_ENTRY;\r
+\r
+/**\r
+  Flush the HOB variable to flash.\r
+\r
+  @param[in] VariableName       Name of variable has been updated or deleted.\r
+  @param[in] VendorGuid         Guid of variable has been updated or deleted.\r
+\r
+**/\r
+VOID\r
+FlushHobVariableToFlash (\r
+  IN CHAR16                     *VariableName,\r
+  IN EFI_GUID                   *VendorGuid\r
+  );\r
 \r
 /**\r
   Writes a buffer to variable storage space, in the working block.\r
@@ -89,8 +148,7 @@ typedef struct {
   VariableBase. Fault Tolerant Write protocol is used for writing.\r
 \r
   @param  VariableBase   Base address of the variable to write.\r
-  @param  Buffer         Point to the data buffer.\r
-  @param  BufferSize     The number of bytes of the data Buffer.\r
+  @param  VariableBuffer Point to the variable data buffer.\r
 \r
   @retval EFI_SUCCESS    The function completed successfully.\r
   @retval EFI_NOT_FOUND  Fail to locate Fault Tolerant Write protocol.\r
@@ -100,8 +158,7 @@ typedef struct {
 EFI_STATUS\r
 FtwVariableSpace (\r
   IN EFI_PHYSICAL_ADDRESS   VariableBase,\r
-  IN UINT8                  *Buffer,\r
-  IN UINTN                  BufferSize\r
+  IN VARIABLE_STORE_HEADER  *VariableBuffer\r
   );\r
 \r
 /**\r
@@ -110,20 +167,24 @@ FtwVariableSpace (
   This code finds variable in storage blocks of volatile and non-volatile storage areas.\r
   If VariableName is an empty string, then we just return the first\r
   qualified variable without comparing VariableName and VendorGuid.\r
-  Otherwise, VariableName and VendorGuid are compared.\r
+  If IgnoreRtCheck is TRUE, then we ignore the EFI_VARIABLE_RUNTIME_ACCESS attribute check\r
+  at runtime when searching existing variable, only VariableName and VendorGuid are compared.\r
+  Otherwise, variables without EFI_VARIABLE_RUNTIME_ACCESS are not visible at runtime.\r
 \r
-  @param  VariableName                Name of the variable to be found.\r
-  @param  VendorGuid                  Vendor GUID to be found.\r
-  @param  PtrTrack                    VARIABLE_POINTER_TRACK structure for output,\r
+  @param[in]   VariableName           Name of the variable to be found.\r
+  @param[in]   VendorGuid             Vendor GUID to be found.\r
+  @param[out]  PtrTrack               VARIABLE_POINTER_TRACK structure for output,\r
                                       including the range searched and the target position.\r
-  @param  Global                      Pointer to VARIABLE_GLOBAL structure, including\r
+  @param[in]   Global                 Pointer to VARIABLE_GLOBAL structure, including\r
                                       base of volatile variable storage area, base of\r
                                       NV variable storage area, and a lock.\r
+  @param[in]   IgnoreRtCheck          Ignore EFI_VARIABLE_RUNTIME_ACCESS attribute\r
+                                      check at runtime when searching variable.\r
 \r
   @retval EFI_INVALID_PARAMETER       If VariableName is not an empty string, while\r
                                       VendorGuid is NULL.\r
   @retval EFI_SUCCESS                 Variable successfully found.\r
-  @retval EFI_INVALID_PARAMETER       Variable not found.\r
+  @retval EFI_NOT_FOUND               Variable not found\r
 \r
 **/\r
 EFI_STATUS\r
@@ -131,7 +192,25 @@ FindVariable (
   IN  CHAR16                  *VariableName,\r
   IN  EFI_GUID                *VendorGuid,\r
   OUT VARIABLE_POINTER_TRACK  *PtrTrack,\r
-  IN  VARIABLE_GLOBAL         *Global\r
+  IN  VARIABLE_GLOBAL         *Global,\r
+  IN  BOOLEAN                 IgnoreRtCheck\r
+  );\r
+\r
+/**\r
+\r
+  Gets the pointer to the end of the variable storage area.\r
+\r
+  This function gets pointer to the end of the variable storage\r
+  area, according to the input variable store header.\r
+\r
+  @param VarStoreHeader  Pointer to the Variable Store Header.\r
+\r
+  @return Pointer to the end of the variable storage area.\r
+\r
+**/\r
+VARIABLE_HEADER *\r
+GetEndPointer (\r
+  IN VARIABLE_STORE_HEADER       *VarStoreHeader\r
   );\r
 \r
 /**\r
@@ -162,6 +241,32 @@ DataSizeOfVariable (
   IN  VARIABLE_HEADER   *Variable\r
   );\r
 \r
+/**\r
+  This function is to check if the remaining variable space is enough to set\r
+  all Variables from argument list successfully. The purpose of the check\r
+  is to keep the consistency of the Variables to be in variable storage.\r
+\r
+  Note: Variables are assumed to be in same storage.\r
+  The set sequence of Variables will be same with the sequence of VariableEntry from argument list,\r
+  so follow the argument sequence to check the Variables.\r
+\r
+  @param[in] Attributes         Variable attributes for Variable entries.\r
+  @param ...                    The variable argument list with type VARIABLE_ENTRY_CONSISTENCY *.\r
+                                A NULL terminates the list. The VariableSize of \r
+                                VARIABLE_ENTRY_CONSISTENCY is the variable data size as input.\r
+                                It will be changed to variable total size as output.\r
+\r
+  @retval TRUE                  Have enough variable space to set the Variables successfully.\r
+  @retval FALSE                 No enough variable space to set the Variables successfully.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+CheckRemainingSpaceForConsistency (\r
+  IN UINT32                     Attributes,\r
+  ...\r
+  );\r
+  \r
 /**\r
   Update the variable region with Variable information. If EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS is set,\r
   index of associated public key is needed.\r
@@ -173,7 +278,7 @@ DataSizeOfVariable (
   @param[in] Attributes         Attributes of the variable.\r
   @param[in] KeyIndex           Index of associated public key.\r
   @param[in] MonotonicCount     Value of associated monotonic count.\r
-  @param[in] Variable           The variable information that is used to keep track of variable usage.\r
+  @param[in, out] Variable      The variable information that is used to keep track of variable usage.\r
 \r
   @param[in] TimeStamp          Value of associated TimeStamp.\r
 \r
@@ -190,7 +295,7 @@ UpdateVariable (
   IN      UINT32          Attributes OPTIONAL,\r
   IN      UINT32          KeyIndex  OPTIONAL,\r
   IN      UINT64          MonotonicCount  OPTIONAL,\r
-  IN      VARIABLE_POINTER_TRACK *Variable,\r
+  IN OUT  VARIABLE_POINTER_TRACK *Variable,\r
   IN      EFI_TIME        *TimeStamp  OPTIONAL  \r
   );\r
 \r
@@ -330,6 +435,40 @@ VariableCommonInitialize (
   VOID\r
   );\r
 \r
+/**\r
+\r
+  Variable store garbage collection and reclaim operation.\r
+\r
+  If ReclaimPubKeyStore is FALSE, reclaim variable space by deleting the obsoleted varaibles.\r
+  If ReclaimPubKeyStore is TRUE, reclaim invalid key in public key database and update the PubKeyIndex\r
+  for all the count-based authenticate variable in NV storage.\r
+\r
+  @param[in]      VariableBase            Base address of variable store.\r
+  @param[out]     LastVariableOffset      Offset of last variable.\r
+  @param[in]      IsVolatile              The variable store is volatile or not;\r
+                                          if it is non-volatile, need FTW.\r
+  @param[in, out] UpdatingPtrTrack        Pointer to updating variable pointer track structure.\r
+  @param[in]      NewVariable             Pointer to new variable.\r
+  @param[in]      NewVariableSize         New variable size.\r
+  @param[in]      ReclaimPubKeyStore      Reclaim for public key database or not.\r
+  \r
+  @return EFI_SUCCESS                  Reclaim operation has finished successfully.\r
+  @return EFI_OUT_OF_RESOURCES         No enough memory resources or variable space.\r
+  @return EFI_DEVICE_ERROR             The public key database doesn't exist.\r
+  @return Others                       Unexpect error happened during reclaim operation.\r
+\r
+**/\r
+EFI_STATUS\r
+Reclaim (\r
+  IN     EFI_PHYSICAL_ADDRESS         VariableBase,\r
+  OUT    UINTN                        *LastVariableOffset,\r
+  IN     BOOLEAN                      IsVolatile,\r
+  IN OUT VARIABLE_POINTER_TRACK       *UpdatingPtrTrack,\r
+  IN     VARIABLE_HEADER              *NewVariable,\r
+  IN     UINTN                        NewVariableSize,\r
+  IN     BOOLEAN                      ReclaimPubKeyStore\r
+  );\r
+\r
 /**\r
   This function reclaims variable storage if free size is below the threshold.\r
   \r
@@ -386,6 +525,10 @@ GetFvbInfoByAddress (
 \r
   This code finds variable in storage blocks (Volatile or Non-Volatile).\r
 \r
+  Caution: This function may receive untrusted input.\r
+  This function may be invoked in SMM mode, and datasize and data are external input.\r
+  This function will do basic validation, before parse the data.\r
+\r
   @param VariableName               Name of Variable to be found.\r
   @param VendorGuid                 Variable vendor GUID.\r
   @param Attributes                 Attribute value of the variable found.\r
@@ -413,6 +556,9 @@ VariableServiceGetVariable (
 \r
   This code Finds the Next available variable.\r
 \r
+  Caution: This function may receive untrusted input.\r
+  This function may be invoked in SMM mode. This function will do basic validation, before parse the data.\r
+\r
   @param VariableNameSize           Size of the variable name.\r
   @param VariableName               Pointer to variable name.\r
   @param VendorGuid                 Variable Vendor Guid.\r
@@ -435,6 +581,13 @@ VariableServiceGetNextVariableName (
 \r
   This code sets variable in storage blocks (Volatile or Non-Volatile).\r
 \r
+  Caution: This function may receive untrusted input.\r
+  This function may be invoked in SMM mode, and datasize and data are external input.\r
+  This function will do basic validation, before parse the data.\r
+  This function will parse the authentication carefully to avoid security issues, like\r
+  buffer overflow, integer overflow.\r
+  This function will check attribute carefully to avoid authentication bypass.\r
+\r
   @param VariableName                     Name of Variable to be found.\r
   @param VendorGuid                       Variable vendor GUID.\r
   @param Attributes                       Attribute value of the variable found\r
@@ -463,6 +616,37 @@ VariableServiceSetVariable (
 \r
   This code returns information about the EFI variables.\r
 \r
+  Caution: This function may receive untrusted input.\r
+  This function may be invoked in SMM mode. This function will do basic validation, before parse the data.\r
+\r
+  @param Attributes                     Attributes bitmask to specify the type of variables\r
+                                        on which to return information.\r
+  @param MaximumVariableStorageSize     Pointer to the maximum size of the storage space available\r
+                                        for the EFI variables associated with the attributes specified.\r
+  @param RemainingVariableStorageSize   Pointer to the remaining size of the storage space available\r
+                                        for EFI variables associated with the attributes specified.\r
+  @param MaximumVariableSize            Pointer to the maximum size of an individual EFI variables\r
+                                        associated with the attributes specified.\r
+\r
+  @return EFI_SUCCESS                   Query successfully.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+VariableServiceQueryVariableInfoInternal (\r
+  IN  UINT32                 Attributes,\r
+  OUT UINT64                 *MaximumVariableStorageSize,\r
+  OUT UINT64                 *RemainingVariableStorageSize,\r
+  OUT UINT64                 *MaximumVariableSize\r
+  );\r
+\r
+/**\r
+\r
+  This code returns information about the EFI variables.\r
+\r
+  Caution: This function may receive untrusted input.\r
+  This function may be invoked in SMM mode. This function will do basic validation, before parse the data.\r
+\r
   @param Attributes                     Attributes bitmask to specify the type of variables\r
                                         on which to return information.\r
   @param MaximumVariableStorageSize     Pointer to the maximum size of the storage space available\r
@@ -485,7 +669,168 @@ VariableServiceQueryVariableInfo (
   OUT UINT64                 *RemainingVariableStorageSize,\r
   OUT UINT64                 *MaximumVariableSize\r
   );  \r
-  \r
+\r
+/**\r
+  Mark a variable that will become read-only after leaving the DXE phase of execution.\r
+\r
+  @param[in] This          The VARIABLE_LOCK_PROTOCOL instance.\r
+  @param[in] VariableName  A pointer to the variable name that will be made read-only subsequently.\r
+  @param[in] VendorGuid    A pointer to the vendor GUID that will be made read-only subsequently.\r
+\r
+  @retval EFI_SUCCESS           The variable specified by the VariableName and the VendorGuid was marked\r
+                                as pending to be read-only.\r
+  @retval EFI_INVALID_PARAMETER VariableName or VendorGuid is NULL.\r
+                                Or VariableName is an empty string.\r
+  @retval EFI_ACCESS_DENIED     EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has\r
+                                already been signaled.\r
+  @retval EFI_OUT_OF_RESOURCES  There is not enough resource to hold the lock request.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+VariableLockRequestToLock (\r
+  IN CONST EDKII_VARIABLE_LOCK_PROTOCOL *This,\r
+  IN       CHAR16                       *VariableName,\r
+  IN       EFI_GUID                     *VendorGuid\r
+  );\r
+\r
+/**\r
+  Check if a Unicode character is a hexadecimal character.\r
+\r
+  This function checks if a Unicode character is a\r
+  hexadecimal character.  The valid hexadecimal character is\r
+  L'0' to L'9', L'a' to L'f', or L'A' to L'F'.\r
+\r
+\r
+  @param Char           The character to check against.\r
+\r
+  @retval TRUE          If the Char is a hexadecmial character.\r
+  @retval FALSE         If the Char is not a hexadecmial character.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+IsHexaDecimalDigitCharacter (\r
+  IN CHAR16             Char\r
+  );\r
+\r
+/**\r
+  Internal SetVariable check.\r
+\r
+  @param[in] VariableName       Name of Variable to set.\r
+  @param[in] VendorGuid         Variable vendor GUID.\r
+  @param[in] Attributes         Attribute value of the variable.\r
+  @param[in] DataSize           Size of Data to set.\r
+  @param[in] Data               Data pointer.\r
+\r
+  @retval EFI_SUCCESS           The SetVariable check result was success.\r
+  @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits, name, and GUID were supplied,\r
+                                or the DataSize exceeds the minimum or maximum allowed,\r
+                                or the Data value is not following UEFI spec for UEFI defined variables.\r
+  @retval EFI_WRITE_PROTECTED   The variable in question is read-only.\r
+  @retval Others                The return status from check handler.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+InternalVarCheckSetVariableCheck (\r
+  IN CHAR16     *VariableName,\r
+  IN EFI_GUID   *VendorGuid,\r
+  IN UINT32     Attributes,\r
+  IN UINTN      DataSize,\r
+  IN VOID       *Data\r
+  );\r
+\r
+/**\r
+  Register SetVariable check handler.\r
+\r
+  @param[in] Handler            Pointer to check handler.\r
+\r
+  @retval EFI_SUCCESS           The SetVariable check handler was registered successfully.\r
+  @retval EFI_INVALID_PARAMETER Handler is NULL.\r
+  @retval EFI_ACCESS_DENIED     EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has\r
+                                already been signaled.\r
+  @retval EFI_OUT_OF_RESOURCES  There is not enough resource for the SetVariable check handler register request.\r
+  @retval EFI_UNSUPPORTED       This interface is not implemented.\r
+                                For example, it is unsupported in VarCheck protocol if both VarCheck and SmmVarCheck protocols are present.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+VarCheckRegisterSetVariableCheckHandler (\r
+  IN VAR_CHECK_SET_VARIABLE_CHECK_HANDLER   Handler\r
+  );\r
+\r
+/**\r
+  Internal variable property get.\r
+\r
+  @param[in]  Name              Pointer to the variable name.\r
+  @param[in]  Guid              Pointer to the vendor GUID.\r
+  @param[out] VariableProperty  Pointer to the output variable property.\r
+\r
+  @retval EFI_SUCCESS           The property of variable specified by the Name and Guid was got successfully.\r
+  @retval EFI_NOT_FOUND         The property of variable specified by the Name and Guid was not found.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+InternalVarCheckVariablePropertyGet (\r
+  IN CHAR16                         *Name,\r
+  IN EFI_GUID                       *Guid,\r
+  OUT VAR_CHECK_VARIABLE_PROPERTY   *VariableProperty\r
+  );\r
+\r
+/**\r
+  Variable property set.\r
+\r
+  @param[in] Name               Pointer to the variable name.\r
+  @param[in] Guid               Pointer to the vendor GUID.\r
+  @param[in] VariableProperty   Pointer to the input variable property.\r
+\r
+  @retval EFI_SUCCESS           The property of variable specified by the Name and Guid was set successfully.\r
+  @retval EFI_INVALID_PARAMETER Name, Guid or VariableProperty is NULL, or Name is an empty string,\r
+                                or the fields of VariableProperty are not valid.\r
+  @retval EFI_ACCESS_DENIED     EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has\r
+                                already been signaled.\r
+  @retval EFI_OUT_OF_RESOURCES  There is not enough resource for the variable property set request.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+VarCheckVariablePropertySet (\r
+  IN CHAR16                         *Name,\r
+  IN EFI_GUID                       *Guid,\r
+  IN VAR_CHECK_VARIABLE_PROPERTY    *VariableProperty\r
+  );\r
+\r
+/**\r
+  Variable property get.\r
+\r
+  @param[in]  Name              Pointer to the variable name.\r
+  @param[in]  Guid              Pointer to the vendor GUID.\r
+  @param[out] VariableProperty  Pointer to the output variable property.\r
+\r
+  @retval EFI_SUCCESS           The property of variable specified by the Name and Guid was got successfully.\r
+  @retval EFI_INVALID_PARAMETER Name, Guid or VariableProperty is NULL, or Name is an empty string.\r
+  @retval EFI_NOT_FOUND         The property of variable specified by the Name and Guid was not found.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+VarCheckVariablePropertyGet (\r
+  IN CHAR16                         *Name,\r
+  IN EFI_GUID                       *Guid,\r
+  OUT VAR_CHECK_VARIABLE_PROPERTY   *VariableProperty\r
+  );\r
+\r
+/**\r
+  Initialize variable quota.\r
+\r
+**/\r
+VOID\r
+InitializeVariableQuota (\r
+  VOID\r
+  );\r
+\r
 extern VARIABLE_MODULE_GLOBAL  *mVariableModuleGlobal;\r
 \r
 #endif\r