]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.h
Calculate enough space for 2 variables (public key and variable data) instead of...
[mirror_edk2.git] / SecurityPkg / VariableAuthenticated / RuntimeDxe / Variable.h
index b9f4f434026d43f10f7131ac3db4e482ceefaea2..c0497afe5e0fbfb257b501eefc358f6054ee9f77 100644 (file)
@@ -111,10 +111,6 @@ typedef struct {
 typedef struct {\r
   EFI_GUID    *Guid;\r
   CHAR16      *Name;\r
-//  UINT32      Attributes;\r
-  //\r
-  // Variable size include variable header, name and data.\r
-  //\r
   UINTN       VariableSize;\r
 } VARIABLE_ENTRY_CONSISTENCY;\r
 \r
@@ -221,6 +217,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