Fix a bug that the invalid public key will never be removed from public key database.

Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting  <ting.ye@intel.com>
Reviewed-by: Dong Guo <guo.dong@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14041 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
sfu5
2013-01-09 05:09:39 +00:00
parent 8b5b3d421f
commit 83758cdc84
3 changed files with 398 additions and 104 deletions

View File

@@ -2,7 +2,7 @@
The internal header file includes the common header files, defines
internal structure and functions used by Variable modules.
Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
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
@@ -366,6 +366,37 @@ VariableCommonInitialize (
VOID
);
/**
Variable store garbage collection and reclaim operation.
If ReclaimPubKeyStore is FALSE, reclaim variable space by deleting the obsoleted varaibles.
If ReclaimPubKeyStore is TRUE, reclaim invalid key in public key database and update the PubKeyIndex
for all the count-based authenticate variable in NV storage.
@param[in] VariableBase Base address of variable store.
@param[out] LastVariableOffset Offset of last variable.
@param[in] IsVolatile The variable store is volatile or not;
if it is non-volatile, need FTW.
@param[in] UpdatingVariable Pointer to updating variable.
@param[in] ReclaimPubKeyStore Reclaim for public key database or not.
@param[in] ReclaimAnyway If TRUE, do reclaim anyway.
@return EFI_OUT_OF_RESOURCES No enough memory resources.
@return EFI_SUCCESS Reclaim operation has finished successfully.
@return Others Unexpect error happened during reclaim operation.
**/
EFI_STATUS
Reclaim (
IN EFI_PHYSICAL_ADDRESS VariableBase,
OUT UINTN *LastVariableOffset,
IN BOOLEAN IsVolatile,
IN VARIABLE_HEADER *UpdatingVariable,
IN BOOLEAN ReclaimPubKeyStore,
IN BOOLEAN ReclaimAnyway
);
/**
This function reclaims variable storage if free size is below the threshold.