]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/VariableAuthenticated/RuntimeDxe/AuthService.c
SecurityPkg Variable: Support the new introduced PcdMaxAuthVariableSize.
[mirror_edk2.git] / SecurityPkg / VariableAuthenticated / RuntimeDxe / AuthService.c
index 36d447027d89c4d7fdd21ae20a444eba96e6ccc4..9599c8a6d8a0bee5d0cd765bbc7c99e683bd3ab2 100644 (file)
@@ -124,13 +124,18 @@ InCustomMode (
 /**\r
   Initializes for authenticated varibale service.\r
 \r
+  @param[in] MaxAuthVariableSize    Reflect the overhead associated with the saving\r
+                                    of a single EFI authenticated variable with the exception\r
+                                    of the overhead associated with the length\r
+                                    of the string name of the EFI variable.\r
+\r
   @retval EFI_SUCCESS           Function successfully executed.\r
   @retval EFI_OUT_OF_RESOURCES  Fail to allocate enough memory resources.\r
 \r
 **/\r
 EFI_STATUS\r
 AutenticatedVariableServiceInitialize (\r
-  VOID\r
+  IN UINTN      MaxAuthVariableSize\r
   )\r
 {\r
   EFI_STATUS              Status;\r
@@ -158,7 +163,7 @@ AutenticatedVariableServiceInitialize (
   //\r
   // Reserve runtime buffer for public key database. The size excludes variable header and name size.\r
   //\r
-  mMaxKeyDbSize = PcdGet32 (PcdMaxVariableSize) - sizeof (VARIABLE_HEADER) - sizeof (AUTHVAR_KEYDB_NAME);\r
+  mMaxKeyDbSize = (UINT32) (MaxAuthVariableSize - sizeof (AUTHVAR_KEYDB_NAME));\r
   mMaxKeyNumber = mMaxKeyDbSize / EFI_CERT_TYPE_RSA2048_SIZE;\r
   mPubKeyStore  = AllocateRuntimePool (mMaxKeyDbSize);\r
   if (mPubKeyStore == NULL) {\r
@@ -168,7 +173,7 @@ AutenticatedVariableServiceInitialize (
   //\r
   // Reserve runtime buffer for certificate database. The size excludes variable header and name size.\r
   //\r
-  mMaxCertDbSize = PcdGet32 (PcdMaxVariableSize) - sizeof (VARIABLE_HEADER) - sizeof (EFI_CERT_DB_NAME);\r
+  mMaxCertDbSize = (UINT32) (MaxAuthVariableSize - sizeof (EFI_CERT_DB_NAME));\r
   mCertDbStore   = AllocateRuntimePool (mMaxCertDbSize);\r
   if (mCertDbStore == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r